2016-09-02 13 views
2

클라이언트 측에서만 JQGrid (버전 4.6.0)를 사용하고 싶습니다. 그래서 인라인 편집을 사용하여 editurl = 'clientArray'를 입력하기로 결정했습니다.JQGrid : 클라이언트 측의 인라인 편집

문제는 editable = "true"속성을 가진 행을 편집 할 수 없다는 것입니다. 이유는 무엇입니까?

내 코드 :

<@sjg.grid id="gridtable" 
    dataType="json" 
    loadonce="true" 
    href="${remoteurl}" 
    pager="true" 
    gridModel="myList" 
    navigator="true" 
    navigatorAdd="false" 
    navigatorEdit="false" 
    navigatorDelete="false" 
    navigatorView="false" 
    navigatorRefresh="false" 
    navigatorSearch="false" 
    rowNum="50" 
    rownumbers="true" 
    rowList="50,100,200,500,1000,1500,2000" 
    viewrecords="true" 
    autowidth="true" 
    shrinkToFit="true" 
    filter="true" 
    filterOptions="{searchOnEnter:false}" 
    forceFit="true" 
    editurl="clientArray" 
    onFocusTopics="onSelectRow" 
    > 

    <@sjg.gridColumn name="col1" index="col1" title="Col1" sortable="true" editable="true" edittype="text" search="true" sorttype="text" width="50" searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc'],clearSearch: false}"/> 

// Sélection de ligne 
$.subscribe('onSelectRow', function(id) { 
    if(id && id!==lastsel){ 
     jQuery('#gridtable').jqGrid('restoreRow',lastsel); 
     lastsel=id; 
    } 
    jQuery('#gridtable').jqGrid('editRow',id,true); 
}); 

그리고 생성 된 JS :

jQuery(document).ready(function() { 
... 
var options_gridtable = {}; 
... 
options_gridtable.datatype = "json"; 
... 
options_gridtable.url = "myURL"; 
options_gridtable.editurl = "clientArray"; 
options_gridtable.height = 'auto'; 
options_gridtable.pager = "gridtable_pager"; 
options_gridtable.pgbuttons = true; 
options_gridtable.pginput = true; 
options_gridtable.rowNum = 50; 
options_gridtable.rowList = [50,100,200,500,1000,1500,2000]; 
options_gridtable.viewrecords = true; 
options_gridtable.autowidth = true; 
options_gridtable.navigator = true; 
options_gridtable.navigatoradd = false; 
options_gridtable.navigatordel = false; 
options_gridtable.navigatoredit = false; 
options_gridtable.navigatorrefresh = false; 
options_gridtable.navigatorsearch = false; 
options_gridtable.navigatorview = false; 
options_gridtable.navinline = true; 
options_gridtable.loadonce = true; 
options_gridtable.filter = true; 
options_gridtable.filteroptions = {searchOnEnter:false}; 
options_gridtable.shrinkToFit = true; 
options_gridtable.autoencode = true; 
options_gridtable.rownumbers = true; 
options_gridtable.colNames = options_gridtable_colnames; 
options_gridtable.colModel = options_gridtable_colmodels; 
options_gridtable.jsonReader = {}; 
options_gridtable.jsonReader.root = "myList"; 
options_gridtable.jsonReader.repeatitems = false; 
options_gridtable.jqueryaction = "grid"; 
options_gridtable.id = "gridtable"; 
options_gridtable.onfocustopics = "onSelectRow"; 

jQuery.struts2_jquery_grid.bind(jQuery('#gridtable'),options_gridtable); 
}); 

var lastsel; 

// Sélection de ligne 
$.subscribe('onSelectRow', function(id) { 
    if(id && id!==lastsel){ 
     jQuery('#gridtable').jqGrid('restoreRow',lastsel);    
     lastsel=id; 
    } 
    jQuery('#gridtable').jqGrid('editRow',id,true); 
}); 

답변

0

sjg:grid true로 설정해야합니다 editinline 있습니다.

+0

결과는 동일합니다 ... – user3531140

+0

http://struts.jgeppert.com/struts2-jquery-showcase/index.action (위젯> 그리드> 편집 가능)에 작동 예제가 있습니다. 당신은 당신의 태그를 그것과 비교 했습니까?! –