Quantcast
Channel: iT邦幫忙
Viewing all articles
Browse latest Browse all 15645

jqGrid連動顯示欄位

$
0
0
我原本是寫在jqGrid的colModel裡的
{
name: 'CategoryNo', index: 'CategoryNo', width: 100, editable: true,
edittype: 'custom',
formatter: function (cellvalue, options, rowObject) {
return "<span>" + cellvalue + "</span><span>" + getCategoryName(cellvalue) + "</span>";
},
unformat: function (cellvalue, options, cell) {
return $('span', cell).eq(0).html();
},
editoptions: {
dataInit: function (elem) {
myAutocomplete($(elem).find('input'), "/AccountingCategory/GetAutoComplete");
},
custom_element: function (value, options) {
var e1 = document.createElement("p");
var e2 = document.createElement("input");
var e3 = document.createElement("span");
e2.type = "text";
e2.size = 4;
if (value != 'undefined')
e2.value = value;
e3.innerHTML = getCategoryName(value);
e1.appendChild(e2);
e1.appendChild(e3);
return e1;
},
custom_value: function (elem, operation, value) {
if (operation === 'get') {
return $(elem).find('input').val();
} else if (operation === 'set') {
$('input', elem).val(value);
$('span', elem).html(getCategoryName(value));
}
}
},
editrules: { required: true }
},

Viewing all articles
Browse latest Browse all 15645

Trending Articles