2016-03-01 63 views
1

在最新的免費jqgrid textarea用於內聯和表單編輯。 內聯編輯列寬應爲350px。這是在colmodel中指定的,並且正常工作。如何在表單中增加textarea寬度在免費jqgrid中編輯

如何在表單中增加textarea寬度編輯多於350px,以便它佔據表單編輯窗口中的整個編輯列或具有更大的硬編碼寬度? 我試圖使用模板中的類屬性來添加類只在表單編輯,但類不添加到textarea。

Colmodel:

{"template":MultiLineTemplate, 
"name":"Avaldis", 
"editoptions":{ 
    "class":"", 
    "readonly":null 
    }, 
"editrules":{"edithidden":true}, 
"editable":function(options){return getEditable(options,false);} 
,"width":350 
} 

的JavaScript中使用colmodel:

var multilinePrefix = '<div class="jqgrid-multiline-cell">'; 
var MultiLineTemplate = { 
    edittype: "textarea", 
    searchoptions: { sopt: ["cn", "nc"] }, 
    formatter: function (v) { 
     return multilinePrefix + (v == null ? '' : $.jgrid.htmlEncode(v)) + '</div>'; 
    }, 

    unformat: function (cellvalue) { 
     return cellvalue; 
    }, 

    editoptions: 
    { 
     rows: 3, 
     wrap: "off", 
     style: 'overflow-x: hidden', 
    } 
}; 


function getEditable(options, isReadonly) { 
    if (!isReadonly) { 
     return true; 
    } 
    if (options.mode === "cell" || options.mode === "add" || options.mode === "edit") { 
     return true; 
    } 
    return "readonly"; 
} 

風格:

.jqgrid-multiline-cell { 
    max-height: 2.8em; 
    overflow-x: hidden; 
} 

問題how to restrict jqgrid textarea height in grid only有點與此相關的。

回答

3

我想你可以通過添加的editoptions財產cols: 20解決的問題:

editoptions: { cols: 20 } 

到具有edittype: "textarea"列。

+0

謝謝。有效。 – Andrus

+0

@安德魯斯:不客氣! – Oleg

相關問題