/// export interface DataGridColumn { title?: string; field?: string; auto?: boolean; width?: number | string; rowspan?: number; colspan?: number; align?: string; halign?: string; sortable?: boolean; order?: string; resizable?: boolean; fixed?: boolean; hidden?: boolean; checkbox?: boolean; formatter?: (value, row, index) => string; celltipFormatter?: (value, row, index) => string; styler?: (value, row, index) => string; sorter?: (a, b) => number; editor?: string | Object; /** * support in treegrid only **/ headerCls?: string; headerHint?: string; } export interface DataGridCommonOptions { title?: string; iconCls?: string; emptyMsg?: string; width?: number | string; height?: number | string; columns?: DataGridColumn[][]; frozenColumns?: [DataGridColumn]; fitColumns?: boolean; resizeHandle?: string; autoRowHeight?: boolean; toolbar?: any[] | string; border?: boolean; striped?: boolean; method?: string; nowrap?: boolean; idField?: string; url?: string; data?: any[]; loadMsg?: string; pagination?: boolean; rownumbers?: boolean; singleSelect?: boolean; ctrlSelect?: boolean; checkOnSelect?: boolean; selectOnCheck?: boolean; pagePosition?: string; pageNumber?: number; pageSize?: number; pageList?: [number]; queryParams?: Object; sortName?: string; sortOrder?: string; multiSort?: boolean; remoteSort?: boolean; showHeader?: boolean; showFooter?: boolean; scrollbarSize?: number; rowStyler?: Function; loader?: Function; param?: any; loadFilter?: Function; editors?: any; view?: any; groupField?: string; groupFormatter?: (value, rows) => string; groupStyler?: (value, rows) => any; filterMenuIconCls?: string; filterBtnCls?: string; filterBtnPosition?: 'right' | 'left'; filterPosition?: 'top' | 'bottom'; showFilterBar?: boolean; remoteFilter?: boolean; filterDelay?: number; filterRules?: { field?: string; op?: string; value?: any; }[]; filterMatchingType?: 'all' | 'any'; defaultFilterType?: string; defaultFilterOperator?: string; defaultFilterOptions?: Object; filterStringify?: Function; onLoadError?: (args) => void; onDblClickRow?: (index, row) => void; onClickCell?: (index, field, value) => void; onDblClickCell?: (index, field, value) => void; onBeforeSortColumn?: (sort: string, order: string) => void; onSortColumn?: (sort: string, order: string) => void; onResizeColumn?: (field, width: number) => void; onBeforeSelect?: (index, row) => void; onSelect?: (index, row) => void; onBeforeUnselect?: (index, row) => void; onUnselect?: (index, row) => void; onSelectAll?: (rows) => void; onUnselectAll?: (rows) => void; onBeforeCheck?: (index, row) => void; onCheck?: (index, row) => void; onBeforeUncheck?: (index, row) => void; onUncheck?: (index, row) => void; onCheckAll?: (rows) => void; onUncheckAll?: (rows) => void; onBeforeEdit?: (index, row) => void; onBeginEdit?: (index, row) => void; onEndEdit?: (index, row) => void; onAfterEdit?: (index, row, changes) => void; onCancelEdit?: (index, row) => void; onHeaderContextMenu?: (e, field) => void; onRowContextMenu?: (e, index, row) => void; onClickMenu?: (item, button, field) => void; } export interface DataGridOptions extends DataGridCommonOptions { tools?: any[]; modAndShiftSelect?: boolean; onClickRow?: (index: number, row) => void; onLoadSuccess?: (data) => void; onBeforeLoad?: (param) => void; onDrop?: (targetRow, sourceRow, point) => void; } export interface IDataGrid { cancelCellTip: () => IDataGrid; doCellTip: (options: any) => IDataGrid; getPanel: () => JQuery; resize: (params: { width: number; height: number; }) => IDataGrid; /** * Create and enable filter functionality. The 'filters' parameter is an array of filter configuration. Each item contains following properties: * 1) field: the custom rule on. * 2) type: the filter type, possible values are: label,text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree. * 3) options: the options of the filter type. * 4) op: the filter operation, possible values are: contains,equal,notequal,beginwith,endwith,less,lessorequal,greater,greaterorequal. */ enableFilter(filters?: any): any; /** * Disable filter functionality. */ disableFilter(): any; /** * Destroy the filter bar. */ destroyFilter(): any; /** * Get the filter rule. */ getFilterRule(field: string): any; /** * Add a filter rule. */ addFilterRule(param: { field: string; op?: string; value?; }): any; /** * Remove a filter rule. If the 'field' parameter is not specified, remove all the filter rules. */ removeFilterRule(field?: string): any; /** * Do the filter based on some filter rules. */ doFilter(): any; /** * Get the filter component on a specified field. */ getFilterComponent(field: string): any; /** * Resize the filter component. */ resizeFilter(field: string): any; } export declare class DataGrid implements IDataGrid { selector: string | JQuery | HTMLElement; protected func: any; $grid: JQuery; private oldOnBeforeSelect; private oldBeforeOnUnselect; constructor(selector: string | JQuery | HTMLElement, options?: DataGridOptions); /** * Return the options of datagrid. **/ options(): DataGridOptions; isTreeGrid(): boolean; /** * Return the pager object. **/ getPager(): any; /** * Return the panel object. **/ getPanel(): JQuery; /** * Return the column fields. If frozen setted to true the frozen column fields is returned. Code example: var opts = $('#dg').datagrid('getColumnFields'); // get unfrozen columns var opts = $('#dg').datagrid('getColumnFields', true); // get frozen columns **/ getColumnFields(frozen?: boolean): any; /** * Return the specified column option. **/ getColumnOption(field: any): any; /** * Set grid size, the options contains two properties: width: the new width of grid. height: the new height of grid. **/ resize(param?: { width?: number | string; height?: number | string; }): this; /** Load and show the first page rows. If the 'param' is specified, it will replace with the queryParams property. Usually do a query by passing some parameters, this method can be called to load new data from server. $('#dg').datagrid('load',{ code: '01', name: 'name01' }); **/ load(param?: any): this; /** * Reload the rows. Same as the 'load' method but stay on current page. **/ reload(param?: any): this; /** * Reload the footer rows. Code examples: // update footer row values and then refresh var rows = $('#dg').datagrid('getFooterRows'); rows[0]['name'] = 'new name'; rows[0]['salary'] = 60000; $('#dg').datagrid('reloadFooter'); // update footer rows with new data $('#dg').datagrid('reloadFooter',[ {name: 'name1', salary: 60000}, {name: 'name2', salary: 65000} ]); **/ reloadFooter(footer: any): this; /** * Display loading status. **/ loading(): this; /** * Hide loading status. **/ loaded(): this; /** * Make columns auto expand/collapse to fit datagrid width. **/ fitColumns(): this; /** * Fix columns size. If 'field' parameter is not assigned, all columns size will be fixed. Code example: $('#dg').datagrid('fixColumnSize', 'name'); // fix the 'name' column size $('#dg').datagrid('fixColumnSize'); // fix all columns size **/ fixColumnSize(field?: string): this; /** * Fix the specified row height. If 'index' parameter is not assigned, all rows height will be fixed. **/ fixRowHeight(index?: number): this; /** * Freeze the specify row that will always be displayed at the top when the datagrid is scrolled down. Available since version 1.3.2. **/ freezeRow(index?: number): this; /** * adjusts the column width to fit the contents. Available since version 1.3. **/ autoSizeColumn(field?: string): this; /** *Load local data, the old rows will be removed. **/ loadData(data: any): this; /** * Return the loaded data. **/ getData(): { total: number; rows: any[]; }; /** * Return the current page rows. **/ getRows(): any[]; /** * Return the footer rows **/ getFooterRows(): any; /** * Return the specified row index, the row parameter can be a row record or an id field value. **/ getRowIndex(id: any): any; /** * Return all rows where the checkbox has been checked. Available since version 1.3. * this origin version is not return data according to the visible data **/ getChecked(): any[]; /** * Return the first selected row record or null. **/ getSelected(): any; /** * Return all selected rows, when no record selected, am empty array will return. **/ getSelections(): any[]; /** * Clear all selections. **/ clearSelections(): this; /** * Clear all checked rows. Available since version 1.3.2. **/ clearChecked(): this; /** * Scroll to the specified row. Available since version 1.3.3. **/ scrollTo(index: number): any; /** * Highlight a row. Available since version 1.3.3. **/ highlightRow(index: number): this; /** * Select all current page rows. **/ selectAll(): this; /** * Unselect all current page rows. **/ unselectAll(): this; /** * Select a row, the row index start with 0. **/ selectRow(index: number): this; /** * Select a row by passing id value parameter. **/ selectRecord(idValue: any): this; /** * Unselect a row. **/ unselectRow(index: number): this; /** * Check all current page rows. Available since version 1.3. **/ checkAll(): this; /** * Uncheck all current page rows. Available since version 1.3. **/ uncheckAll(): this; /** * Begin editing a row. **/ beginEdit(index: number): any; /** * End editing a row. **/ endEdit(index: number): this; /** * Cancel editing a row. **/ cancelEdit(index: number): this; /** * Get the specified row editors. Each editor has the following properties: actions: the actions that the editor can do, same as the editor definition. target: the target editor jQuery object. field: the field name. type: the editor type, such as 'text','combobox','datebox', etc. **/ getEditors(index: number): this; /** * Get the specified editor, the options contains two properties: index: the row index. field: the field name. Code example: // get the datebox editor and change its value var ed = $('#dg').datagrid('getEditor', {index:1,field:'birthday'}); $(ed.target).datebox('setValue', '5/4/2012'); **/ getEditor(params: { index: number; field: string; }): any; /** * Refresh a row. **/ refreshRow(index: number): this; /** * validate the specified row, return true when valid. **/ validateRow(index: number): this; /** * Update the specified row, the param contains following properties: index: the row index to be updated. row: the new row data. Code example: $('#dg').datagrid('updateRow',{ index: 2, row: { name: 'new name', note: 'new note message' } }); **/ updateRow(param: { index: number; row: any; }): this; /** * Append a new row. The new row will be added to the last position: $('#dg').datagrid('appendRow',{ name: 'new name', age: 30, note: 'some messages' }); * Warning: if datalist use this function will broke selected effect **/ appendRow(row: any): this; /** * Insert a new row, the param contains following properties: index: the row index to insert into, if not defined, append the new row. row: the row data. Code examples: // insert a new row at second row position $('#dg').datagrid('insertRow',{ index: 1, // index start with 0 row: { name: 'new name', age: 30, note: 'some messages' } }); **/ insertRow(param: { index: number; row: any; }): this; /** * Delete a row. **/ deleteRow(index: number): this; /** * Get changed rows since the last commit. The type parameter indicate which type changed rows, possible value is: inserted,deleted,updated,etc. When the type parameter is not assigned, return all changed rows. **/ getChanges(type?: string): any; /** * Commits all the changes data since it was loaded or since the last time acceptChanges was called. **/ acceptChanges(): this; /** * Rolls back all the changes data since it was created, or since the last time acceptChanges was called. **/ rejectChanges(): this; /** * Merge some cells to one cell, the options contains following properties: index: the row index. type: the row type, possible values are 'body','footer'. field: the field name. rowspan: the rowspan count to be merged. colspan: the colspan count to be merged. Code example: // merge the footer rows $('#dg').datagrid('mergeCells', { index: 1, field: 'name', colspan: 2, type: 'footer' }); **/ mergeCells(options: any): this; /** * Display the specified column. **/ showColumn(field: any): this; /** * Hide the specified column. **/ hideColumn(field: any): this; destroy(): void; /** * sort the datagrid. Available since version 1.3.6. Code example: // sort on a column $('#dg').datagrid('sort', 'itemid'); // sort on a column with specified order $('#dg').datagrid('sort', { sortName: 'productid', sortOrder: 'desc' }); // sort on multiple columns $('#dg').datagrid('sort', { sortName: 'productid,listprice', sortOrder: 'desc,asc' }); **/ sort(param: { sortName: string; sortOrder: string; }): this; checkRow(rowIndex: number): this; uncheckRow(rowIndex: number): this; doCellTip(options: any): this; cancelCellTip(): this; enableCellEditing(): this; enableDnd(): this; rawItem: any; readonly collectionName: any; expandGroup(groupIndex: number): any; collapseGroup(groupIndex: number): any; scrollToGroup(groupIndex: number): any; /** * Create and enable filter functionality. The 'filters' parameter is an array of filter configuration. Each item contains following properties: * 1) field: the custom rule on. * 2) type: the filter type, possible values are: label,text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree. * 3) options: the options of the filter type. * 4) op: the filter operation, possible values are: contains,equal,notequal,beginwith,endwith,less,lessorequal,greater,greaterorequal. */ enableFilter(filters?: any): any; /** * Disable filter functionality. */ disableFilter(): any; /** * Destroy the filter bar. */ destroyFilter(): any; /** * Get the filter rule. */ getFilterRule(field: string): any; /** * Add a filter rule. */ addFilterRule(param: { field: string; op?: string; value?; }): any; /** * Remove a filter rule. If the 'field' parameter is not specified, remove all the filter rules. */ removeFilterRule(field?: string): any; /** * Do the filter based on some filter rules. */ doFilter(): any; /** * Get the filter component on a specified field. */ getFilterComponent(field: string): any; /** * Resize the filter component. */ resizeFilter(field: string): any; /** * This method use idField to remove selected rows, * options.idField required * has issue to remove duplicate data */ removeSelectedRows(): this; disable(): void; enable(): void; isDisabled(): any; selectRowAndScrollTo(id: any): any; unselectRecord(id: any): this; }