📄 zpgrid-core.js
字号:
* false - Show the cells based on the field type conversion * object {bBoth, funcShow} * bBoth - Show both in cell, Ex: Orig = Zapatec Value * Ex: Showing both * BYTES- cell=|15 MB=15360000000|; where 15 MB is orig and 15360000000 bytes is converted value * HOURS- cell=|2 days 1 hour=49|; where 2 days 1 hour is orig and 49 hours is converted value * WEIGHT- cell=|1 lb 2 oz=18|; where 1 lb 2 oz is orig and 18 oz is converted value * funcShow - callback function to create presentable cell data * Function to visually present the data. Does NOT effect sorting, just visual * sShowData = this.config.show_asis.funcShow(oGrid, oCell); * param oCell - Zapatec.Grid object * param oCell - cell object * * <b>funcStyle</b> [function] Callback function to dynamically change the style * of a cell. * Dynamically change the style of a cell based on the contents. * param oGrid - Zapatec.Grid object * param oCell - cell object * param iRow - index of the row in the displayed rows array returned by * {@link Zapatec.Grid#applyPaging} method * return undefined if NO change to style * return string for the inline style that should be applied to this cell * * <b>convert</b> [function] Callback function to convert the cell value. * Receives Zapatec.Grid object and cell object. If returns a value, that value * will be assigned to the cell display and compare values. * * <b>container</b> [object or string] Element or id of element that will hold * the grid. If "callbackHeaderDisplay" and "callbackRowDisplay" or * "callbackDataDisplay" options are defined, grid will be drawn using those * functions and "container" option is ignored. Also can be used instead of * "source" option. If "source" option is not defined, first child table of * container element is used as source. * * Standard output requires zpgrid-output.js module that is included by default. * * <b>headerContainer</b> [object or string] Element or id of element that will * hold header of the grid. Used together with "container" option when header * should be separated from the grid. E.g. to have grid data scrollable * vertically and header always visible. See scroll.html demo for details. * * <b>totalsContainer</b> [object or string] Element or id of element that will * hold totals. Used together with "container" option when totals should be * separated from the grid. E.g. to have grid data scrollable vertically and * totals always visible. See scroll.html demo for details. * * <b>visibleRows</b> [number] Used for displaying custom vertical scrollbar. * If > 0, limits number of rows displayed starting from current vertical offset. * See {@link Zapatec.Grid#gotoVerticalOffset} method for details about current * vertical offset. Default: 0. * * <b>visibleColumns</b> [number] Used for displaying custom horizontal * scrollbar. If > 0, limits number of columns displayed starting from current * horizontal offset. See {@link Zapatec.Grid#gotoHorizontalOffset} method for * details about current horizontal offset. Default: 0. * * <b>rowsPerPage</b> [number] If > 0, paging is used. Default: 0. * * <b>paginationContainer</b> [object or string] Element or id of element that * will hold pagination of the grid. Used together with "container" and * "rowsPerPage" options when pagination should be separated from the grid. See * scroll.html demo for example. You can pass several containers in an array to * this option if you need to display pagination in two or more places. See * compare.html demo for example. * * <b>border</b> [object or string] Element or id of element that is parent for * all grid containers. Used to determine dimensions of the grid when it has * several containers. Need only for <b>fitIntoParent</b> feature below when * grid has several containers. Default is parent element of the * <b>container</b>. * * <b>fitIntoParent</b> [boolean, object or string] When true, grid will be * adjusted dynamically to fit into parent element of the <b>border</b>. * When element or id of element, grid will be adjusted dynamically to fit into * that element. * * <b>horizontal</b> [boolean] If true, horizontal layout is used in standard * output. Default: false. * * <b>selectRows</b> [boolean] If true, selected rows will be marked by * different color depending from theme. Default: true. Ignored when callback * functions are used to display grid. * * <b>selectCells</b> [boolean] If true, selected cells will be marked by * different color depending from theme. Default: true. Ignored when callback * functions are used to display grid. * * <b>activeRows</b> [boolean] If true, active rows will be marked by * different color depending from theme. Default: true. Ignored when callback * functions are used to display grid. * * <b>activeCells</b> [boolean] If true, active cells will be marked by * different color depending from theme. Default: true. Ignored when callback * functions are used to display grid. * * <b>multipleSelect</b> [boolean] If true, "Shift" and "Ctrl" click will select * multiple rows and cells. If false, only one row and cell can be selected at * a time. Default: true. * * <b>callbackHeaderDisplay</b> [function] Callback function to display grid * header. Used togeter with callbackRowDisplay or callbackDataDisplay option as * alternetive way to display the grid. Otherwise ignored. Receives Zapatec.Grid * object. No return value is needed. * * <b>callbackDataDisplay</b> [function] Callback function to display grid rows. * Used togeter with callbackHeaderDisplay option as alternetive way to display * the grid. Otherwise ignored. Receives Zapatec.Grid object and array of row * objects. No return value is needed. * * <b>callbackRowDisplay</b> [function] Callback function to display grid row. * Called for each row. Used togeter with callbackHeaderDisplay option as * alternetive way to display the grid. Otherwise ignored. Ignored when * callbackDataDisplay is set. Receives Zapatec.Grid object and row object. * No return value is needed. * * <b>callbackTotalsDisplay</b> [function] Callback function to display totals. * Used togeter with callbackHeaderDisplay, callbackRowDisplay and * callbackDataDisplay options as alternetive way to display the grid, but also * can be used separately as a replacement for standard totals. Receives * Zapatec.Grid object and array of row objects for totals. If totals option is * not set this option still can be used, but it receives undefined instead of * array of rows. No return value is needed. * * <b>callbackTotalDisplay</b> [function] Callback function to display totals * row. Called for each totals row. Used togeter with callbackHeaderDisplay, * callbackRowDisplay and callbackDataDisplay options as alternetive way to * display the grid, but also can be used separately as a replacement for * standard totals. Ignored when callbackTotalsDisplay is set. Receives * Zapatec.Grid object and totals row object. No return value is needed. * * <b>callbackPaginationDisplay</b> [function] Callback function to display grid * pagination. Used togeter with callbackHeaderDisplay, callbackRowDisplay and * callbackDataDisplay options as alternetive way to display the grid, but also * can be used separately as a replacement for standard pagination. * Receives Zapatec.Grid object. No return value is needed. See also * {@link Zapatec.Grid#gotoPage}, {@link Zapatec.Grid#previousPage}, * {@link Zapatec.Grid#firstPage}, {@link Zapatec.Grid#nextPage}, * {@link Zapatec.Grid#lastPage}. * * <b>callbackRowOnClick</b> [function] Callback function to call when grid row * is clicked with left mouse button. Receives Zapatec.Grid object and row * object. No return value is needed. * * <b>callbackRowOnRightClick</b> [function] Callback function to call when grid * row is clicked with right mouse button. Receives Zapatec.Grid object and row * object. No return value is needed. * * <b>callbackCellOnClick</b> [function] Callback function to call when grid * cell is clicked with left mouse button. Receives Zapatec.Grid object and cell * object. No return value is needed. If this option is defined, above * "callbackRowOnClick" option is ignored. * * <b>callbackCellOnRightClick</b> [function] Callback function to call when * grid cell is clicked with right mouse button. Receives Zapatec.Grid object * and cell object. No return value is needed. If this option is defined, above * "callbackRowOnRightClick" option is ignored. * * <b>callbackRowOnDblClick</b> [function] Callback function to call when grid * row is double clicked. Receives Zapatec.Grid object and row object. No return * value is needed. * * <b>callbackCellOnDblClick</b> [function] Callback function to call when grid * cell is double clicked. Receives Zapatec.Grid object and cell object. No * return value is needed. If this option is defined, above * "callbackRowOnDblClick" option is ignored. * * <b>callbackRowSelect</b> [function] Callback function to call when grid row * is selected. Receives Zapatec.Grid object and row object. No return value is * needed. * * <b>callbackCellSelect</b> [function] Callback function to call when grid cell * is selected. Receives Zapatec.Grid object and cell object. No return value is * needed. If this option is defined, above "callbackRowSelect" option is * ignored. * * <b>callbackRowUnselect</b> [function] Callback function to call when grid row * is unselected. Receives Zapatec.Grid object and row object. No return value * is needed. * * <b>callbackCellUnselect</b> [function] Callback function to call when grid * cell is unselected. Receives Zapatec.Grid object and cell object. No return * value is needed. If this option is defined, above "callbackRowUnselect" * option is ignored. * * <b>callbackOnRefresh</b> [function] Callback function to call when grid is * refreshed. Receives Zapatec.Grid object. No return value is needed. * Deprecated. Use <b>gridRefreshed</b> event described below instead. * * <b>sortColumn</b> [number] Number of column to sort initially. First column * number is 0. If not set, initially grid will not be sorted. * * <b>sortDesc</b> [boolean] Used together with sortColumn option. Otherwise * ignored. If true, initially grid will be sorted in descending order. * * <b>filterOut</b> [object] Array of associative arrays: * [ * { * column: [object or number] array of zero-based column numbers or single * zero-based column number to use as source of values to filter out, * sortDesc: [boolean, optional] if true, list of values will be sorted * descending, otherwise ascending (default is false), * container: [object or string, optional] element or id of element that * will hold the list of values to filter out , * onclick: [string, optional] string with javascript code that will be * evaluated when checkbox is clicked before filtering out the grid * (should not contain " (double quote) symbol), * callback: [function, optional] callback function reference used as * alternative way to display filter out list * }, * ... * ] * If "callback" property is defined, "container" and "onclick" properties * are ingnored. "onclick" is useful when some simple actions like function call * or alert should be done before filtering out the grid. If you need to do more * complex actions than the code that can be passed in the string, use * alternative way to display filter out list with callback function. * callback function receives following array of associative arrays: * [ * { * value: [string] the unique value from grid column, * onclick: [string] onclick attribute value of the corresponding checkbox, * checked: [boolean] true if this checkbox is checked, * link: [string] onclick attribute for the link to filter out all values * except this, * selectall: [string] onclick attribute for the link to unfilter out all * values (this property is defined only for the first value), * clearall: [string] onclick attribute for the link to filter out all * values (this property is defined only for the first value) * }, * ... * ] * No return value is needed. * * <b>totals</b> (requires zpgrid-aggregate.js module that is included by * default) [object] Array of associative arrays: * [ * { * column: [object or number, optional] array of zero-based column numbers * or single zero-based column number to calculate (passed to the function; * required for standard aggregate functions, optional for custom callback * function), * callback: [function, optional] callback function to calculate value * (see below) or one of standard static aggregate functions: * Zapatec.Grid.sum, Zapatec.Grid.avg, Zapatec.Grid.max, Zapatec.Grid.min, * Zapatec.Grid.count, Zapatec.Grid.countDistinct (default is * Zapatec.Grid.sum), * label: [string, optional] label for the value (passed to the function; * overrides standard label), * labelColumn: [number, optional] zero-based column number where to put * label (passed to the function; by default label is placed before the * value in the same cell) * }, * ... * ] * "callback" property is a callback function that calculates totals * using desired algorithm. It receives following object containing grid rows: * { * grid: [object] grid object, * rows: [object] array of row objects, * column: [object or number, optional] "column" property of "totals", * label: [string, optional] "label" property of "totals", * labelColumn: [string, optional] "labelColumn" property of "totals" * } * and should return following object containing one or several rows with * totals (number of cells should correspond to the number of grid fields): * { * rows: * [ * { * cells: * [ * { * v: [string] value to display, * style: [string, optional] table cell style attribute * }, * ... * ], * style: [string, optional] table row style attribute * }, * ... * ] * } * See {@link Zapatec.Grid#sum} for example. * * <b>dataPrepared</b> [boolean] If true, grid will not attempt to check and * correct input data. External application is responsible for data preparation. * May be used with json source type to speed up large grid initialization. Data * must be prepared strictly according to grid internal format. * * <b>dataOnDemand</b> [boolean] If true, on every paging, sorting, filtering, * ranging, and search action grid instead of doing actual operation reloads * its data. It makes sence to use this option together with "callbackSource" * config option defined in Zapatec.Widget class. In this case grid passes to * callbackSource function following object: * { * currentPage: [number] zero-based current page number, * sortColumn: [number] zero-based column number on which grid is currently * sorted (deprecated, use order instead), * sortDesc: [boolean] true if grid is currently sorted in descending order * (deprecated, use order instead), * order: [object] array showing how the grid is currently sorted with * sorting priority from first to last element of the array, see * {@link Zapatec.Grid#sort} method for more details about sorting: * [ * { * col: [number] zero-based column number, * desc: [boolean, optional] indicates descending order for this column, * lt: [number] 1 if desc, -1 otherwise, * gt: [number] -1 if desc, 1 otherwise * }, * ... * ] * filters: [object] array containing an object for each grid column: * [ * { * hiddenValues: [object] array of hidden values - rows conaining these * values in the column should not be displayed, * minValue: [any] rows containing values in the column lesser than this * value should not be displayed, * maxValue: [any] rows containing values in the column greater than this * value should not be displayed, * regexpFilter: [string, optional] rows where column value don't match * this regular expression should not be displayed, * textFilter: [string] rows which don't contain this pattern in the * column value should not be displayed * }, * ... * ] * } * and lets it to form the source, e.g. server URL, from which grid is reloaded * then. See {@link Zapatec.Widget} for details. * * <b>fixedLeft</b> [number] Number of columns starting from the left that are * not moved during horizontal scrolling. * * <b>columnWidth</b> [string] Default column width. Should contain correct CSS * value, e.g. 'auto', '200px', etc. 'auto' must not be used with grids having * separate container for header. Default: 'auto' if headerContainer and * totalsContainer are not set, '100px' if headerContainer or totalsContainer is * set. * * <b>rowHeight</b> [string] Default row height. Should contain correct CSS * value, e.g. 'auto', '1.2em', etc. 'auto' must not be used with grids having * fixed columns. Default: 'auto'. * * <b>mouseSelect</b> [boolean or string] Allow selection of cells and rows * using left mouse button. Default: true. * * <b>dragAndDropCells</b> [boolean or string] Allow drag and drop cells using * left mouse button. Default: false. * Note: if this option is true, <b>mouseSelect</b> must be false. * * <b>dragAndDropColumns</b> [boolean or string] Allow drag and drop columns * using left mouse button. Default: false. * * <strong>In addition to events fired from base Zapatec.Widget class fires * following events:</strong> * * <b>gridInitialized</b> when grid initialization process is completed. * * <b>gridPrepareRefresh</b> before grid refresh is started. * * <b>gridRefreshed</b> when grid refresh is completed. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -