想实现 在combo选择查询条件 然后再文本快填写要查的 点击查询 grid 显示数据如何实现
我按钮的方法
function ad() { var a = Ext.getDom('textfield-1035-inputEl').value var b = Ext.getDom('combobox-1034-inputEl').value Ext.Ajax.request({ url: '../Purchase/select1', params: { text: a, combox:b }, success: function (from, action) { Ext.Msg.alert('1'); }, failure: function (form, action) { Ext.Msg.alert('输入信息有误', '搜索失败!'); } }); } var Button= Ext.create('Ext.Button', { text: '搜索', handler: function() { ad(); }
在
success 后应该如何编写呢..在后台的数据库查询后如何 grid 才能load 后台的 json 呢。?
后台代码
public ActionResult select1(string text, string combox) { bool s = true; if (text != null && combox != null) { switch (combox) { case "商品偏号": List<Models.tb_JhGoodsInfo> Jh = (from d in db.tb_JhGoodsInfo.Where(a => a.GoodsID == combox) select d).ToList(); return Json(Jh, JsonRequestBehavior.AllowGet); //break; case "商品名称": List<Models.tb_JhGoodsInfo> aa = (from d in db.tb_JhGoodsInfo.Where(a => a.GoodsName == text) select d).ToList(); return Json(aa, JsonRequestBehavior.AllowGet); //break; case "查询所有信息": List<Models.tb_JhGoodsInfo> bb = (from d in db.tb_JhGoodsInfo select d).ToList(); return Json(bb, JsonRequestBehavior.AllowGet); //break; } } else { s = false; } return Json(new { success = s }, JsonRequestBehavior.AllowGet); }
或者思路有问题 求提出好的思路参考参考。。谢谢
Ext.Ajax.request({ url: '../Purchase/select1', params: { text: a, combox:b }, success: function (from, action) { //from就是后台返回的json字符串,直接操作 Ext.Msg.alert('1'); }, failure: function (form, action) { Ext.Msg.alert('输入信息有误', '搜索失败!'); } });
http://blog.csdn.net/hrl_100/article/details/5639922
我自己研究出来了 谢谢你