0

我重置有问题,如您所见,我已将状态默认设置为ACTIVE,并且只能选择一条记录,选择记录后用户可以单击ADD WO

http://i48.tinypic.com/11udoo6.jpg

但是当点击重置按钮时,整个状态栏会发生变化

http://i45.tinypic.com/25a6vcp.jpg

我也将 dafaultvalue 设置为 ACTIVE ..!! 我必须保持状态处于活动状态,当它重置时..!!请帮助我

function initJqGridSearchSubProject(table,pager,msg,loadSelID,caption,chkMrk ){

 $(table).empty();
 $(table).GridUnload();
 var mygrid =jQuery(table).jqGrid({
    datatype: "local",      
    data:msg,   
    width: 1240,
    scrollOffset:0,     
    height: 250,
    colNames:['ID','PID','Project Folder Name','Sub Project Name','Responsible','Status','Last Updated On'],
    colModel:[
    {name:'id',index:'id',hidden:true, width:5, sorttype:"int", editable: false,resizable:false},
    {name:'pid',hidden:true, width:5, sorttype:"int", editable: false,resizable:false},
    {name:'projectFolderName', width:250, editable: true,formatter:'tsLinks'},
    {name:'subProjectName', width:250, editable: true,formatter:'subProjectLinks'},
    //{name:'eCNNumber', width:150, editable: true},                
    {name:'responsible', width:200, editable:false,resizable:false},
    {name:'status', width:100,editable: true,stype:'select',edittype:"select",resizable:false,searchoptions:{defaultValue:"ACTIVE"},editoptions:{value:"ACTIVE:ACTIVE;INACTIVE:INACTIVE;DELETED:DELETED",readonly:false},editrules:{edithidden:false}}, 
    {name:'lastUpdatedOn', width:200,editable: false,resizable:false,sorttype:'date',formatter:'date',formatoptions:{ srcformat: 'M d y H:i:s', newformat: 'd M y h:i A' }}

        ],
    pager: pager,
    rowNum:200,     
    rowList:[200,400,600,1000],
    //rowTotal:2000,                    
    //loadOnce:true,    
    //rownumbers:true,
    gridview : true,
    sortname: 'lastUpdatedOn',                  
    viewrecords: true,
    sortorder: "desc",                  
    toppager:true,
    multiselect:true,
    singleselect: false, 
    //multiboxonly:true,
    //toolbar: [true,'both'],                   
    caption:caption,
    hidegrid: false,
    gridComplete:function(id){
    //$(chkMrk).hide();
    //alert('grid complete');
    },
    beforeSelectRow: function(rowid, e)
    {
        // reset check box selection only when user clicks on another checkbox
        if($(e.target).is("input:checkbox"))
        {
            // reset/clear other checkboxes selection before making a latest clicked row's checkbox as selected
            jQuery(table).jqGrid('resetSelection');
        }

        // Code To Disable Check Box Selection When User Selects by Clicking on A Row
        return $(e.target).is("input:checkbox");
        //return(true);
    }

}); 
jQuery(table).jqGrid('navGrid',pager,{del:false,add:false,edit:false,search:false,refresh:true,cloneToTop:true,afterRefresh:function(){}},{},{},{},{}); 
jQuery(table).jqGrid('navButtonAdd', table+ '_toppager_left',{caption:"Add WO", buttonicon:"ui-icon ui-icon-plus",id:"SUBPROJID", onClickButton: function(){},position:"first",title:"Add WO"});
4

2 回答 2

0

您所做的是您将defaultValue选项设置为 insearchoptions而不是editoptions. 你只需要在那里添加相同的内容。只需尝试更改status列的定义,如下所示:

{name:'status', width:100,editable: true,stype:'select',edittype:"select",
resizable:false,searchoptions:{defaultValue:"ACTIVE"},
editoptions:{value:"ACTIVE:ACTIVE;INACTIVE:INACTIVE;DELETED:DELETED",
readonly:false, defaultValue:"ACTIVE"},editrules:{edithidden:false}},

更新 :

要调用beforeRefresh事件处理程序内部的行,您可以执行以下操作:

jQuery(table).jqGrid('navGrid',pager,
  { edit:false,view:false,add:false,del:false,search:false,
    beforeRefresh: function(){
        alert('Here');
        jQuery(table).jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');
    }
  });
于 2013-04-04T05:09:32.857 回答
0

终于得到了结果,我只是在重置按钮函数中添加了 triggerToolbar() 。

jQuery(table).jqGrid('navGrid',pager,{del:false,add:false,edit:false,search:false,refresh:true,cloneToTop:true,afterRefresh:function(){$(table)[0].triggerToolbar();}},{},{},{},{});

现在它工作正常..!

于 2013-04-04T15:07:29.677 回答