我有一个值存储在数组变量item
中,例如
var item = JSON.stringify(product);
cartproduct[cartproduct.length] = item;
item
保存诸如
{
"Product": "1001",
"Brand": "Dell",
"Model": "Inspiron ",
"Price":"25000"
}
现在我想在相应的 jqgrid 列中显示此 item
数据,例如产品、品牌、型号..
我看到一个 jsFiddle 示例,例如 http://jsfiddle.net/amorris/yNw3C/
现在我想要的只是 data
格式的 item
值。
var data = [[48803, "DSK1", "", "02200220", "OPEN"]];
var item = [[1000,"Sony","Vaio",40000]];
最佳答案
试试这个:
var itemFormatted = [[
item.Product,
item.Brand,
item.Model,
item.Price
]];
// Now itemFormatted will be in the correct format
查看Working with Javascript objects了解更多信息。
关于javascript - 在 Jqgrid 中显示数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16869655/