1

感谢 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 GuysHelp me .. 提前谢谢...

4

0 回答 0