简体   繁体   English

在Jqgrid中显示数据

[英]Displaying data in Jqgrid

I have a value stored in array variable item like 我有一个存储在数组变量item的值,例如

var item = JSON.stringify(product);
cartproduct[cartproduct.length] = item; 

item holds data such as item包含以下数据

{
  "Product": "1001",
  "Brand": "Dell",
  "Model": "Inspiron ",
  "Price":"25000"
}

Now i want to display this item data in respective jqgrid columns like Product, Brand, Model .. 现在,我想在相应的jqgrid列(例如产品,品牌,型号..)中显示该item数据。

I saw one jsFiddle example like http://jsfiddle.net/amorris/yNw3C/ 我看到了一个jsFiddle示例,例如http://jsfiddle.net/amorris/yNw3C/

Now all I want is my item value in the format of data . 现在,我想要的只是data格式的item值。

var data = [[48803, "DSK1", "", "02200220", "OPEN"]];

var item = [[1000,"Sony","Vaio",40000]];

Try this: 尝试这个:

var itemFormatted = [[
  item.Product,
  item.Brand,
  item.Model,
  item.Price
]];

// Now itemFormatted will be in the correct format

Check out Working with Javascript objects for more information. 请查看使用Javascript对象以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM