Jqgrid the option settings for Chinese documents _jquery

Source: Internet
Author: User
Tags data structures mixed jqgrid

Jqgrid provides a number of option settings, and developers can control jqgrid by setting option values, such as the width, height, data type, and column name of the table, which are all done through option settings. Jqgrid options are typically in the form of names: Values (Name:value), or as objects (object) and array (array) configurations.

Jqgrid option (option)

Calling Jqgrid only needs to execute the following code:

JQuery ("#grid_id"). Jqgrid (options);

Options that are Jqgrid option settings, please refer to the table below.

Property Type Describe Default value
Ajaxgridoptions Object This is used to set the global properties of Ajax when table settings get data, note that this may overwrite all current AJAX settings (including error, complete, and Beforesend events). Empty
Ajaxselectoptions Object This key is used to set the global properties of Ajax when selecting elements through Dataurl in Editoptions or SearchOptions objects. Empty
Altclass String The class for alternating rows. This entry is valid only if Altrows is set to true. Ui-priority-secondary
Altrows Boolean Set as alternating row table False
Autoencode Boolean When set to true, the data from the server and the submitted data are encodes encoded. such as < will be converted to < False
Autowidth Boolean When set to true, the table width is automatically matched to the width of the parent element. This match is only made when the table is established, so you can use the Setgridwidth method to make the table change as the width of the parent element changes. False
Caption String The title of the table. displayed on the header. If empty, it will not be displayed. Empty
Celllayout Integer This property determines the padding + border width of the cell. This property is not usually modified, but it needs to be modified if the TD element is changed in the CSS of the table. The default value of 5 indicates Paddinglef (2) + paddingright (2) + borderleft (1) =5 5
Celledit Boolean Whether to allow cell editing. False
Cellsubmit String Determine whether the cell content is saved by remote or Clientarray. ' Remote '
Cellurl String The URL that the cell saves. Null
Colmodel Array Describes an array of column parameters. This is the most important part of the table, as detailed in the Colmodel API. Null
Colnames Array[] An array of column names. The name will be displayed in the header. Names are separated by commas, and the quantity should be equal to the number of Colmodel arrays Empty
Data Array Saves the local data as an array. Empty
Datastr String The data string when the datatype is set to XMLString or jsonstring. Null
DataType String Define the type of data that the table would like to get, valid values are:
Xml-xml data
Xmlstring-xml string
Json-json data
Jsonstring-json string
local-client data (array)
Javascript-javascript data
function-function returns data
Xml
Deselectaftersort Boolean Applies only when datatype is local. Cancels the currently selected row when a sort is applied. True
Direction String The direction of writing in the table. "Ltr" From left to right (default), "RTL" from right to left Ltr
Editurl String To define the edit address URL in a row Null
Emptyrecords String Information displayed when the return (or current) quantity is zero this entry is only valid when Viewrecords is set to true.
Expandcolclick Boolean True, click the expand Line Text, Treegrid expand or fold True
Expandcolumn String Specifies the column (name from Colmodel) that is used to open the Treegrid, and the first column is not set. This entry is valid only if Treegrid is true. Null
Footerrow Boolean When set to true, a table-foot row is generated and the number of columns equals Colmodel False
Forcefit Boolean If set to true, the column widths are changed, and the adjacent columns are adjusted to fit the overall table, and the horizontal scroll bar will not appear. False
Gridstate String The current state of the table. There are visible or hidden Visible
Gridview Boolean Setting to True will increase the display speed of 5~10 times. But you can no longer use Treegrid, Subgrid, or Afterinsertrow events False
Grouping Boolean Whether to set up table groups False
Height Mixed Table height. Can be numeric, percent, or auto 150
Hiddengrid Boolean If set to true, the table begins to be hidden, the data is not loaded, and only the caption is displayed. When the first time you click the Show/Hide button to display the table, data is loaded from the server. False
Hidegrid Boolean Whether to allow the show/hide buttons to be available. Available only if the title is not empty. True
Hoverrows Boolean Does the table row have a mouse hover effect True
Jsonreader Array JSON data Structure array
LastPage Integer Total number of page requests returned 0
Lastsort Integer Sorted column number (starting with 0) 0
Loadonce Boolean When set to true, the table reads server data only once (using appropriate datatype), then datatype automatically becomes local, all further operations are done on the client, and the pager function (if present) expires. False
LoadText String Text to be displayed when data is requested and sorted Loading ...
Loadui String This controls the action of the AJAX process. disable-cancels Jqgrid process instructions, you can use custom instructions. Enable (default)-Displays loading in the middle of the table. block– displays "Loading" information, disabling all features on the page until the data is loaded. Enable
Mtype String Define a Submit type Post or get Get
Multikey String This property is valid only when MultiSelect is true and defines the key combinations for multiple selections, with the optional values: Shiftkey, Altkey,ctrlkey Empty
Multiboxonly Boolean This property is valid only if MultiSelect is true. When Multiboxonly is set to True, the row is selected only when the checkbox is clicked, and the selection of the current row is cleared when the other columns are clicked. False
MultiSelect Boolean When this property is set to True, multiple-line selection is enabled and a check box appears False
Multiselectwidth Integer If MultiSelect is true, define the width of the multiple-selection column. 20
Page Integer Sets the number of request initial pages, which accept data from the server through a URL 1
Pager Mixed Defines a paging navigation bar. Must be an HTML element, such as <div id= "page" ></div> Empty
Pagerpos String Define the location of the table navigation bar, by default create a 3-part navigation bar: page numbers, navigation buttons, and record information. Center
Pgbuttons Boolean Defines whether navigation buttons are displayed when navigation is activated. True
Pginput Boolean Defines whether the navigation bar has a page Number entry box. True
Pgtext String Current page information. The first quantity is the current page, and the second is the total number of pages.
Prmnames Array By default prmnames: {page: "page", Rows: "Rows", Sort: "Sidx", Order: "Sord", Search: "_search", Nd: "nd", npage:null} Post to the server, field: Page,rows,sidx,sord,search,nd For example, to change Sidx to Mysort, write: prmnames: {sort: "Mysort"}. So the string that is submitted to the server becomes: PAGE=1&ROWS=10&MYSORT=MYINDEX&SORD=ASC If you set some parameters to NULL, these parameters will no longer be sent to the server. For example prmnames: {nd:null} The ND parameter will not be sent. Npage parameter See scroll option. None
PostData Array This array can be passed directly to the URL. This array can be used in this form {name1:value1 ...}. Empty
RecCount Integer Read-only property. Defines the number of rows displayed by the table. Never confuse with records. 0
Recordpos String Defines the location of the record information in the page, which can be left,center,right. Right
Recordpos Object Alternating rows of classes True
Records Integer Read-only property. Define the number of records obtained from the request None
Recordtext String The message that can be displayed on the page, which is valid only if Viewrecords is true, and is displayed when the total number of records is greater than 0 o'clock.
The contents of {} In this text represent:
{0} record number of the first record displayed on this page
{1} The record number of the last record displayed on the page
Total records obtained by {2}
Resizeclass String Classes when columns are variable in size Empty
Rowlist Array[] An array of elements for the Drop-down list box that changes the number of rows displayed. Empty
Rownumbers Boolean If this property is true, a column is added to the left of the table to display the number of rows (starting from 1). At this point, the Colmodel automatically expands an element named RN. Therefore, do not define RN in Colmodel. False
RowNum Integer The number of records visible in the table. This parameter is passed to the server by URL for retrieving data. Note: If this parameter is set to 10 and the server returns 15 records, only 10 records will be loaded. If this parameter is set to-1, then this check fails 20
Rownumwidth Integer When Rownumbers is true, defines the width of the column that displays the number of rows. 25
Savedrow Array Read-only property. Before row editing and cell editing saves data Empty
Scroll Boolean or integer Create a dynamic scrolling table. When set to Enabled, pager is disabled, and the vertical scroll bar can be used to mount the data. False
Scrolloffset Integer Defines the width of a vertical scroll bar. 18
Scrollrows Boolean When this item is enabled, a row is selected with SetSelection, and the table scrolls to the selected row to be visible. False
Selarrrow Array-[] Read-only property. When MultiSelect is true, contains the currently selected row. This is a one-dimensional array with the value of the ID of the selected row in the table. Empty
Selrow String Read-only property. The content is the ID of the last selected row. If the fire has applied a sort or pagging, the value is null. Null
ShrinkToFit Boolean or integer This item describes the type that calculates the initial width of each column relative to the table width.
If True and the column width is set, the width of each column is scaled according to the defined width.
If False, and the column width is set, the table width is set, the column width is not recalculated, and the values defined in Colmodel are used
True
Sortable Object Enables this entry to allow the mouse to be used to rearrange the sequence. True
Sortname String The initial sort name when reading XML or JSON data from the server, and this name is added to the URL. Empty
SortOrder String The initial sort type when reading XML or JSON data from the server, and this type is added to the URL. The optional value is ASC or DESC. Asc
Subgrid Boolean Set to true to use a child table. Enabling the child table will add a column to the left of the base table and include a "+" image that the user can click to expand the row. False
Subgridmodel Array-[] This property is used to describe the pattern of the child table and is valid only if Subgrid is true. It is an array that describes the child table columns. Empty
Subgridtype Mixed The data type used to define the mount of the child table, and if not defined, uses the same data type as the parent table. Null
Subgridurl String This property is used to define the URL where the child table obtains the data. The ID of the row will type in this URL, to add additional parameters, you can use the options in Subgridmodel. Empty
Subgridwidth Integer Define column widths for a child table 20
Toolbar Array This parameter defines the toolbar for the table. A parameter is an array that contains two values, the first value makes the toolbar valid, and the second value is relative to the position (can be top, bottom, both). For example, setting toolbar to [True, both] will create two toolbars in the header and bottom of the table, two toolbar two div elements, the header div element id is "t_ form ID", and the bottom div element id is "tb_ form ID". If there is only one toolbar (top or bottom), the DIV's id is "t_ form ID". [False, ']
Toppager Boolean Whether to display the page bar in the upper part of the table. False
TotalTime Integer Read-only parameters. Used to record the time of loading XML and JSON data. 0
Treedatatype Mixed Defining the initial data type Null
Treegrid Boolean Enable (disable) Treegrid. False
Treegridmodel String Defines the Treegrid method. can be nested or adjacency. Nested
Treeicons Array This array sets the icon used in Treegrid. The icon should be a valid icon in the UI theme. The default is {plus: ' ui-icon-triangle-1-e ', minus: ' Ui-icon-triangle-1-s ', leaf: ' Ui-icon-radio-off '}
Treereader Array Expands the Colmodel of the table. The fields defined here are added to the tail of the Colmodel and are hidden. The server will return the values of these fields.
Tree_root_level Numeric Determines the level of the Treegrid relative to the root element. 0
Url String The URL address of the request data Null
UserData Array This array holds the custom information requested and can be used at any time Empty
Userdataonfooter Boolean When True, UserData is placed directly in the footer. False
Viewrecords Boolean Whether to display the total number of records in the Browse navigation bar False
Viewsortcols Array Defines the appearance and behavior of the sort icon in the header. The default is [False, ' vertical ', true].
The first parameter sets whether to display an icon next to all columns that have a sorted column defined. The default false indicates that only the icon next to the front row sequence appears. Set to True to display an icon for all the rows that can be ordered.
The second parameter sets how the sort icon is placed. Vertical for vertical placement, horizontal for horizontal placement.
The third parameter sets the Click function. True indicates that the table headers click Sort, and False to click Sort icons only. If you set this argument to False, make sure that the first argument is true, otherwise you will not be able to sort.
Width Number If set, the width of the table is the sum of all the column widths defined in Colmodel. If this item is set, the initial width of each column is based on the value set by ShrinkToFit None
XmlReader Array An array that describes the expected XML data structures.



Colmodel API

The Colmodel property defines each table column as an array. This is a very important part of the Jqgrid. The syntax is:

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

Here's a list of events provided by Jqgrid.

Event Parameters Describe
Afterinsertrow rowID
RowData
Rowelem
This event occurs after each row is inserted
rowID the row ID for the insert
RowData is an array of data that is inserted into the row. Format is name:value pair, name is defined in Colmodel
Rowelem is the answer element. XML is an XML row, and JSON is all row data.
Note: If the GridView is true, this event does not occur
Beforerequest None This event occurs before any data request, but does not occur when datatype is a function.
Beforeselectrow ROWID, E This event occurs before the user clicks on the row and selects the row.
rowID The id,e for the row is the event object
The event returns a Boolean value of True (the row is selected) or False (the row is not selected).
Gridcomplete None This event occurs after all of the table's data is loaded and the process completes. Independent of datatype parameters and sorting paging.
Loadbeforesend Xhr
Settings
This event occurs before the XMLHttpRequest is sent to modify the object properties (such as headers). XHR is the XMLHttpRequest object.
LoadComplete Data This event occurs after each server request. XHR is the XMLHttpRequest object.
Loaderror Xhr
Status
Error
This event occurs when a request fails. The event has 3 parameters:
XHR as XMLHttpRequest object;
Satus description for error type; error is wrong object.
Oncellselect rowID
Icol,
Cellcontent,
E
This event occurs when a table-specific cell is clicked.
rowID is the row ID;icol is the column index;
cellcontent is the contents of the cell;
e Click on the event object.
Ondblclickrow rowID
IRow,
Icol,
E
This event occurs after a row double click.
rowID is row ID;irow is row index (do not confuse with ROWID);
Icol is a column index;
e as the event object.
Onheaderclick Gridstate This event occurs after clicking on the display or hidden table (Hidegrid is True) gridstate is a table state with visible and hidden two values
Onpaging Pgbutton This event occurs when the page button is clicked, before the data is populated, and when the user enters a new page number that is different from the current page number and returns.
Onrightclickrow rowID
IRow,
Icol,
E
This event occurs after the right click Row. (This event is not valid in Opera browser)
rowID is row ID;irow is row index (do not confuse with ROWID)
Icol is a column index;
e is an event object
Onselectall Arowids,
Status
This event occurs when you click the checkbox for the caption (MultiSelect true)
Arowids An array of selected row IDs (which rows have the same check box as the header check box)
Status The selected Boolean value of the header check box, true to select, and False to
Onselectrow rowID
Status
This event occurs after a row click
rowID is the row ID;
status is the selected state. Used when MultiSelect is true, returns True when the row is selected, and returns False when selected.
Onsortcol Index
Icol,
SortOrder
This event occurs after the column sort is clicked, before the data is sorted
Index icol The index number of the column for the index name defined in Colmodel
SortOrder for a new sort of way, ASC or DESC
Resizestart Event, Index This event occurs when the column is redefined width. event is the object of events; index is the column index defined in Colmodel.
Resizestop Newwidth, Index This event occurs after the column has been redefined for width.
Newwidth is the new column width; Index is the column index defined in Colmodel.
Serializegriddata PostData This event enables serialization of the data passed to the AJAX request. This event returns a serialized data. Use this event when you have custom data, such as JSON strings, XML strings, to be sent to the server.

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.