Jqgrid Edit Add function detailed parsing _jquery

Source: Internet
Author: User
Tags jqgrid

Colmodel is the most important attribute in Jqgrid, setting the properties of the table column.

Usage:

Java code:

Copy Code code as follows:

JQuery ("#gridid"). Jqgrid ({
...
Colmodel: [{name: ' name1 ', index: ' index1 ' ...}, {...}, ...],
..
});

attribute data type Memo default value
Align string defines cell alignment; optional value: Left, center, right. Left
Classes string to set the CSS for the column. Multiple classes are separated by spaces, such as: ' Class1 class2 '. The default CSS property for the table is ui-ellipsis empty string
DATEFMT string to format a date column. "/", "-", and "." are valid date separators.  Y,y,yyyy year yy, yy month m,mm for Monthsd,dd Day. ISO Date (y-m-d)
Defval string query field default value NULL
Editable whether a Boolean cell can be edited false
Editoptions array Some properties set when editing a column empty array
Editrules array set empty array for some additional properties of editable cells
EditType string The type that can be edited.  Optional values: text, textarea, select, checkbox, Password, button, image and file. Text
Whether the fixed boolean column width is to be fixed without variable false
Formoptions Array property settings when editing a form empty
Formatoptions array formatting for some columns none
Formatter mixed the function name or type that is set when the column is formatted none
Hidedlg Boolean whether to show or hide this column false
Hidden Boolean to hide this column when initializing a table false
Index string when sorting defines the indexes for the name of the sorted field, with the parameter named Sidx empty string
Jsonmap string defines the returned JSON data map None
Key Boolean when there is no ID in the data returned from the server side, use this as a unique rowid, with only one ID property false by default
Label string Use this value as the display name for the column if Colnames is empty, or use the name value None if none is set
The name string must be lost, the names of the table columns, all keywords, and reserved words cannot be used as names including Subgrid, CB and RN. Required
Whether the resizable Boolean can be resizable true
Search Boolean defines whether this column can be used as the search column true in searching mode
SearchOptions array Set search parameters empty
Whether sortable Boolean can be sorted true
SortType string is used when datatype is local to define the type of search column, Optional: Int/integer-sort integer float/number/currency-sort number Date-sort date text-sort Textual text
Stype string defines the type text of the search element
sURL string when searching for data empty string
Width number default column widths, only pixel values, cannot be percent 150
XmlMap string defines the mapping relationship between the current column and the returned XML data none
Unformat function ' Unformat ' cell value NULL

Add in Source code

Copy Code code as follows:

Editurl: ' Index.php?do=do_edit ',
Addurl: ' Index.php?do=do_add ',
DataType: ' xml ',
Mtype: ' Get ',
colnames:[' ID ', ' Task Name ', ' owning class '
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 editable is equally effective;

search
eq equals (=)
ne not equal to (<>)
Lt less Than (<)
Le less than equal (<=)
GT greater Than (>)
GE is larger than to (>=)
BW begins with (like val%)
Bn does not start (not like val%)
in (in)
NI is not inside (not in ())
EW ends (like%va L)
En does not end with
CN contains (like%val%)
NC does not contain

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.