选中复选框时,jqgrid选择行

时间:2012-01-15 12:08:09

标签: jquery jqgrid

我尝试了How to select jqGrid row on checkbox click中给出的建议,但它们没有用。

var lastsel;
jQuery().ready(function (){
    jQuery("#rowed3").jqGrid({
        url:'ajax.cgi?datagrid=2&region=1',
        datatype: "xml",
        colNames:[' ','Approve/<br>Deny', 'MRC', 'Order<br>Number','Notes'],
        colModel:[
             {name:'detail_link',index:'detail_link',width:15},
             {name:'approve',index:'approve', sortable:true, search:true,
                 searchoptions: { sopt: ['eq','ne','bw','ew']}, width:60,
                 align: "center", editable:true, edittype:"checkbox",
                 formatter: "checkbox", formatoptions: {disabled : false}},
             {name:'gross',index:'gross', search:true,
                 searchoptions: { sopt: ['eq','ne','bw','ew']},
                 editable:true, sortable:true, width:60},
             {name:'svsOrderNumber',index:'svsOrderNumber', sortable:true,
                 search:true, searchoptions: { sopt: ['eq','ne','bw','ew']},
                 width:80,editable:true},
             {name:'approve_notes',index:'approve_notes', sortable:true,
                 search:true, searchoptions: { sopt: ['eq','ne','bw','ew']},
                 width:100,editable:true}
        ],
        loadtext: 'Retrieving Data...',
        rowNum:15,
        rowList:[15,30,45],
        ajaxRowOptions: { async: true },
        height: "auto",
        pager: '#prowed3',
        loadonce: true,
        sortname: 'ID',
        sortable:true,
        viewrecords: true,
        sortorder: "desc",
        imgpath: '/images',
        onSelectRow: function(id){
            if(id && id!==lastsel){
                jQuery('#rowed3').jqGrid('restoreRow',lastsel);
                lastsel=id;
            }
            jQuery('#rowed3').jqGrid('editRow',id,true,'','','',
                {action:'finance',region:1});
        },
        editurl: 'ajax.cgi',
        caption: ""
    }).navGrid('#prowed3',
        {search:true, edit: false, add:false, del:false,
            refresh:true, searchtext:"Search"});

我按下回车键实时保存行的数据。复选框数据将保存的唯一方法是,如果首先选择行,则检查它不会触发选择行,因此不会进行保存。我知道我的用户会感到困惑,并期望能够选中该框,只需按Enter键,而无需先选择该行。

此外,我的“重新加载网格”按钮似乎没有做任何事情。我很想让它从服务器重新加载网格:)

0 个答案:

没有答案