Jqgrid edit add function detailed analysis

  • 2020-03-26 23:47:57
  • OfStack

ColModel is one of the most important properties in jqGrid.

Usage:

Java code:


jQuery("#gridid").jqGrid({   
...   
   colModel: [ {name:'name1', index:'index1'...}, {...}, ... ],   
..   
});  

Property   Data type   Note   The default value  
Align  String  Defines cell alignment; Optional values: left, center, right.  Left 
Classes  String  Sets the CSS for the column. Multiple classes are separated by Spaces such as 'class1 class2'. The default CSS property of the table is ui-ellipsis&sponge; The empty string 
Datefmt  String  Format the date column." / ", "-", and ". "are valid date delimiters. Y,y,yyyy year YY, YY month m,mm for monthsd,dd day. ISO Date (Y -m - d)  
Defval  String  The default value of the query field & PI; Empty  
Editable  Boolean  Whether the cell is editable   False 
Editoptions  Array  Some properties & NBSP that are set when editing a column; The empty array 
Editrules  Array  Some additional property Settings & NBSP for editable cells; The empty array 
Edittype  String  Types that can be edited. Optional values: text, textarea, select, checkbox, password, button, image and file.  Text 
Fixed  Boolean  Whether the column width should be fixed immutable & cake; False 
Formoptions  Array  Property Settings & NBSP when editing the form; Empty 
Formatoptions  Array  Settings for formatting certain columns   None 
Formatter  Mixed  Function name or type & PI set when formatting a column None 
Hidedlg  Boolean  Whether to show or hide this column & cake; False 
Hidden  Boolean  Whether to hide this column & NBSP when initializing the table; False 
Index  String  Define the index of the sort field name when sorting, with the parameter sidx ; The 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 the only rowid, with only one id attribute by default   False 
Label  String  This value is used as the display name for the column if colNames are empty, and the name value & NBSP if none is set; None 
Name  String  Required entries, names of table columns, all keywords, reserved words cannot be used as names including subgrid, cb and rn.  Required 
Resizable  Boolean  Whether it can be resizable& compensated; True 
Search  Boolean  In search mode, define whether this column can be used as a search column & PI; True 
Searchoptions  Array  Set the search parameter   Empty 
Sortable  Boolean  Is it sortable   True 
Sorttype  String  Used when datatype is local to define the type of the search column, optional value: int/integer - sort to integer float/number/ currency-sort number date - sort date text - sort text & PI; Text 
Stype  String  Defines the type of the search element   Text 
Surl  String  Url  when searching for data; The empty string 
Width  Number  The default column width can only be a pixel value, not a percentage. 150  
Xmlmap  String  Defines the mapping between the current column and the returned XML data   None 
Unformat  Function  'unformat' cell value   Null 

Add in source


editurl:'index.php?do=do_edit',
     addurl:'index.php?do=do_add',
                    datatype: 'xml',
                    mtype: 'GET',
                    colNames:['ID', ' The name of the task ', ' Belongs to the 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: The transaction ;2: The transaction '},editselected:'classid' },
                    ],

The addition after adding editable is also effective;

search
Eq is equal to (=).
Ne is not equal to (< > )
Lt is less than (< )
Le is less than or equal to (< =)
Gt is greater than (> )
Ge is greater than or equal to (> =)
Bw starts with (LIKE val%)
Bn does not start at (not like val%)
In (in ())
(not in ())
Ew ends with (LIKE %val)
En does not end with
Cn contains (LIKE %val%)
Do not include the nc


Related articles: