jquery Flexgrid 取记录的方式
思路:改造Flexgrid.js的方法。在?Flexgrid.js中增加对应的方法。
//Mignet's code $.fn.flexGetData = function() { // function to get data from grid var griddata = {total:1,page:1,rows:[]}; this.each( function() { if (this.grid) griddata = this.p.data; }); return griddata; }; //Mignet's code $.fn.getRowById = function(id) { // function to get row's data from grid var griddata = {total:1,page:1,rows:[]}; this.each( function() { if (this.grid) griddata = this.p.data; }); var temp; if (griddata.rows != null) { $.each(griddata.rows, function(i, row) { if(row.id == id){temp = row; } }); } return temp; }; //Mignet's code $.fn.getCellByCoordinate = function(rowid,colid) { // function to get row's data from grid var griddata = {total:1,page:1,rows:[]}; this.each( function() { if (this.grid) griddata = this.p.data; }); var temp; if (griddata.rows != null) { $.each(griddata.rows, function(i, row) { if(row.id == rowid){temp = row.cell[colid]; } }); } return temp; }; //end
??
?
grid.flexGetData();得到所有数据
grid.getRowById(id);通过id取一行数据
grid.getCellByCoordinate(x,y);通过指定行数和列数取得数据