首页 新闻 赞助 找找看

.net MVC 结合Extjs combox 多条件查询

0
悬赏园豆:10 [已关闭问题] 关闭于 2014-08-25 09:12

想实现 在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);
        }

 

或者思路有问题 求提出好的思路参考参考。。谢谢
Yamax的主页 Yamax | 初学一级 | 园豆:141
提问于:2014-08-22 15:15
< >
分享
所有回答(1)
0
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

heerake | 园豆:163 (初学一级) | 2014-08-22 17:58

我自己研究出来了 谢谢你

 

支持(0) 反对(0) Yamax | 园豆:141 (初学一级) | 2014-08-22 19:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册