I have a data source XMLas shown below
<root>
<item priceOri = "100" discount = "10"></item>
<item priceOri = "200" discount = "110"></item>
.
.
.
</root>
And I fill this data into a table using JqGrid. the code looks something like this.
datatype : 'xml',
colModel: [
...
{name:'priceOri', index:'priceOri', width:60,xmlmap : "[priceOri]", align:"center"},
{name:'discount', index:'discount', width:60,xmlmap : "[discount]", align:"center"},
{name:'price', index:'price', width:60,xmlmap : "[price]", align:"center", editable: true, formatter:discountFmatter},
...
]
xmlReader: {
root: "root",
row: "item",
repeatitems: false
},
The formatter is as follows.
function discountFmatter (cellvalue, options, rowObject)
{
var price;
var new_format_value = price;
return new_format_value
}
As in the code, I need to access the other values ββin the tag itemin order to calculate the section price. So basically I want to access other cell values ββin the same row. How can i do this.
I used the code snippets below, but they were listed as undefined
rowObject[0] // undefined
rowObject.priceOri //undefined
Can anyone show me the steps to achieve this.
: JqGrid 4.4.0 . , . , JqGrid 4.4.0.
, Oleg rowObject instanceof Element ? $(rowObject).attr("priceOri") : rowObject.priceOri .
2: ( rowObject.rewards )
XML ,
< item priceOri = "100" discount = "10" rewards = "20" > </item>
,
function discountFmatter (cellvalue, options, rowObject)
{
var price;
var new_format_value = price;
return new_format_value
}
, rewards jQgrid. , .
: In case of usage old jqGrid you will have to add new column rewards. You can use hidden: true property in the column. Free jqGrid allow you to use additionalProperties