References:Http://www.trirand.com/jqgridwiki/doku.php? Id = wiki: common_rules # editable
There are some problems with the edittype: 'custom' example in the document. For correct call, see the following example.
In this example, we mainly want to implement the onclick event in the input box.
Colnames: ['id', 'username', 'Password', 'authorization'],
Colmodel :[
{Name: 'id', index: 'id', width: 60, key: True, Editable: false,
Searchoptions: {SOPT: ['eq ', 'ne', 'lt ', 'le', 'gt', 'ge ']},
{Name: 'username', index: 'username', width: 120, sortable: false, Editable: True,
Editrules: {required: true }},
{Name: 'Password', index: 'Password', width: 120, sortable: false, Editable: True,
Edittype: 'custom', editoptions: {custom_element: myelem, custom_value: myvalue }},
{Name: 'usertype', index: 'usertype', width: 60, Editable: True,
Searchoptions: {SOPT: ['eq ', 'ne', 'lt ', 'le', 'gt', 'ge']}
],
The JS Code is as follows:
Function myelem (value, options ){
VaR El = Document. createelement_x ("input ");
El. type = "password ";
El. value = value;
El. onclick = function () {El. Focus (); El. Select ();};
// Alert ("myelem:" + value );
Return El;
};
Function myvalue (ELEM, operation, value ){
// Alert ("myvalue:" + value );
If (Operation = 'get '){
Return $ (ELEM). Val ();
} Else if (Operation === 'set '){
$ (ELEM). Val (value );
}
};
Note: myelemAndThe myvalue method must be placed before the grid creation. If it cannot be found