2012-03-21 60 views
0

我有以下JQgrid工作正常。JQGrid創建下拉單元格的值取決於行ID

   $("#Groups_UseCases_Grid").jqGrid({ 
        url: 'groupsHandler.ashx?mod=3', 
        datatype: 'json', 
        mtype: 'GET',     
        loadonce: true, 
        height: 'auto', 

        width:'750px', 
        colNames: ['id', 'groupname', 'workSpace'], 
        colModel: [ 
          { name: 'id', index: 'id', key:true, width: 200, sortable: false, editoptions: {readonly: true,size: 10}}, 
          { name: 'groupname', width: 200, sortable: false, editable:false }, 
          { name: 'workSpace', width: 400, sortable: false, editable:true , edittype:"select",editoptions:{multiple:true, size:"<%=combolistSize%>", value:"<%=combolist%>"} }        
           ],            
        rowNum: 30, 
        rowList: [30, 60, 90], 
        pager: '#pager',     
        sortname: 'id', 
        viewrecords: true, 
        sortorder: 'asc', 
        caption: 'Groups UseCases Ascosiation Grid', 
        editurl: 'groupsHandler.ashx?mod=3', 
        hidegrid: false, 
        altRows:false,     
        altclass:'myAltRowClass',      

        grouping:true, 
        groupingView : { 
        groupField : ['useCase'], 
        groupText : ['<b> useCase : {0} (Records {1}) </b>'] 

       } 
       });    

       jQuery("#Groups_UseCases_Grid").jqGrid('navGrid',"#pager", 
        {edit:false,add:false,del:false}); 
       jQuery("#Groups_UseCases_Grid").jqGrid('inlineNav',"#pager", 
        {edit:true,add:false,del:false}, 
        {afterSubmit: function(rowid, aData){document.forms[1].submit();//alert("row id is "+rowid) 
         }}, 
         {closeAfterEdit: true,reloadAfterSubmit: false}, 
         {closeAfterAdd: true,reloadAfterSubmit: false}, 

         {reloadAfterSubmit: true});       

C# code : private string combolist; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) {
combolist =create_combolist();
}
}
private string create_combolist(/string groupID/) {.....}


我的問題是,我想通過給所選行的ID,因爲它依賴於它,縮小下拉值列表 是否有可能使用onSelectRow生成列的工作空間值? 我試過 onSelectRow: function(id){<%usecasesample.create_combolist(); <%combolist = usecasesample.create_combolist();%>; } , 也可以,但我不能提供行ID。

讚賞任何幫助,在此先感謝,亞歷克斯

回答

0

這似乎很好地工作

 $("#Groups_UseCases_Grid").jqGrid({ 
         url: 'groupsHandler.ashx?mod=2', 
         datatype: 'json', 
         mtype: 'GET',     
         loadonce: true, 
         height: 'auto', 

         width:'850px', 
         colNames: ['groupid', 'groupname', 'workspaces'], 
         colModel: [ 
           { name: 'groupid', index: 'id', key:true, width: 200, sortable: false, editoptions: {readonly: true,size: 10}}, 
           { name: 'groupname',index: 'groupname', width: 200, sortable: false, editable:false }, 
           { name: 'workspaces', width: 400, sortable: false, editable:true , edittype:"select",editoptions:{multiple:true, size:"" }} 


            ],                  
          onSelectRow: function(id) { var name='workspaces'; jQuery("#Groups_UseCases_Grid").setColProp(name, { editoptions: {multiple:true, dataUrl: 'groupsHandler.ashx?mod=3&rowID='+id }}) },  
         rowNum: 30, 
         cellEdit:false, 
         rowList: [30, 60, 90], 
         pager: '#pager',     
         sortname: 'id', 
         viewrecords: true, 
         sortorder: 'asc', 
         caption: 'Groups UseCases Ascosiation Grid', 
         editurl: 'groupsHandler.ashx?mod=2&rows=20&page=1', 
         hidegrid: false, 
         altRows:false,     
         altclass:'myAltRowClass',      

         grouping:true, 
         groupingView : { 
         groupField : ['useCase'], 
         groupText : ['useCase : {0} (Records {1})'] 

        } 
        });    

        jQuery("#Groups_UseCases_Grid").jqGrid('navGrid',"#pager", 
         {edit:false,add:false,del:false}); 
        jQuery("#Groups_UseCases_Grid").jqGrid('inlineNav',"#pager", 
         {edit:true,add:false,del:false}, 
         {afterSubmit: function(rowid, aData){document.forms[1].submit();//alert("row id is "+rowid) 
          }}, 
          {closeAfterEdit: true,reloadAfterSubmit: false}, 
          {closeAfterAdd: true,reloadAfterSubmit: false}, 
          {reloadAfterSubmit: true});       
       
相關問題