public dotNetFlexGrid.DataHandlerResult FlexGridDrugDataHandler(dotNetFlexGrid.DataHandlerParams p) { dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult(); result.page = p.page; //设定当前返回的页号 result.total = 100; //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际 // result.table = dotNetFlexGrid.DemoMemoryTable(p.page * 100, p.rp);//调用演示的数据生成函数产生模拟数据 TeModel tm = new TeModel(); string PackMachine = "0"; if (p.extParam.ContainsKey("PackMachine")) { PackMachine = p.extParam["PackMachine"]; } result.table = tm.getPackingMachineInfobyid(Convert.ToInt32(PackMachine)); //如果传递的参数包含排序设置的话,通过DataView.Sort功能模拟进行当页排序 //if (p.sortname.Length > 0 && p.sortorder.Length > 0) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.Sort = (p.sortname + " " + p.sortorder); // result.table = dv.ToTable(); //} ////处理默认查询,即Button1_Click中指定的DefaultSearch查询参数 //if (p.defaultSearch.ContainsKey("String1")) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.RowFilter = "String1 Like '%" + p.defaultSearch["String1"] + "%'"; // result.table = dv.ToTable(); //} ////如果传递的参数包含附加参数的话,再来模拟查询,原谅我真的很懒。 //if (p.extParam.ContainsKey("String1")) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.RowFilter = "String1 Like '%" + p.extParam["String1"] + "%'"; // result.table = dv.ToTable(); //} ////如果传递的参数包含快速查询参数,则进行快速查询 //if (p.qop != dotNetFlexGrid.SerchParamConfigOperater.None && p.qtype.Length > 0 && p.query.Length > 0) //{ // System.Data.DataView dv = result.table.DefaultView; // if (p.qop == dotNetFlexGrid.SerchParamConfigOperater.Like) // dv.RowFilter = p.qtype + " Like '%" + p.query + "%'"; // else // dv.RowFilter = p.qtype + " = '" + p.query + "'"; // result.table = dv.ToTable(); //} return(result); }