Struts2 jquery grid gridColumn field is displayed in dialog although using hidedlg=“true”

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

<sjg:gridColumn      name="progressivo"      index="progressivo"      title="ID"      sortable="false"     formatter="integer"     width="40"     displayTitle="false"     editable="true"     hidedlg="true"     editrules="{edithidden:false}"/> 

I do NOT want to be able to edit the field, I do NOT want to show it in the edit Dialog, but I want to pass it to the action. My understanding is that I should use editable="true", hidedlg="true", editrules="{edithidden:false}" as specified above. But the field is still visible and editable in the dialog... anyone knows what is wrong with this code? thanks

回答1:

I don't see hidden="true" in the list of attributes of <sjg:gridColumn ...>. Moreover you use editrules="{edithidden:false}" instead of editrules="{edithidden:true }". Probably it's the problem.

In other words you need to have the column properties

hidden: true, editable: true, editrules: { edithidden: true }, hidedlg: true 

described in the answer for example.



回答2:

I think you have two options. I personally handled this requirement by defining my own custom edit options.

Ex:

    ...      editable: true, edittype: 'custom', editoptions: { custom_element: readOnlyTextBox, custom_value: readOnlyTextBoxValue }      ...  function readOnlyTextBox(value, options) {      var el = document.createElement("input");     el.type = "text";     el.value = value;     el.disabled = true; // "disabled";     return el; } //function readOnlyTextBox(value, options) {  function readOnlyTextBoxValue(elem, operation, value) {     //console.log('Elem: ' + elem + '  Operation: ' + operation + '  Passed Value: ' + value + '  Value: ' + $(elem).val());             if (operation === 'get') {         return $(elem).val();     } else if (operation === 'set') {         $(elem).val(value);     } } //function readOnlyTextBoxValue(elem, operation, value) { 

The other option would be to define your own edit form handler and pass in the extra row item value:

        ....         ondblClickRow: function (rowid) {             EditCollectionItem(rowid, this)         }, //ondblClickRow         ....  function EditCollectionItem (rowid, grid){      $(grid).jqGrid('editGridRow', rowid,     {         viewPagerButtons: false,         editData: { ExtraDataKey: ExtraDataValue },         afterShowForm: function (formid) {         }, //afterShowForm         afterComplete: function (response) {         } //afterComplete     }); //$this.jqGrid('editGridRow }//function EditCollectionItem (rowid, grid){ 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!