Jqgrid和Zend框架的麻烦 [英] Jqgrid and Zend framework trouble

查看:56
本文介绍了Jqgrid和Zend框架的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有产品列表.我用jqGrid绘制它.我也有一张表格,可以创建新产品或更新现有产品.有什么方法可以在jqGrid中进行设置,即当我按网格中的编辑"按钮时,它将重定向到类似

I have a list of products on my site. I draw it with jqGrid. Also I have a form, to create new product, or update existing one. Is there any way to set in jqGrid, that when I press 'edit' button in grid, it redirects me to page like

'mysite/product/edit/id/{id}'

'mysite/product/edit/id/{id}'

这是我的网格脚本:

$(document).ready(function() {
    $("#list").jqGrid({
        url:'product/getjson',
        datatype: "json",
        colNames:['id','Name', 'description', 'Publication date','Picture'],
        colModel:[
            {name:'id',index:'id', width:55},
            {name:'name',index:'name', width:90},
            {name:'description',index:'description', width:200},
            {name:'pubDate',index:'pubDate', width:200, align:"right"},
            {name:'picPath',index:'picPath', width:200, align:"right"},
            ],
            rowNum:10,
            rowList:[10,20,30],
            pager: '#pager2',
            sortname: 'id',
            viewrecords: true,
            sortorder: "desc", caption: 'Products'});
           $("#list").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true});
})

推荐答案

您可以根据onclickSubmit函数更改网址(请参见

You can change url with respect of onclickSubmit function (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#editgridrow):

$("#list").jqGrid({
    url:'product/getjson',
    // ...
});
$("#list").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true},
                  { onclickSubmit: function(rp_ge, postdata) {
                      rp_ge.url = 'mysite/product/edit/id/' + postdata.list_id;
                    }
                  });

这篇关于Jqgrid和Zend框架的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆