Detailed analysis of jqgrid editing and Adding Functions

Source: Internet
Author: User
Tags jqgrid

ColModel is the most important attribute in jqGrid. It sets the attributes of table columns.

Usage:

Java code:
Copy codeThe Code is as follows:
JQuery ("# gridid"). jqGrid ({
...
ColModel: [{name: 'name1', index: 'index1'...}, {...},...],
..
});

Default Value of attribute data type Remarks
Align string defines the cell alignment mode. Optional values: left, center, right. left
Classes string sets the column css. Multiple classes are separated by spaces, for example, 'class1 class2 '. The default css attribute of the table is ui-ellipsis empty string.
Datefmt string format the date column ." /","-", And". "are valid date delimiters. Y, Y, yyyy YY, yy month m, mm for monthsd, dd Day. ISO Date (Y-m-d)
The default value of the defval string query field is null.
Editable boolean: whether the cell can be edited; false
Editoptions array some attributes set when editing columns: empty array
Editrules array sets empty array for some additional attributes of Editable Cells
Edittype string can be edited. Optional values: text, textarea, select, checkbox, password, button, image and file. text
Fixed boolean column width to be fixed and immutable false
Formoptions array sets the empty attribute when the form is edited.
Formatoptions array formatting settings for certain columns none
The function name or type set when formatter mixed formatting columns is none.
Hidedlg boolean whether to show or hide this column false
Hidden boolean whether to hide this column when initializing the table false
Index string the index that defines the name of the sorting field when sorting. The parameter is sidx empty string
Jsonmap string defines the returned json data ing none
Key boolean when no id is returned from the server, it is used as a unique rowid. By default, only one id attribute is allowed. false
Label string if colNames is empty, this value is used as the Column Display name. If none is set, the name value is none.
Name string mandatory, table column name, all keywords, reserved words cannot be used as names including subgrid, cb and rn. Required
Whether resizable boolean can be resizable true
In search mode, search boolean defines whether this column can be used as a search column true.
Searchoptions array set the search parameter empty
Whether sortable boolean can be sorted true
Sorttype string is used to define the type of the search column when datatype is local. Optional values: int/integer-Sort integer float/number/currency-sort number date-Sort date text-Sort text
Stype string defines the type of the search element text
Url empty string when searching data in surl string
Width number the default column width, which can only be a pixel value, not a percentage of 150
Xmlmap string defines the ing between the current column and the returned xml data. none
Unformat function 'unformat' cell value null

Add in source code
Copy codeThe Code is as follows:
Editurl: 'index. php? Do = do_edit ',
Addurl: 'index. php? Do = do_add ',
Datatype: 'xml ',
Mtype: 'get ',
ColNames: ['id', 'Task name', 'category'
ColModel :[
{Name: 'taskid', index: 'taskid', width: 100, align: 'center', searchoptions: {sopt: ['eq ', 'ne ', 'Lt ', 'le', 'gt', 'ge']},
{Name: 'taskname', index: 'taskname', width: 100, align: 'center', editable: true },
{Name: 'classid ', index: 'classid', width: 100, align: 'center', editable: true, edittype: 'select', editoptions :{
Value: '1: transaction; 2: Non-transactional '}, editselected: 'classid '},

],

Adding an editable is equally valid;

Search
Eq equals (=)
Ne is not equal to (<>)
Lt is less than (<)
Le is less than or equal to (<=)
Gt greater than (>)
Ge greater than or equal to (> =)
Bw started on (LIKE val %)
Bn does not start at (not like val %)
In ())
Ni not included (not in ())
Ew ended at (LIKE % val)
En does not end
Cn inclusion (LIKE % val %)
Nc does not contain

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.