Thanx To Oleg我在这里添加了代码来获取Jqgrid中的特定列数据,在本地过滤记录,但它没有显示在警告框中过滤的数据。在警告框中,它显示数据的总数量和数据值的空字符串... 这是我的代码......
var oldFrom = $.jgrid.from, lastSelected;
$.jgrid.from = function (source, initalQuery) {
var result = oldFrom.call(this, source, initalQuery),
old_select = result.select;
result.select = function (f) {
lastSelected = old_select.call(this, f);
return lastSelected;
};
return result;
};
这里我正在加载JqGrid ...
loadComplete: function () {
this.p.lastSelected = lastSelected;
}
下面是我的按钮点击功能......
$("#go").click(function () {
var filteredData = $grid.jqGrid('getGridParam', 'lastSelected'), i, n, ids = [],
idName = $grid.jqGrid('getGridParam', 'localReader').price;
if (filteredData) {
for (i = 0, n = filteredData.length; i < n; i++) {
ids.push(filteredData[i][idName]);
}
alert("tolal number of filtered data: " + n + "\n" +
"ids of filtered data:\n" + ids.join(', '));
}
});
这里我想取出我在网格中添加的价格列的值..
{ name: 'price', index: 'price', width: 100, sortable: true, align: 'center',formatter: 'currency' }
.Plz Guys帮助我.. Thanx提前...