2016-09-02 2 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 имеет editinline, который необходимо установить в действительности.

+0

Я добавляю его, но результат тот же ... – user3531140

+0

Существует рабочий образец http://struts.jgeppert.com/struts2-jquery-showcase/index.action (виджеты> сетка> редактируемый). Вы сравнили свой тег с ним ?! –