diff options
author | Halil İbrahim Kalkan <hikalkan@gmail.com> | 2013-02-13 16:04:34 +0200 |
---|---|---|
committer | Halil İbrahim Kalkan <hikalkan@gmail.com> | 2013-02-13 16:04:34 +0200 |
commit | 6a7148fa53b0fb428c853d01150f2843122fa6d0 (patch) | |
tree | d6e813a899343cf165c3a1da565930890d6b5fd2 | |
parent | 277c6e18d910accfe145f0b3cacb27aef437d1ac (diff) | |
download | jtable-2.2.1.zip jtable-2.2.1.tar.gz jtable-2.2.1.tar.bz2 |
jTable v2.2.1v2.2.1
Support for saving page size preference of user. [#219]
Fixed some issues. [#167, #214, #215, #216, #219, #231]
Added 'Dutch - The Netherlands' localization.
Updated some localization files.
-rw-r--r-- | dev/jquery.jtable.core.js | 89 | ||||
-rw-r--r-- | dev/jquery.jtable.dynamiccolumns.js | 990 | ||||
-rw-r--r-- | dev/jquery.jtable.header.txt | 2 | ||||
-rw-r--r-- | dev/jquery.jtable.paging.js | 66 | ||||
-rw-r--r-- | dev/jquery.jtable.selecting.js | 756 | ||||
-rw-r--r-- | jTable.jquery.json | 2 | ||||
-rw-r--r-- | lib/jquery.jtable.js | 281 | ||||
-rw-r--r-- | lib/jquery.jtable.min.js | 237 | ||||
-rw-r--r-- | lib/localization/jquery.jtable.it.js | 4 | ||||
-rw-r--r-- | lib/localization/jquery.jtable.nl-NL.js | 30 |
10 files changed, 1291 insertions, 1166 deletions
diff --git a/dev/jquery.jtable.core.js b/dev/jquery.jtable.core.js index 3e26eee..5a94b6b 100644 --- a/dev/jquery.jtable.core.js +++ b/dev/jquery.jtable.core.js @@ -19,6 +19,7 @@ dialogHideEffect: 'fade', showCloseButton: false, loadingAnimationDelay: 500, + saveUserPreferences: true, ajaxSettings: { type: 'POST', @@ -104,6 +105,8 @@ this._createBusyPanel(); this._createErrorDialogDiv(); this._addNoDataRow(); + + this._cookieKeyPrefix = this._generateCookieKeyPrefix(); }, /* Normalizes some options for all fields (sets default values). @@ -861,22 +864,22 @@ _parseDate: function (dateString) { if (dateString.indexOf('Date') >= 0) { //Format: /Date(1320259705710)/ return new Date( - parseInt(dateString.substr(6)) + parseInt(dateString.substr(6), 10) ); } else if (dateString.length == 10) { //Format: 2011-01-01 return new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)) + parseInt(dateString.substr(0, 4), 10), + parseInt(dateString.substr(5, 2), 10) - 1, + parseInt(dateString.substr(8, 2), 10) ); } else if (dateString.length == 19) { //Format: 2011-01-01 20:32:42 return new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)), - parseInt(dateString.substr(11, 2)), - parseInt(dateString.substr(14, 2)), - parseInt(dateString.substr(17, 2)) + parseInt(dateString.substr(0, 4), 10), + parseInt(dateString.substr(5, 2), 10) - 1, + parseInt(dateString.substr(8, 2, 10)), + parseInt(dateString.substr(11, 2), 10), + parseInt(dateString.substr(14, 2), 10), + parseInt(dateString.substr(17, 2), 10) ); } else { this._logWarn('Given date is not properly formatted: ' + dateString); @@ -1069,6 +1072,72 @@ _getKeyValueOfRecord: function (record) { return record[this._keyField]; }, + + /************************************************************************ + * COOKIE * + *************************************************************************/ + + /* Sets a cookie with given key. + *************************************************************************/ + _setCookie: function (key, value) { + key = this._cookieKeyPrefix + key; + + var expireDate = new Date(); + expireDate.setDate(expireDate.getDate() + 30); + document.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(value) + "; expires=" + expireDate.toUTCString(); + }, + + /* Gets a cookie with given key. + *************************************************************************/ + _getCookie: function (key) { + key = this._cookieKeyPrefix + key; + + var equalities = document.cookie.split('; '); + for (var i = 0; i < equalities.length; i++) { + if (!equalities[i]) { + continue; + } + + var splitted = equalities[i].split('='); + if (splitted.length != 2) { + continue; + } + + if (decodeURIComponent(splitted[0]) === key) { + return decodeURIComponent(splitted[1] || ''); + } + } + + return null; + }, + + /* Generates a hash key to be prefix for all cookies for this jtable instance. + *************************************************************************/ + _generateCookieKeyPrefix: function () { + + var simpleHash = function (value) { + var hash = 0; + if (value.length == 0) { + return hash; + } + + for (var i = 0; i < value.length; i++) { + var ch = value.charCodeAt(i); + hash = ((hash << 5) - hash) + ch; + hash = hash & hash; + } + + return hash; + }; + + var strToHash = ''; + if (this.options.tableId) { + strToHash = strToHash + this.options.tableId + '#'; + } + + strToHash = strToHash + this._columnList.join('$') + '#c' + this._$table.find('thead th').length; + return 'jtable#' + simpleHash(strToHash); + }, /************************************************************************ * EVENT RAISING METHODS * diff --git a/dev/jquery.jtable.dynamiccolumns.js b/dev/jquery.jtable.dynamiccolumns.js index 88487fe..fefdb58 100644 --- a/dev/jquery.jtable.dynamiccolumns.js +++ b/dev/jquery.jtable.dynamiccolumns.js @@ -1,529 +1,461 @@ -/************************************************************************
-* DYNAMIC COLUMNS extension for jTable *
-* (Show/hide/resize columns) *
-*************************************************************************/
-(function ($) {
-
- //Reference to base object members
- var base = {
- _create: $.hik.jtable.prototype._create,
- _normalizeFieldOptions: $.hik.jtable.prototype._normalizeFieldOptions,
- _createHeaderCellForField: $.hik.jtable.prototype._createHeaderCellForField,
- _createCellForRecordField: $.hik.jtable.prototype._createCellForRecordField
- };
-
- //extension members
- $.extend(true, $.hik.jtable.prototype, {
-
- /************************************************************************
- * DEFAULT OPTIONS / EVENTS *
- *************************************************************************/
-
- options: {
- tableId: undefined,
- columnResizable: true,
- columnSelectable: true,
- saveUserPreferences: true
- },
-
- /************************************************************************
- * PRIVATE FIELDS *
- *************************************************************************/
-
- _$columnSelectionDiv: null,
- _$columnResizeBar: null,
- _cookieKeyPrefix: null,
- _currentResizeArgs: null,
-
- /************************************************************************
- * OVERRIDED METHODS *
- *************************************************************************/
-
- /* Overrides _addRowToTableHead method.
- *************************************************************************/
-
- _create: function () {
- base._create.apply(this, arguments);
-
- this._createColumnResizeBar();
- this._createColumnSelection();
-
- this._cookieKeyPrefix = this._generateCookieKeyPrefix();
- if (this.options.saveUserPreferences) {
- this._loadColumnSettings();
- }
-
- this._normalizeColumnWidths();
- },
-
- /* Normalizes some options for a field (sets default values).
- *************************************************************************/
- _normalizeFieldOptions: function (fieldName, props) {
- base._normalizeFieldOptions.apply(this, arguments);
-
- //columnResizable
- if (this.options.columnResizable) {
- props.columnResizable = (props.columnResizable != false);
- }
-
- //visibility
- if (!props.visibility) {
- props.visibility = 'visible';
- }
- },
-
- /* Overrides _createHeaderCellForField to make columns dynamic.
- *************************************************************************/
- _createHeaderCellForField: function (fieldName, field) {
- var $headerCell = base._createHeaderCellForField.apply(this, arguments);
-
- //Make data columns resizable except the last one
- if (this.options.columnResizable && field.columnResizable && (fieldName != this._columnList[this._columnList.length - 1])) {
- this._makeColumnResizable($headerCell);
- }
-
- //Hide column if needed
- if (field.visibility == 'hidden') {
- $headerCell.hide();
- }
-
- return $headerCell;
- },
-
- /* Overrides _createHeaderCellForField to decide show or hide a column.
- *************************************************************************/
- _createCellForRecordField: function (record, fieldName) {
- var $column = base._createCellForRecordField.apply(this, arguments);
-
- var field = this.options.fields[fieldName];
- if (field.visibility == 'hidden') {
- $column.hide();
- }
-
- return $column;
- },
-
- /************************************************************************
- * PUBLIC METHODS *
- *************************************************************************/
-
- /* Changes visibility of a column.
- *************************************************************************/
- changeColumnVisibility: function (columnName, visibility) {
- this._changeColumnVisibilityInternal(columnName, visibility);
- this._normalizeColumnWidths();
- if (this.options.saveUserPreferences) {
- this._saveColumnSettings();
- }
- },
-
- /************************************************************************
- * PRIVATE METHODS *
- *************************************************************************/
-
- /* Changes visibility of a column.
- *************************************************************************/
- _changeColumnVisibilityInternal: function (columnName, visibility) {
- //Check if there is a column with given name
- var columnIndex = this._columnList.indexOf(columnName);
- if (columnIndex < 0) {
- this._logWarn('Column "' + columnName + '" does not exist in fields!');
- return;
- }
-
- //Check if visibility value is valid
- if (['visible', 'hidden', 'fixed'].indexOf(visibility) < 0) {
- this._logWarn('Visibility value is not valid: "' + visibility + '"! Options are: visible, hidden, fixed.');
- return;
- }
-
- //Get the field
- var field = this.options.fields[columnName];
- if (field.visibility == visibility) {
- return; //No action if new value is same as old one.
- }
-
- //Hide or show the column if needed
- var columnIndexInTable = this._firstDataColumnOffset + columnIndex + 1;
- if (field.visibility != 'hidden' && visibility == 'hidden') {
- this._$table
- .find('>thead >tr >th:nth-child(' + columnIndexInTable + '),>tbody >tr >td:nth-child(' + columnIndexInTable + ')')
- .hide();
- } else if (field.visibility == 'hidden' && visibility != 'hidden') {
- this._$table
- .find('>thead >tr >th:nth-child(' + columnIndexInTable + '),>tbody >tr >td:nth-child(' + columnIndexInTable + ')')
- .show()
- .css('display', 'table-cell');
- }
-
- field.visibility = visibility;
- },
-
- /* Prepares dialog to change settings.
- *************************************************************************/
- _createColumnSelection: function () {
- var self = this;
-
- //Create a div for dialog and add to container element
- this._$columnSelectionDiv = $('<div />')
- .addClass('jtable-column-selection-container')
- .appendTo(self._$mainContainer);
-
- this._$table.children('thead').bind('contextmenu', function (e) {
- if (!self.options.columnSelectable) {
- return;
- }
-
- e.preventDefault();
-
- //Make an overlay div to disable page clicks
- $('<div />')
- .addClass('jtable-contextmenu-overlay')
- .click(function () {
- $(this).remove();
- self._$columnSelectionDiv.hide();
- })
- .bind('contextmenu', function () { return false; })
- .appendTo(document.body);
-
- self._fillColumnSelection();
-
- //Calculate position of column selection list and show it
-
- var containerOffset = self._$mainContainer.offset();
- var selectionDivTop = e.pageY - containerOffset.top;
- var selectionDivLeft = e.pageX - containerOffset.left;
-
- var selectionDivMinWidth = 100; //in pixels
- var containerWidth = self._$mainContainer.width();
-
- //If user clicks right area of header of the table, show list at a little left
- if ((containerWidth > selectionDivMinWidth) && (selectionDivLeft > (containerWidth - selectionDivMinWidth))) {
- selectionDivLeft = containerWidth - selectionDivMinWidth;
- }
-
- self._$columnSelectionDiv.css({
- left: selectionDivLeft,
- top: selectionDivTop,
- 'min-width': selectionDivMinWidth + 'px'
- }).show();
- });
- },
-
- /* Prepares content of settings dialog.
- *************************************************************************/
- _fillColumnSelection: function () {
- var self = this;
-
- var $columnsUl = $('<ul></ul>')
- .addClass('jtable-column-select-list');
- for (var i = 0; i < this._columnList.length; i++) {
- var columnName = this._columnList[i];
- var field = this.options.fields[columnName];
-
- //Crete li element
- var $columnLi = $('<li></li>').appendTo($columnsUl);
-
- //Create label for the checkbox
- var $label = $('<label for="' + columnName + '"></label>')
- .append($('<span>' + (field.title || columnName) + '</span>'))
- .appendTo($columnLi);
-
- //Create checkbox
- var $checkbox = $('<input type="checkbox" name="' + columnName + '">')
- .prependTo($label)
- .click(function () {
- var $clickedCheckbox = $(this);
- var clickedColumnName = $clickedCheckbox.attr('name');
- var clickedField = self.options.fields[clickedColumnName];
- if (clickedField.visibility == 'fixed') {
- return;
- }
-
- self.changeColumnVisibility(clickedColumnName, $clickedCheckbox.is(':checked') ? 'visible' : 'hidden');
- });
-
- //Check, if column if shown
- if (field.visibility != 'hidden') {
- $checkbox.attr('checked', 'checked');
- }
-
- //Disable, if column is fixed
- if (field.visibility == 'fixed') {
- $checkbox.attr('disabled', 'disabled');
- }
- }
-
- this._$columnSelectionDiv.html($columnsUl);
- },
-
- /* creates a vertical bar that is shown while resizing columns.
- *************************************************************************/
- _createColumnResizeBar: function () {
- this._$columnResizeBar = $('<div />')
- .addClass('jtable-column-resize-bar')
- .appendTo(this._$mainContainer)
- .hide();
- },
-
- /* Makes a column sortable.
- *************************************************************************/
- _makeColumnResizable: function ($columnHeader) {
- var self = this;
-
- //Create a handler to handle mouse click event
- $('<div />')
- .addClass('jtable-column-resize-handler')
- .appendTo($columnHeader.find('.jtable-column-header-container')) //Append the handler to the column
- .mousedown(function (downevent) { //handle mousedown event for the handler
- downevent.preventDefault();
- downevent.stopPropagation();
-
- var mainContainerOffset = self._$mainContainer.offset();
-
- //Get a reference to the next column
- var $nextColumnHeader = $columnHeader.nextAll('th.jtable-column-header:visible:first');
- if (!$nextColumnHeader.length) {
- return;
- }
-
- //Store some information to be used on resizing
- var minimumColumnWidth = 10; //A column's width can not be smaller than 10 pixel.
- self._currentResizeArgs = {
- currentColumnStartWidth: $columnHeader.outerWidth(),
- minWidth: minimumColumnWidth,
- maxWidth: $columnHeader.outerWidth() + $nextColumnHeader.outerWidth() - minimumColumnWidth,
- mouseStartX: downevent.pageX,
- minResizeX: function () { return this.mouseStartX - (this.currentColumnStartWidth - this.minWidth); },
- maxResizeX: function () { return this.mouseStartX + (this.maxWidth - this.currentColumnStartWidth); }
- };
-
- //Handle mouse move event to move resizing bar
- var resizeonmousemove = function (moveevent) {
- if (!self._currentResizeArgs) {
- return;
- }
-
- var resizeBarX = self._normalizeNumber(moveevent.pageX, self._currentResizeArgs.minResizeX(), self._currentResizeArgs.maxResizeX());
- self._$columnResizeBar.css('left', (resizeBarX - mainContainerOffset.left) + 'px');
- };
-
- //Handle mouse up event to finish resizing of the column
- var resizeonmouseup = function (upevent) {
- if (!self._currentResizeArgs) {
- return;
- }
-
- $(document).unbind('mousemove', resizeonmousemove);
- $(document).unbind('mouseup', resizeonmouseup);
-
- self._$columnResizeBar.hide();
-
- //Calculate new widths in pixels
- var mouseChangeX = upevent.pageX - self._currentResizeArgs.mouseStartX;
- var currentColumnFinalWidth = self._normalizeNumber(self._currentResizeArgs.currentColumnStartWidth + mouseChangeX, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth);
- var nextColumnFinalWidth = $nextColumnHeader.outerWidth() + (self._currentResizeArgs.currentColumnStartWidth - currentColumnFinalWidth);
-
- //Calculate widths as percent
- var pixelToPercentRatio = $columnHeader.data('width-in-percent') / self._currentResizeArgs.currentColumnStartWidth;
- $columnHeader.data('width-in-percent', currentColumnFinalWidth * pixelToPercentRatio);
- $nextColumnHeader.data('width-in-percent', nextColumnFinalWidth * pixelToPercentRatio);
-
- //Set new widths to columns (resize!)
- $columnHeader.css('width', $columnHeader.data('width-in-percent') + '%');
- $nextColumnHeader.css('width', $nextColumnHeader.data('width-in-percent') + '%');
-
- //Normalize all column widths
- self._normalizeColumnWidths();
-
- //Finish resizing
- self._currentResizeArgs = null;
-
- //Save current preferences
- if (self.options.saveUserPreferences) {
- self._saveColumnSettings();
- }
- };
-
- //Show vertical resize bar
- self._$columnResizeBar
- .show()
- .css({
- top: ($columnHeader.offset().top - mainContainerOffset.top) + 'px',
- left: (downevent.pageX - mainContainerOffset.left) + 'px',
- height: (self._$table.outerHeight()) + 'px'
- });
-
- //Bind events
- $(document).bind('mousemove', resizeonmousemove);
- $(document).bind('mouseup', resizeonmouseup);
- });
- },
-
- /* Normalizes column widths as percent for current view.
- *************************************************************************/
- _normalizeColumnWidths: function () {
-
- //Set command column width
- var commandColumnHeaders = this._$table
- .find('>thead th.jtable-command-column-header')
- .data('width-in-percent', 1)
- .css('width', '1%');
-
- //Find data columns
- var headerCells = this._$table.find('>thead th.jtable-column-header');
-
- //Calculate total width of data columns
- var totalWidthInPixel = 0;
- headerCells.each(function () {
- var $cell = $(this);
- if ($cell.is(':visible')) {
- totalWidthInPixel += $cell.outerWidth();
- }
- });
-
- //Calculate width of each column
- var columnWidhts = {};
- var availableWidthInPercent = 100.0 - commandColumnHeaders.length;
- headerCells.each(function () {
- var $cell = $(this);
- if ($cell.is(':visible')) {
- var fieldName = $cell.data('fieldName');
- var widthInPercent = $cell.outerWidth() * availableWidthInPercent / totalWidthInPixel;
- columnWidhts[fieldName] = widthInPercent;
- }
- });
-
- //Set width of each column
- headerCells.each(function () {
- var $cell = $(this);
- if ($cell.is(':visible')) {
- var fieldName = $cell.data('fieldName');
- $cell.data('width-in-percent', columnWidhts[fieldName]).css('width', columnWidhts[fieldName] + '%');
- }
- });
- },
-
- /* Saves field setting to cookie.
- * Saved setting will be a string like that:
- * fieldName1=visible;23|fieldName2=hidden;17|...
- *************************************************************************/
- _saveColumnSettings: function () {
- var self = this;
- var fieldSettings = '';
- this._$table.find('>thead >tr >th.jtable-column-header').each(function () {
- var $cell = $(this);
- var fieldName = $cell.data('fieldName');
- var columnWidth = $cell.data('width-in-percent');
- var fieldVisibility = self.options.fields[fieldName].visibility;
- var fieldSetting = fieldName + "=" + fieldVisibility + ';' + columnWidth;
- fieldSettings = fieldSettings + fieldSetting + '|';
- });
-
- this._setCookie('column-settings', fieldSettings.substr(0, fieldSettings.length - 1));
- },
-
- /* Loads field settings from cookie that is saved by _saveFieldSettings method.
- *************************************************************************/
- _loadColumnSettings: function () {
- var self = this;
- var columnSettingsCookie = this._getCookie('column-settings');
- if (!columnSettingsCookie) {
- return;
- }
-
- var columnSettings = {};
- $.each(columnSettingsCookie.split('|'), function (inx, fieldSetting) {
- var splitted = fieldSetting.split('=');
- var fieldName = splitted[0];
- var settings = splitted[1].split(';');
- columnSettings[fieldName] = {
- columnVisibility: settings[0],
- columnWidth: settings[1]
- }; ;
- });
-
- var headerCells = this._$table.find('>thead >tr >th.jtable-column-header');
- headerCells.each(function () {
- var $cell = $(this);
- var fieldName = $cell.data('fieldName');
- var field = self.options.fields[fieldName];
- if (columnSettings[fieldName]) {
- if (field.visibility != 'fixed') {
- self._changeColumnVisibilityInternal(fieldName, columnSettings[fieldName].columnVisibility);
- }
-
- $cell.data('width-in-percent', columnSettings[fieldName].columnWidth).css('width', columnSettings[fieldName].columnWidth + '%');
- }
- });
- },
-
- /************************************************************************
- * COOKIE *
- *************************************************************************/
-
- /* Sets a cookie with given key.
- *************************************************************************/
- _setCookie: function (key, value) {
- key = this._cookieKeyPrefix + key;
-
- var expireDate = new Date();
- expireDate.setDate(expireDate.getDate() + 30);
- document.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(value) + "; expires=" + expireDate.toUTCString();
- },
-
- /* Gets a cookie with given key.
- *************************************************************************/
- _getCookie: function (key) {
- key = this._cookieKeyPrefix + key;
-
- var equalities = document.cookie.split('; ');
- for (var i = 0; i < equalities.length; i++) {
- if (!equalities[i]) {
- continue;
- }
-
- var splitted = equalities[i].split('=');
- if (splitted.length != 2) {
- continue;
- }
-
- if (decodeURIComponent(splitted[0]) === key) {
- return decodeURIComponent(splitted[1] || '');
- }
- }
-
- return null;
- },
-
- /* Generates a hash key to be prefix for all cookies for this jtable instance.
- *************************************************************************/
- _generateCookieKeyPrefix: function () {
-
- var simpleHash = function (value) {
- var hash = 0;
- if (value.length == 0) {
- return hash;
- }
-
- for (var i = 0; i < value.length; i++) {
- var ch = value.charCodeAt(i);
- hash = ((hash << 5) - hash) + ch;
- hash = hash & hash;
- }
-
- return hash;
- };
-
- var strToHash = '';
- if (this.options.tableId) {
- strToHash = strToHash + this.options.tableId + '#';
- }
-
- strToHash = strToHash + this._columnList.join('$') + '#c' + this._$table.find('thead th').length;
- return 'jtable#' + simpleHash(strToHash);
- }
-
- });
-
-})(jQuery);
+/************************************************************************ +* DYNAMIC COLUMNS extension for jTable * +* (Show/hide/resize columns) * +*************************************************************************/ +(function ($) { + + //Reference to base object members + var base = { + _create: $.hik.jtable.prototype._create, + _normalizeFieldOptions: $.hik.jtable.prototype._normalizeFieldOptions, + _createHeaderCellForField: $.hik.jtable.prototype._createHeaderCellForField, + _createCellForRecordField: $.hik.jtable.prototype._createCellForRecordField + }; + + //extension members + $.extend(true, $.hik.jtable.prototype, { + + /************************************************************************ + * DEFAULT OPTIONS / EVENTS * + *************************************************************************/ + + options: { + tableId: undefined, + columnResizable: true, + columnSelectable: true + }, + + /************************************************************************ + * PRIVATE FIELDS * + *************************************************************************/ + + _$columnSelectionDiv: null, + _$columnResizeBar: null, + _cookieKeyPrefix: null, + _currentResizeArgs: null, + + /************************************************************************ + * OVERRIDED METHODS * + *************************************************************************/ + + /* Overrides _addRowToTableHead method. + *************************************************************************/ + + _create: function () { + base._create.apply(this, arguments); + + this._createColumnResizeBar(); + this._createColumnSelection(); + + if (this.options.saveUserPreferences) { + this._loadColumnSettings(); + } + + this._normalizeColumnWidths(); + }, + + /* Normalizes some options for a field (sets default values). + *************************************************************************/ + _normalizeFieldOptions: function (fieldName, props) { + base._normalizeFieldOptions.apply(this, arguments); + + //columnResizable + if (this.options.columnResizable) { + props.columnResizable = (props.columnResizable != false); + } + + //visibility + if (!props.visibility) { + props.visibility = 'visible'; + } + }, + + /* Overrides _createHeaderCellForField to make columns dynamic. + *************************************************************************/ + _createHeaderCellForField: function (fieldName, field) { + var $headerCell = base._createHeaderCellForField.apply(this, arguments); + + //Make data columns resizable except the last one + if (this.options.columnResizable && field.columnResizable && (fieldName != this._columnList[this._columnList.length - 1])) { + this._makeColumnResizable($headerCell); + } + + //Hide column if needed + if (field.visibility == 'hidden') { + $headerCell.hide(); + } + + return $headerCell; + }, + + /* Overrides _createHeaderCellForField to decide show or hide a column. + *************************************************************************/ + _createCellForRecordField: function (record, fieldName) { + var $column = base._createCellForRecordField.apply(this, arguments); + + var field = this.options.fields[fieldName]; + if (field.visibility == 'hidden') { + $column.hide(); + } + + return $column; + }, + + /************************************************************************ + * PUBLIC METHODS * + *************************************************************************/ + + /* Changes visibility of a column. + *************************************************************************/ + changeColumnVisibility: function (columnName, visibility) { + this._changeColumnVisibilityInternal(columnName, visibility); + this._normalizeColumnWidths(); + if (this.options.saveUserPreferences) { + this._saveColumnSettings(); + } + }, + + /************************************************************************ + * PRIVATE METHODS * + *************************************************************************/ + + /* Changes visibility of a column. + *************************************************************************/ + _changeColumnVisibilityInternal: function (columnName, visibility) { + //Check if there is a column with given name + var columnIndex = this._columnList.indexOf(columnName); + if (columnIndex < 0) { + this._logWarn('Column "' + columnName + '" does not exist in fields!'); + return; + } + + //Check if visibility value is valid + if (['visible', 'hidden', 'fixed'].indexOf(visibility) < 0) { + this._logWarn('Visibility value is not valid: "' + visibility + '"! Options are: visible, hidden, fixed.'); + return; + } + + //Get the field + var field = this.options.fields[columnName]; + if (field.visibility == visibility) { + return; //No action if new value is same as old one. + } + + //Hide or show the column if needed + var columnIndexInTable = this._firstDataColumnOffset + columnIndex + 1; + if (field.visibility != 'hidden' && visibility == 'hidden') { + this._$table + .find('>thead >tr >th:nth-child(' + columnIndexInTable + '),>tbody >tr >td:nth-child(' + columnIndexInTable + ')') + .hide(); + } else if (field.visibility == 'hidden' && visibility != 'hidden') { + this._$table + .find('>thead >tr >th:nth-child(' + columnIndexInTable + '),>tbody >tr >td:nth-child(' + columnIndexInTable + ')') + .show() + .css('display', 'table-cell'); + } + + field.visibility = visibility; + }, + + /* Prepares dialog to change settings. + *************************************************************************/ + _createColumnSelection: function () { + var self = this; + + //Create a div for dialog and add to container element + this._$columnSelectionDiv = $('<div />') + .addClass('jtable-column-selection-container') + .appendTo(self._$mainContainer); + + this._$table.children('thead').bind('contextmenu', function (e) { + if (!self.options.columnSelectable) { + return; + } + + e.preventDefault(); + + //Make an overlay div to disable page clicks + $('<div />') + .addClass('jtable-contextmenu-overlay') + .click(function () { + $(this).remove(); + self._$columnSelectionDiv.hide(); + }) + .bind('contextmenu', function () { return false; }) + .appendTo(document.body); + + self._fillColumnSelection(); + + //Calculate position of column selection list and show it + + var containerOffset = self._$mainContainer.offset(); + var selectionDivTop = e.pageY - containerOffset.top; + var selectionDivLeft = e.pageX - containerOffset.left; + + var selectionDivMinWidth = 100; //in pixels + var containerWidth = self._$mainContainer.width(); + + //If user clicks right area of header of the table, show list at a little left + if ((containerWidth > selectionDivMinWidth) && (selectionDivLeft > (containerWidth - selectionDivMinWidth))) { + selectionDivLeft = containerWidth - selectionDivMinWidth; + } + + self._$columnSelectionDiv.css({ + left: selectionDivLeft, + top: selectionDivTop, + 'min-width': selectionDivMinWidth + 'px' + }).show(); + }); + }, + + /* Prepares content of settings dialog. + *************************************************************************/ + _fillColumnSelection: function () { + var self = this; + + var $columnsUl = $('<ul></ul>') + .addClass('jtable-column-select-list'); + for (var i = 0; i < this._columnList.length; i++) { + var columnName = this._columnList[i]; + var field = this.options.fields[columnName]; + + //Crete li element + var $columnLi = $('<li></li>').appendTo($columnsUl); + + //Create label for the checkbox + var $label = $('<label for="' + columnName + '"></label>') + .append($('<span>' + (field.title || columnName) + '</span>')) + .appendTo($columnLi); + + //Create checkbox + var $checkbox = $('<input type="checkbox" name="' + columnName + '">') + .prependTo($label) + .click(function () { + var $clickedCheckbox = $(this); + var clickedColumnName = $clickedCheckbox.attr('name'); + var clickedField = self.options.fields[clickedColumnName]; + if (clickedField.visibility == 'fixed') { + return; + } + + self.changeColumnVisibility(clickedColumnName, $clickedCheckbox.is(':checked') ? 'visible' : 'hidden'); + }); + + //Check, if column if shown + if (field.visibility != 'hidden') { + $checkbox.attr('checked', 'checked'); + } + + //Disable, if column is fixed + if (field.visibility == 'fixed') { + $checkbox.attr('disabled', 'disabled'); + } + } + + this._$columnSelectionDiv.html($columnsUl); + }, + + /* creates a vertical bar that is shown while resizing columns. + *************************************************************************/ + _createColumnResizeBar: function () { + this._$columnResizeBar = $('<div />') + .addClass('jtable-column-resize-bar') + .appendTo(this._$mainContainer) + .hide(); + }, + + /* Makes a column sortable. + *************************************************************************/ + _makeColumnResizable: function ($columnHeader) { + var self = this; + + //Create a handler to handle mouse click event + $('<div />') + .addClass('jtable-column-resize-handler') + .appendTo($columnHeader.find('.jtable-column-header-container')) //Append the handler to the column + .mousedown(function (downevent) { //handle mousedown event for the handler + downevent.preventDefault(); + downevent.stopPropagation(); + + var mainContainerOffset = self._$mainContainer.offset(); + + //Get a reference to the next column + var $nextColumnHeader = $columnHeader.nextAll('th.jtable-column-header:visible:first'); + if (!$nextColumnHeader.length) { + return; + } + + //Store some information to be used on resizing + var minimumColumnWidth = 10; //A column's width can not be smaller than 10 pixel. + self._currentResizeArgs = { + currentColumnStartWidth: $columnHeader.outerWidth(), + minWidth: minimumColumnWidth, + maxWidth: $columnHeader.outerWidth() + $nextColumnHeader.outerWidth() - minimumColumnWidth, + mouseStartX: downevent.pageX, + minResizeX: function () { return this.mouseStartX - (this.currentColumnStartWidth - this.minWidth); }, + maxResizeX: function () { return this.mouseStartX + (this.maxWidth - this.currentColumnStartWidth); } + }; + + //Handle mouse move event to move resizing bar + var resizeonmousemove = function (moveevent) { + if (!self._currentResizeArgs) { + return; + } + + var resizeBarX = self._normalizeNumber(moveevent.pageX, self._currentResizeArgs.minResizeX(), self._currentResizeArgs.maxResizeX()); + self._$columnResizeBar.css('left', (resizeBarX - mainContainerOffset.left) + 'px'); + }; + + //Handle mouse up event to finish resizing of the column + var resizeonmouseup = function (upevent) { + if (!self._currentResizeArgs) { + return; + } + + $(document).unbind('mousemove', resizeonmousemove); + $(document).unbind('mouseup', resizeonmouseup); + + self._$columnResizeBar.hide(); + + //Calculate new widths in pixels + var mouseChangeX = upevent.pageX - self._currentResizeArgs.mouseStartX; + var currentColumnFinalWidth = self._normalizeNumber(self._currentResizeArgs.currentColumnStartWidth + mouseChangeX, self._currentResizeArgs.minWidth, self._currentResizeArgs.maxWidth); + var nextColumnFinalWidth = $nextColumnHeader.outerWidth() + (self._currentResizeArgs.currentColumnStartWidth - currentColumnFinalWidth); + + //Calculate widths as percent + var pixelToPercentRatio = $columnHeader.data('width-in-percent') / self._currentResizeArgs.currentColumnStartWidth; + $columnHeader.data('width-in-percent', currentColumnFinalWidth * pixelToPercentRatio); + $nextColumnHeader.data('width-in-percent', nextColumnFinalWidth * pixelToPercentRatio); + + //Set new widths to columns (resize!) + $columnHeader.css('width', $columnHeader.data('width-in-percent') + '%'); + $nextColumnHeader.css('width', $nextColumnHeader.data('width-in-percent') + '%'); + + //Normalize all column widths + self._normalizeColumnWidths(); + + //Finish resizing + self._currentResizeArgs = null; + + //Save current preferences + if (self.options.saveUserPreferences) { + self._saveColumnSettings(); + } + }; + + //Show vertical resize bar + self._$columnResizeBar + .show() + .css({ + top: ($columnHeader.offset().top - mainContainerOffset.top) + 'px', + left: (downevent.pageX - mainContainerOffset.left) + 'px', + height: (self._$table.outerHeight()) + 'px' + }); + + //Bind events + $(document).bind('mousemove', resizeonmousemove); + $(document).bind('mouseup', resizeonmouseup); + }); + }, + + /* Normalizes column widths as percent for current view. + *************************************************************************/ + _normalizeColumnWidths: function () { + + //Set command column width + var commandColumnHeaders = this._$table + .find('>thead th.jtable-command-column-header') + .data('width-in-percent', 1) + .css('width', '1%'); + + //Find data columns + var headerCells = this._$table.find('>thead th.jtable-column-header'); + + //Calculate total width of data columns + var totalWidthInPixel = 0; + headerCells.each(function () { + var $cell = $(this); + if ($cell.is(':visible')) { + totalWidthInPixel += $cell.outerWidth(); + } + }); + + //Calculate width of each column + var columnWidhts = {}; + var availableWidthInPercent = 100.0 - commandColumnHeaders.length; + headerCells.each(function () { + var $cell = $(this); + if ($cell.is(':visible')) { + var fieldName = $cell.data('fieldName'); + var widthInPercent = $cell.outerWidth() * availableWidthInPercent / totalWidthInPixel; + columnWidhts[fieldName] = widthInPercent; + } + }); + + //Set width of each column + headerCells.each(function () { + var $cell = $(this); + if ($cell.is(':visible')) { + var fieldName = $cell.data('fieldName'); + $cell.data('width-in-percent', columnWidhts[fieldName]).css('width', columnWidhts[fieldName] + '%'); + } + }); + }, + + /* Saves field setting to cookie. + * Saved setting will be a string like that: + * fieldName1=visible;23|fieldName2=hidden;17|... + *************************************************************************/ + _saveColumnSettings: function () { + var self = this; + var fieldSettings = ''; + this._$table.find('>thead >tr >th.jtable-column-header').each(function () { + var $cell = $(this); + var fieldName = $cell.data('fieldName'); + var columnWidth = $cell.data('width-in-percent'); + var fieldVisibility = self.options.fields[fieldName].visibility; + var fieldSetting = fieldName + "=" + fieldVisibility + ';' + columnWidth; + fieldSettings = fieldSettings + fieldSetting + '|'; + }); + + this._setCookie('column-settings', fieldSettings.substr(0, fieldSettings.length - 1)); + }, + + /* Loads field settings from cookie that is saved by _saveFieldSettings method. + *************************************************************************/ + _loadColumnSettings: function () { + var self = this; + var columnSettingsCookie = this._getCookie('column-settings'); + if (!columnSettingsCookie) { + return; + } + + var columnSettings = {}; + $.each(columnSettingsCookie.split('|'), function (inx, fieldSetting) { + var splitted = fieldSetting.split('='); + var fieldName = splitted[0]; + var settings = splitted[1].split(';'); + columnSettings[fieldName] = { + columnVisibility: settings[0], + columnWidth: settings[1] + }; + }); + + var headerCells = this._$table.find('>thead >tr >th.jtable-column-header'); + headerCells.each(function () { + var $cell = $(this); + var fieldName = $cell.data('fieldName'); + var field = self.options.fields[fieldName]; + if (columnSettings[fieldName]) { + if (field.visibility != 'fixed') { + self._changeColumnVisibilityInternal(fieldName, columnSettings[fieldName].columnVisibility); + } + + $cell.data('width-in-percent', columnSettings[fieldName].columnWidth).css('width', columnSettings[fieldName].columnWidth + '%'); + } + }); + } + + }); + +})(jQuery); diff --git a/dev/jquery.jtable.header.txt b/dev/jquery.jtable.header.txt index 68f61eb..48a6458 100644 --- a/dev/jquery.jtable.header.txt +++ b/dev/jquery.jtable.header.txt @@ -1,6 +1,6 @@ /* -jTable 2.2.0 +jTable 2.2.1 http://www.jtable.org --------------------------------------------------------------------------- diff --git a/dev/jquery.jtable.paging.js b/dev/jquery.jtable.paging.js index 23af6a8..c8cdada 100644 --- a/dev/jquery.jtable.paging.js +++ b/dev/jquery.jtable.paging.js @@ -58,6 +58,7 @@ _create: function () { base._create.apply(this, arguments); if (this.options.paging) { + this._loadPagingSettings(); this._createBottomPanel(); this._createPageListArea(); this._createGotoPageInput(); @@ -65,6 +66,19 @@ } }, + /* Loads user preferences for paging. + *************************************************************************/ + _loadPagingSettings: function () { + if (!this.options.saveUserPreferences) { + return; + } + + var pageSize = this._getCookie('page-size'); + if (pageSize) { + this.options.pageSize = this._normalizeNumber(pageSize, 1, 1000000, this.options.pageSize); + } + }, + /* Creates bottom panel and adds to the page. *************************************************************************/ _createBottomPanel: function () { @@ -205,7 +219,20 @@ var currentPageCount = this._calculatePageCount(); if (oldPageCount != currentPageCount) { this._$gotoPageInput.empty(); - for (var i = 1; i <= currentPageCount; i++) { + + //Skip some pages is there are too many pages + var pageStep = 1; + if (currentPageCount > 10000) { + pageStep = 100; + } else if (currentPageCount > 5000) { + pageStep = 10; + } else if (currentPageCount > 2000) { + pageStep = 5; + } else if (currentPageCount > 1000) { + pageStep = 2; + } + + for (var i = pageStep; i <= currentPageCount; i += pageStep) { this._$gotoPageInput.append('<option value="' + i + '">' + i + '</option>'); } @@ -253,6 +280,9 @@ if (this._currentPageNo > pageCount) { this._currentPageNo = pageCount; } + if (this._currentPageNo <= 0) { + this._currentPageNo = 1; + } //if user sets one of the options on the combobox, then select it. var $pageSizeChangeCombobox = this._$bottomPanel.find('.jtable-page-size-change select'); @@ -265,9 +295,20 @@ } } + this._savePagingSettings(); this._reloadTable(); }, + /* Saves user preferences for paging + *************************************************************************/ + _savePagingSettings: function () { + if (!this.options.saveUserPreferences) { + return; + } + + this._setCookie('page-size', this.options.pageSize); + }, + /* Overrides _createRecordLoadUrl method to add paging info to URL. *************************************************************************/ _createRecordLoadUrl: function () { @@ -317,10 +358,13 @@ /* Overrides _onRecordsLoaded method to to do paging specific tasks. *************************************************************************/ _onRecordsLoaded: function (data) { - this._totalRecordCount = data.TotalRecordCount; - this._createPagingList(); - this._createPagingInfo(); - this._refreshGotoPageInput(); + if (this.options.paging) { + this._totalRecordCount = data.TotalRecordCount; + this._createPagingList(); + this._createPagingInfo(); + this._refreshGotoPageInput(); + } + base._onRecordsLoaded.apply(this, arguments); }, @@ -344,7 +388,7 @@ /* Creates and shows the page list. *************************************************************************/ _createPagingList: function () { - if (!this.options.paging || this.options.pageSize <= 0) { + if (this.options.pageSize <= 0) { return; } @@ -371,13 +415,13 @@ .html('<<') .data('pageNumber', 1) .appendTo(this._$pagingListArea); - + var $previous = $('<span></span>') .addClass('jtable-page-number-previous') .html('<') .data('pageNumber', this._currentPageNo - 1) .appendTo(this._$pagingListArea); - + if (this._currentPageNo <= 1) { $first.addClass('jtable-page-number-disabled'); $previous.addClass('jtable-page-number-disabled'); @@ -430,8 +474,8 @@ .html(pageNumber) .data('pageNumber', pageNumber) .appendTo(this._$pagingListArea); - - if(this._currentPageNo == pageNumber) { + + if (this._currentPageNo == pageNumber) { $pageNumber.addClass('jtable-page-number-active'); $pageNumber.addClass('jtable-page-number-disabled'); } @@ -505,7 +549,7 @@ }); }, - /* Changes current page tp given value. + /* Changes current page to given value. *************************************************************************/ _changePage: function (pageNo) { pageNo = this._normalizeNumber(pageNo, 1, this._calculatePageCount(), 1); diff --git a/dev/jquery.jtable.selecting.js b/dev/jquery.jtable.selecting.js index 63c4457..a387e79 100644 --- a/dev/jquery.jtable.selecting.js +++ b/dev/jquery.jtable.selecting.js @@ -1,377 +1,379 @@ -/************************************************************************
-* SELECTING extension for jTable *
-*************************************************************************/
-(function ($) {
-
- //Reference to base object members
- var base = {
- _create: $.hik.jtable.prototype._create,
- _addColumnsToHeaderRow: $.hik.jtable.prototype._addColumnsToHeaderRow,
- _addCellsToRowUsingRecord: $.hik.jtable.prototype._addCellsToRowUsingRecord,
- _onLoadingRecords: $.hik.jtable.prototype._onLoadingRecords,
- _onRecordsLoaded: $.hik.jtable.prototype._onRecordsLoaded,
- _onRowsRemoved: $.hik.jtable.prototype._onRowsRemoved
- };
-
- //extension members
- $.extend(true, $.hik.jtable.prototype, {
-
- /************************************************************************
- * DEFAULT OPTIONS / EVENTS *
- *************************************************************************/
- options: {
-
- //Options
- selecting: false,
- multiselect: false,
- selectingCheckboxes: false,
- selectOnRowClick: true,
-
- //Events
- selectionChanged: function (event, data) { }
- },
-
- /************************************************************************
- * PRIVATE FIELDS *
- *************************************************************************/
-
- _selectedRecordIdsBeforeLoad: null, //This array is used to store selected row Id's to restore them after a page refresh (string array).
- _$selectAllCheckbox: null, //Reference to the 'select/deselect all' checkbox (jQuery object)
- _shiftKeyDown: false, //True, if shift key is currently down.
-
- /************************************************************************
- * CONSTRUCTOR *
- *************************************************************************/
-
- /* Overrides base method to do selecting-specific constructions.
- *************************************************************************/
- _create: function () {
- if (this.options.selecting && this.options.selectingCheckboxes) {
- ++this._firstDataColumnOffset;
- }
-
- this._bindKeyboardEvents();
-
- //Call base method
- base._create.apply(this, arguments);
- },
-
- /* Registers to keyboard events those are needed for selection
- *************************************************************************/
- _bindKeyboardEvents: function () {
- var self = this;
- //Register to events to set _shiftKeyDown value
- $(document)
- .keydown(function(event) {
- switch (event.which) {
- case 16:
- self._shiftKeyDown = true;
- break;
- }
- })
- .keyup(function(event) {
- switch (event.which) {
- case 16:
- self._shiftKeyDown = false;
- break;
- }
- });
- },
-
- /************************************************************************
- * PUBLIC METHODS *
- *************************************************************************/
-
- /* Gets jQuery selection for currently selected rows.
- *************************************************************************/
- selectedRows: function () {
- return this._getSelectedRows();
- },
-
- /* Makes row/rows 'selected'.
- *************************************************************************/
- selectRows: function ($rows) {
- this._selectRows($rows);
- this._onSelectionChanged(); //TODO: trigger only if selected rows changes?
- },
-
- /************************************************************************
- * OVERRIDED METHODS *
- *************************************************************************/
-
- /* Overrides base method to add a 'select column' to header row.
- *************************************************************************/
- _addColumnsToHeaderRow: function ($tr) {
- if (this.options.selecting && this.options.selectingCheckboxes) {
- if (this.options.multiselect) {
- $tr.append(this._createSelectAllHeader());
- } else {
- $tr.append(this._createEmptyCommandHeader());
- }
- }
-
- base._addColumnsToHeaderRow.apply(this, arguments);
- },
-
- /* Overrides base method to add a 'delete command cell' to a row.
- *************************************************************************/
- _addCellsToRowUsingRecord: function ($row) {
- if (this.options.selecting) {
- this._makeRowSelectable($row);
- }
-
- base._addCellsToRowUsingRecord.apply(this, arguments);
- },
-
- /* Overrides base event to store selection list
- *************************************************************************/
- _onLoadingRecords: function () {
- this._storeSelectionList();
- base._onLoadingRecords.apply(this, arguments);
- },
-
- /* Overrides base event to restore selection list
- *************************************************************************/
- _onRecordsLoaded: function () {
- this._restoreSelectionList();
- base._onRecordsLoaded.apply(this, arguments);
- },
-
- /* Overrides base event to check is any selected row is being removed.
- *************************************************************************/
- _onRowsRemoved: function ($rows, reason) {
- if ((reason != 'reloading') && this.options.selecting && ($rows.filter('.jtable-row-selected').length > 0)) {
- this._onSelectionChanged();
- }
-
- base._onRowsRemoved.apply(this, arguments);
- },
-
- /************************************************************************
- * PRIVATE METHODS *
- *************************************************************************/
-
- /* Creates a header column to select/deselect all rows.
- *************************************************************************/
- _createSelectAllHeader: function () {
- var self = this;
-
- var $columnHeader = $('<th class=""></th>')
- .addClass('jtable-command-column-header jtable-column-header-selecting');
-
- var $headerContainer = $('<div />')
- .addClass('jtable-column-header-container')
- .appendTo($columnHeader);
-
- self._$selectAllCheckbox = $('<input type="checkbox" />')
- .appendTo($headerContainer)
- .click(function() {
- if (self._$tableRows.length <= 0) {
- self._$selectAllCheckbox.attr('checked', false);
- return;
- }
-
- var allRows = self._$tableBody.find('tr.jtable-data-row');
- if (self._$selectAllCheckbox.is(':checked')) {
- self._selectRows(allRows);
- } else {
- self._deselectRows(allRows);
- }
-
- self._onSelectionChanged();
- });
-
- return $columnHeader;
- },
-
- /* Stores Id's of currently selected records to _selectedRecordIdsBeforeLoad.
- *************************************************************************/
- _storeSelectionList: function () {
- var self = this;
-
- if (!self.options.selecting) {
- return;
- }
-
- self._selectedRecordIdsBeforeLoad = [];
- self._getSelectedRows().each(function () {
- self._selectedRecordIdsBeforeLoad.push(self._getKeyValueOfRecord($(this).data('record')));
- });
- },
-
- /* Selects rows whose Id is in _selectedRecordIdsBeforeLoad;
- *************************************************************************/
- _restoreSelectionList: function () {
- var self = this;
-
- if (!self.options.selecting) {
- return;
- }
-
- var selectedRowCount = 0;
- for (var i = 0; i < self._$tableRows.length; ++i) {
- var recordId = self._getKeyValueOfRecord(self._$tableRows[i].data('record'));
- if ($.inArray(recordId, self._selectedRecordIdsBeforeLoad) > -1) {
- self._selectRows(self._$tableRows[i]);
- ++selectedRowCount;
- }
- }
-
- if (self._selectedRecordIdsBeforeLoad.length > 0 && self._selectedRecordIdsBeforeLoad.length != selectedRowCount) {
- self._onSelectionChanged();
- }
-
- self._selectedRecordIdsBeforeLoad = [];
- self._refreshSelectAllCheckboxState();
- },
-
- /* Gets all selected rows.
- *************************************************************************/
- _getSelectedRows: function () {
- return this._$tableBody
- .find('.jtable-row-selected');
- },
-
- /* Adds selectable feature to a row.
- *************************************************************************/
- _makeRowSelectable: function ($row) {
- var self = this;
-
- //Select/deselect on row click
- if (self.options.selectOnRowClick) {
- $row.click(function () {
- self._invertRowSelection($row);
- });
- }
-
- //'select/deselect' checkbox column
- if (self.options.selectingCheckboxes) {
- var $cell = $('<td></td>')
- .addClass('jtable-selecting-column');
- var $selectCheckbox = $('<input type="checkbox" />')
- .appendTo($cell);
- if (!self.options.selectOnRowClick) {
- $selectCheckbox.click(function () {
- self._invertRowSelection($row);
- });
- }
-
- $row.append($cell);
- }
- },
-
- /* Inverts selection state of a single row.
- *************************************************************************/
- _invertRowSelection: function ($row) {
- if ($row.hasClass('jtable-row-selected')) {
- this._deselectRows($row);
- } else {
- //Shift key?
- if (this._shiftKeyDown) {
- var rowIndex = this._findRowIndex($row);
- //try to select row and above rows until first selected row
- var beforeIndex = this._findFirstSelectedRowIndexBeforeIndex(rowIndex) + 1;
- if (beforeIndex > 0 && beforeIndex < rowIndex) {
- this._selectRows(this._$tableBody.find('tr').slice(beforeIndex, rowIndex + 1));
- } else {
- //try to select row and below rows until first selected row
- var afterIndex = this._findFirstSelectedRowIndexAfterIndex(rowIndex) - 1;
- if (afterIndex > rowIndex) {
- this._selectRows(this._$tableBody.find('tr').slice(rowIndex, afterIndex + 1));
- } else {
- //just select this row
- this._selectRows($row);
- }
- }
- } else {
- this._selectRows($row);
- }
- }
-
- this._onSelectionChanged();
- },
-
- /* Search for a selected row (that is before given row index) to up and returns it's index
- *************************************************************************/
- _findFirstSelectedRowIndexBeforeIndex: function (rowIndex) {
- for (var i = rowIndex - 1; i >= 0; --i) {
- if (this._$tableRows[i].hasClass('jtable-row-selected')) {
- return i;
- }
- }
-
- return -1;
- },
-
- /* Search for a selected row (that is after given row index) to down and returns it's index
- *************************************************************************/
- _findFirstSelectedRowIndexAfterIndex: function (rowIndex) {
- for (var i = rowIndex + 1; i < this._$tableRows.length; ++i) {
- if (this._$tableRows[i].hasClass('jtable-row-selected')) {
- return i;
- }
- }
-
- return -1;
- },
-
- /* Makes row/rows 'selected'.
- *************************************************************************/
- _selectRows: function ($rows) {
-
- if (!this.options.multiselect) {
- this._deselectRows(this._getSelectedRows());
- }
-
- $rows.addClass('jtable-row-selected');
- if (this.options.selectingCheckboxes) {
- $rows.find('td.jtable-selecting-column input').attr('checked', true);
- }
-
- this._refreshSelectAllCheckboxState();
- },
-
- /* Makes row/rows 'non selected'.
- *************************************************************************/
- _deselectRows: function ($rows) {
- $rows.removeClass('jtable-row-selected');
- if (this.options.selectingCheckboxes) {
- $rows.find('td.jtable-selecting-column input').removeAttr('checked');
- }
-
- this._refreshSelectAllCheckboxState();
- },
-
- /* Updates state of the 'select/deselect' all checkbox according to count of selected rows.
- *************************************************************************/
- _refreshSelectAllCheckboxState: function () {
- if (!this.options.selectingCheckboxes || !this.options.multiselect) {
- return;
- }
-
- var totalRowCount = this._$tableRows.length;
- var selectedRowCount = this._getSelectedRows().length;
-
- if (selectedRowCount == 0) {
- this._$selectAllCheckbox.prop('indeterminate', false);
- this._$selectAllCheckbox.attr('checked', false);
- } else if (selectedRowCount == totalRowCount) {
- this._$selectAllCheckbox.prop('indeterminate', false);
- this._$selectAllCheckbox.attr('checked', true);
- } else {
- this._$selectAllCheckbox.attr('checked', false);
- this._$selectAllCheckbox.prop('indeterminate', true);
- }
- },
-
- /************************************************************************
- * EVENT RAISING METHODS *
- *************************************************************************/
-
- _onSelectionChanged: function () {
- this._trigger("selectionChanged", null, {});
- }
-
- });
-
-})(jQuery);
+/************************************************************************ +* SELECTING extension for jTable * +*************************************************************************/ +(function ($) { + + //Reference to base object members + var base = { + _create: $.hik.jtable.prototype._create, + _addColumnsToHeaderRow: $.hik.jtable.prototype._addColumnsToHeaderRow, + _addCellsToRowUsingRecord: $.hik.jtable.prototype._addCellsToRowUsingRecord, + _onLoadingRecords: $.hik.jtable.prototype._onLoadingRecords, + _onRecordsLoaded: $.hik.jtable.prototype._onRecordsLoaded, + _onRowsRemoved: $.hik.jtable.prototype._onRowsRemoved + }; + + //extension members + $.extend(true, $.hik.jtable.prototype, { + + /************************************************************************ + * DEFAULT OPTIONS / EVENTS * + *************************************************************************/ + options: { + + //Options + selecting: false, + multiselect: false, + selectingCheckboxes: false, + selectOnRowClick: true, + + //Events + selectionChanged: function (event, data) { } + }, + + /************************************************************************ + * PRIVATE FIELDS * + *************************************************************************/ + + _selectedRecordIdsBeforeLoad: null, //This array is used to store selected row Id's to restore them after a page refresh (string array). + _$selectAllCheckbox: null, //Reference to the 'select/deselect all' checkbox (jQuery object) + _shiftKeyDown: false, //True, if shift key is currently down. + + /************************************************************************ + * CONSTRUCTOR * + *************************************************************************/ + + /* Overrides base method to do selecting-specific constructions. + *************************************************************************/ + _create: function () { + if (this.options.selecting && this.options.selectingCheckboxes) { + ++this._firstDataColumnOffset; + this._bindKeyboardEvents(); + } + + //Call base method + base._create.apply(this, arguments); + }, + + /* Registers to keyboard events those are needed for selection + *************************************************************************/ + _bindKeyboardEvents: function () { + var self = this; + //Register to events to set _shiftKeyDown value + $(document) + .keydown(function (event) { + switch (event.which) { + case 16: + self._shiftKeyDown = true; + break; + } + }) + .keyup(function (event) { + switch (event.which) { + case 16: + self._shiftKeyDown = false; + break; + } + }); + }, + + /************************************************************************ + * PUBLIC METHODS * + *************************************************************************/ + + /* Gets jQuery selection for currently selected rows. + *************************************************************************/ + selectedRows: function () { + return this._getSelectedRows(); + }, + + /* Makes row/rows 'selected'. + *************************************************************************/ + selectRows: function ($rows) { + this._selectRows($rows); + this._onSelectionChanged(); //TODO: trigger only if selected rows changes? + }, + + /************************************************************************ + * OVERRIDED METHODS * + *************************************************************************/ + + /* Overrides base method to add a 'select column' to header row. + *************************************************************************/ + _addColumnsToHeaderRow: function ($tr) { + if (this.options.selecting && this.options.selectingCheckboxes) { + if (this.options.multiselect) { + $tr.append(this._createSelectAllHeader()); + } else { + $tr.append(this._createEmptyCommandHeader()); + } + } + + base._addColumnsToHeaderRow.apply(this, arguments); + }, + + /* Overrides base method to add a 'delete command cell' to a row. + *************************************************************************/ + _addCellsToRowUsingRecord: function ($row) { + if (this.options.selecting) { + this._makeRowSelectable($row); + } + + base._addCellsToRowUsingRecord.apply(this, arguments); + }, + + /* Overrides base event to store selection list + *************************************************************************/ + _onLoadingRecords: function () { + if (this.options.selecting) { + this._storeSelectionList(); + } + + base._onLoadingRecords.apply(this, arguments); + }, + + /* Overrides base event to restore selection list + *************************************************************************/ + _onRecordsLoaded: function () { + if (this.options.selecting) { + this._restoreSelectionList(); + } + + base._onRecordsLoaded.apply(this, arguments); + }, + + /* Overrides base event to check is any selected row is being removed. + *************************************************************************/ + _onRowsRemoved: function ($rows, reason) { + if (this.options.selecting && (reason != 'reloading') && ($rows.filter('.jtable-row-selected').length > 0)) { + this._onSelectionChanged(); + } + + base._onRowsRemoved.apply(this, arguments); + }, + + /************************************************************************ + * PRIVATE METHODS * + *************************************************************************/ + + /* Creates a header column to select/deselect all rows. + *************************************************************************/ + _createSelectAllHeader: function () { + var self = this; + + var $columnHeader = $('<th class=""></th>') + .addClass('jtable-command-column-header jtable-column-header-selecting'); + + var $headerContainer = $('<div />') + .addClass('jtable-column-header-container') + .appendTo($columnHeader); + + self._$selectAllCheckbox = $('<input type="checkbox" />') + .appendTo($headerContainer) + .click(function () { + if (self._$tableRows.length <= 0) { + self._$selectAllCheckbox.attr('checked', false); + return; + } + + var allRows = self._$tableBody.find('>tr.jtable-data-row'); + if (self._$selectAllCheckbox.is(':checked')) { + self._selectRows(allRows); + } else { + self._deselectRows(allRows); + } + + self._onSelectionChanged(); + }); + + return $columnHeader; + }, + + /* Stores Id's of currently selected records to _selectedRecordIdsBeforeLoad. + *************************************************************************/ + _storeSelectionList: function () { + var self = this; + + if (!self.options.selecting) { + return; + } + + self._selectedRecordIdsBeforeLoad = []; + self._getSelectedRows().each(function () { + self._selectedRecordIdsBeforeLoad.push(self._getKeyValueOfRecord($(this).data('record'))); + }); + }, + + /* Selects rows whose Id is in _selectedRecordIdsBeforeLoad; + *************************************************************************/ + _restoreSelectionList: function () { + var self = this; + + if (!self.options.selecting) { + return; + } + + var selectedRowCount = 0; + for (var i = 0; i < self._$tableRows.length; ++i) { + var recordId = self._getKeyValueOfRecord(self._$tableRows[i].data('record')); + if ($.inArray(recordId, self._selectedRecordIdsBeforeLoad) > -1) { + self._selectRows(self._$tableRows[i]); + ++selectedRowCount; + } + } + + if (self._selectedRecordIdsBeforeLoad.length > 0 && self._selectedRecordIdsBeforeLoad.length != selectedRowCount) { + self._onSelectionChanged(); + } + + self._selectedRecordIdsBeforeLoad = []; + self._refreshSelectAllCheckboxState(); + }, + + /* Gets all selected rows. + *************************************************************************/ + _getSelectedRows: function () { + return this._$tableBody + .find('>tr.jtable-row-selected'); + }, + + /* Adds selectable feature to a row. + *************************************************************************/ + _makeRowSelectable: function ($row) { + var self = this; + + //Select/deselect on row click + if (self.options.selectOnRowClick) { + $row.click(function () { + self._invertRowSelection($row); + }); + } + + //'select/deselect' checkbox column + if (self.options.selectingCheckboxes) { + var $cell = $('<td></td>').addClass('jtable-selecting-column'); + var $selectCheckbox = $('<input type="checkbox" />').appendTo($cell); + if (!self.options.selectOnRowClick) { + $selectCheckbox.click(function () { + self._invertRowSelection($row); + }); + } + + $row.append($cell); + } + }, + + /* Inverts selection state of a single row. + *************************************************************************/ + _invertRowSelection: function ($row) { + if ($row.hasClass('jtable-row-selected')) { + this._deselectRows($row); + } else { + //Shift key? + if (this._shiftKeyDown) { + var rowIndex = this._findRowIndex($row); + //try to select row and above rows until first selected row + var beforeIndex = this._findFirstSelectedRowIndexBeforeIndex(rowIndex) + 1; + if (beforeIndex > 0 && beforeIndex < rowIndex) { + this._selectRows(this._$tableBody.find('tr').slice(beforeIndex, rowIndex + 1)); + } else { + //try to select row and below rows until first selected row + var afterIndex = this._findFirstSelectedRowIndexAfterIndex(rowIndex) - 1; + if (afterIndex > rowIndex) { + this._selectRows(this._$tableBody.find('tr').slice(rowIndex, afterIndex + 1)); + } else { + //just select this row + this._selectRows($row); + } + } + } else { + this._selectRows($row); + } + } + + this._onSelectionChanged(); + }, + + /* Search for a selected row (that is before given row index) to up and returns it's index + *************************************************************************/ + _findFirstSelectedRowIndexBeforeIndex: function (rowIndex) { + for (var i = rowIndex - 1; i >= 0; --i) { + if (this._$tableRows[i].hasClass('jtable-row-selected')) { + return i; + } + } + + return -1; + }, + + /* Search for a selected row (that is after given row index) to down and returns it's index + *************************************************************************/ + _findFirstSelectedRowIndexAfterIndex: function (rowIndex) { + for (var i = rowIndex + 1; i < this._$tableRows.length; ++i) { + if (this._$tableRows[i].hasClass('jtable-row-selected')) { + return i; + } + } + + return -1; + }, + + /* Makes row/rows 'selected'. + *************************************************************************/ + _selectRows: function ($rows) { + if (!this.options.multiselect) { + this._deselectRows(this._getSelectedRows()); + } + + $rows.addClass('jtable-row-selected'); + if (this.options.selectingCheckboxes) { + $rows.find('>td.jtable-selecting-column >input').prop('checked', true); + } + + this._refreshSelectAllCheckboxState(); + }, + + /* Makes row/rows 'non selected'. + *************************************************************************/ + _deselectRows: function ($rows) { + $rows.removeClass('jtable-row-selected'); + if (this.options.selectingCheckboxes) { + $rows.find('>td.jtable-selecting-column >input').prop('checked', false); + } + + this._refreshSelectAllCheckboxState(); + }, + + /* Updates state of the 'select/deselect' all checkbox according to count of selected rows. + *************************************************************************/ + _refreshSelectAllCheckboxState: function () { + if (!this.options.selectingCheckboxes || !this.options.multiselect) { + return; + } + + var totalRowCount = this._$tableRows.length; + var selectedRowCount = this._getSelectedRows().length; + + if (selectedRowCount == 0) { + this._$selectAllCheckbox.prop('indeterminate', false); + this._$selectAllCheckbox.attr('checked', false); + } else if (selectedRowCount == totalRowCount) { + this._$selectAllCheckbox.prop('indeterminate', false); + this._$selectAllCheckbox.attr('checked', true); + } else { + this._$selectAllCheckbox.attr('checked', false); + this._$selectAllCheckbox.prop('indeterminate', true); + } + }, + + /************************************************************************ + * EVENT RAISING METHODS * + *************************************************************************/ + + _onSelectionChanged: function () { + this._trigger("selectionChanged", null, {}); + } + + }); + +})(jQuery); diff --git a/jTable.jquery.json b/jTable.jquery.json index 82b6642..ae1e827 100644 --- a/jTable.jquery.json +++ b/jTable.jquery.json @@ -11,7 +11,7 @@ "paging", "sorting" ], - "version": "2.2.0", + "version": "2.2.1", "author": { "name": "Halil ibrahim Kalkan", "email": "halil@jtable.org", diff --git a/lib/jquery.jtable.js b/lib/jquery.jtable.js index 9cee197..0db71c6 100644 --- a/lib/jquery.jtable.js +++ b/lib/jquery.jtable.js @@ -1,6 +1,6 @@ /* -jTable 2.2.0 +jTable 2.2.1 http://www.jtable.org --------------------------------------------------------------------------- @@ -48,6 +48,7 @@ THE SOFTWARE. dialogHideEffect: 'fade', showCloseButton: false, loadingAnimationDelay: 500, + saveUserPreferences: true, ajaxSettings: { type: 'POST', @@ -133,6 +134,8 @@ THE SOFTWARE. this._createBusyPanel(); this._createErrorDialogDiv(); this._addNoDataRow(); + + this._cookieKeyPrefix = this._generateCookieKeyPrefix(); }, /* Normalizes some options for all fields (sets default values). @@ -890,22 +893,22 @@ THE SOFTWARE. _parseDate: function (dateString) { if (dateString.indexOf('Date') >= 0) { //Format: /Date(1320259705710)/ return new Date( - parseInt(dateString.substr(6)) + parseInt(dateString.substr(6), 10) ); } else if (dateString.length == 10) { //Format: 2011-01-01 return new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)) + parseInt(dateString.substr(0, 4), 10), + parseInt(dateString.substr(5, 2), 10) - 1, + parseInt(dateString.substr(8, 2), 10) ); } else if (dateString.length == 19) { //Format: 2011-01-01 20:32:42 return new Date( - parseInt(dateString.substr(0, 4)), - parseInt(dateString.substr(5, 2)) - 1, - parseInt(dateString.substr(8, 2)), - parseInt(dateString.substr(11, 2)), - parseInt(dateString.substr(14, 2)), - parseInt(dateString.substr(17, 2)) + parseInt(dateString.substr(0, 4), 10), + parseInt(dateString.substr(5, 2), 10) - 1, + parseInt(dateString.substr(8, 2, 10)), + parseInt(dateString.substr(11, 2), 10), + parseInt(dateString.substr(14, 2), 10), + parseInt(dateString.substr(17, 2), 10) ); } else { this._logWarn('Given date is not properly formatted: ' + dateString); @@ -1098,6 +1101,72 @@ THE SOFTWARE. _getKeyValueOfRecord: function (record) { return record[this._keyField]; }, + + /************************************************************************ + * COOKIE * + *************************************************************************/ + + /* Sets a cookie with given key. + *************************************************************************/ + _setCookie: function (key, value) { + key = this._cookieKeyPrefix + key; + + var expireDate = new Date(); + expireDate.setDate(expireDate.getDate() + 30); + document.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(value) + "; expires=" + expireDate.toUTCString(); + }, + + /* Gets a cookie with given key. + *************************************************************************/ + _getCookie: function (key) { + key = this._cookieKeyPrefix + key; + + var equalities = document.cookie.split('; '); + for (var i = 0; i < equalities.length; i++) { + if (!equalities[i]) { + continue; + } + + var splitted = equalities[i].split('='); + if (splitted.length != 2) { + continue; + } + + if (decodeURIComponent(splitted[0]) === key) { + return decodeURIComponent(splitted[1] || ''); + } + } + + return null; + }, + + /* Generates a hash key to be prefix for all cookies for this jtable instance. + *************************************************************************/ + _generateCookieKeyPrefix: function () { + + var simpleHash = function (value) { + var hash = 0; + if (value.length == 0) { + return hash; + } + + for (var i = 0; i < value.length; i++) { + var ch = value.charCodeAt(i); + hash = ((hash << 5) - hash) + ch; + hash = hash & hash; + } + + return hash; + }; + + var strToHash = ''; + if (this.options.tableId) { + strToHash = strToHash + this.options.tableId + '#'; + } + + strToHash = strToHash + this._columnList.join('$') + '#c' + this._$table.find('thead th').length; + return 'jtable#' + simpleHash(strToHash); + }, /************************************************************************ * EVENT RAISING METHODS * @@ -2877,10 +2946,9 @@ THE SOFTWARE. _create: function () { if (this.options.selecting && this.options.selectingCheckboxes) { ++this._firstDataColumnOffset; + this._bindKeyboardEvents(); } - this._bindKeyboardEvents(); - //Call base method base._create.apply(this, arguments); }, @@ -2891,18 +2959,18 @@ THE SOFTWARE. var self = this; //Register to events to set _shiftKeyDown value $(document) - .keydown(function(event) { + .keydown(function (event) { switch (event.which) { - case 16: - self._shiftKeyDown = true; - break; + case 16: + self._shiftKeyDown = true; + break; } }) - .keyup(function(event) { + .keyup(function (event) { switch (event.which) { - case 16: - self._shiftKeyDown = false; - break; + case 16: + self._shiftKeyDown = false; + break; } }); }, @@ -2916,7 +2984,7 @@ THE SOFTWARE. selectedRows: function () { return this._getSelectedRows(); }, - + /* Makes row/rows 'selected'. *************************************************************************/ selectRows: function ($rows) { @@ -2955,21 +3023,27 @@ THE SOFTWARE. /* Overrides base event to store selection list *************************************************************************/ _onLoadingRecords: function () { - this._storeSelectionList(); + if (this.options.selecting) { + this._storeSelectionList(); + } + base._onLoadingRecords.apply(this, arguments); }, /* Overrides base event to restore selection list *************************************************************************/ _onRecordsLoaded: function () { - this._restoreSelectionList(); + if (this.options.selecting) { + this._restoreSelectionList(); + } + base._onRecordsLoaded.apply(this, arguments); }, /* Overrides base event to check is any selected row is being removed. *************************************************************************/ _onRowsRemoved: function ($rows, reason) { - if ((reason != 'reloading') && this.options.selecting && ($rows.filter('.jtable-row-selected').length > 0)) { + if (this.options.selecting && (reason != 'reloading') && ($rows.filter('.jtable-row-selected').length > 0)) { this._onSelectionChanged(); } @@ -2994,13 +3068,13 @@ THE SOFTWARE. self._$selectAllCheckbox = $('<input type="checkbox" />') .appendTo($headerContainer) - .click(function() { + .click(function () { if (self._$tableRows.length <= 0) { self._$selectAllCheckbox.attr('checked', false); return; } - var allRows = self._$tableBody.find('tr.jtable-data-row'); + var allRows = self._$tableBody.find('>tr.jtable-data-row'); if (self._$selectAllCheckbox.is(':checked')) { self._selectRows(allRows); } else { @@ -3058,7 +3132,7 @@ THE SOFTWARE. *************************************************************************/ _getSelectedRows: function () { return this._$tableBody - .find('.jtable-row-selected'); + .find('>tr.jtable-row-selected'); }, /* Adds selectable feature to a row. @@ -3075,10 +3149,8 @@ THE SOFTWARE. //'select/deselect' checkbox column if (self.options.selectingCheckboxes) { - var $cell = $('<td></td>') - .addClass('jtable-selecting-column'); - var $selectCheckbox = $('<input type="checkbox" />') - .appendTo($cell); + var $cell = $('<td></td>').addClass('jtable-selecting-column'); + var $selectCheckbox = $('<input type="checkbox" />').appendTo($cell); if (!self.options.selectOnRowClick) { $selectCheckbox.click(function () { self._invertRowSelection($row); @@ -3147,14 +3219,13 @@ THE SOFTWARE. /* Makes row/rows 'selected'. *************************************************************************/ _selectRows: function ($rows) { - if (!this.options.multiselect) { this._deselectRows(this._getSelectedRows()); } $rows.addClass('jtable-row-selected'); if (this.options.selectingCheckboxes) { - $rows.find('td.jtable-selecting-column input').attr('checked', true); + $rows.find('>td.jtable-selecting-column >input').prop('checked', true); } this._refreshSelectAllCheckboxState(); @@ -3165,7 +3236,7 @@ THE SOFTWARE. _deselectRows: function ($rows) { $rows.removeClass('jtable-row-selected'); if (this.options.selectingCheckboxes) { - $rows.find('td.jtable-selecting-column input').removeAttr('checked'); + $rows.find('>td.jtable-selecting-column >input').prop('checked', false); } this._refreshSelectAllCheckboxState(); @@ -3196,7 +3267,7 @@ THE SOFTWARE. /************************************************************************ * EVENT RAISING METHODS * *************************************************************************/ - + _onSelectionChanged: function () { this._trigger("selectionChanged", null, {}); } @@ -3266,6 +3337,7 @@ THE SOFTWARE. _create: function () { base._create.apply(this, arguments); if (this.options.paging) { + this._loadPagingSettings(); this._createBottomPanel(); this._createPageListArea(); this._createGotoPageInput(); @@ -3273,6 +3345,19 @@ THE SOFTWARE. } }, + /* Loads user preferences for paging. + *************************************************************************/ + _loadPagingSettings: function () { + if (!this.options.saveUserPreferences) { + return; + } + + var pageSize = this._getCookie('page-size'); + if (pageSize) { + this.options.pageSize = this._normalizeNumber(pageSize, 1, 1000000, this.options.pageSize); + } + }, + /* Creates bottom panel and adds to the page. *************************************************************************/ _createBottomPanel: function () { @@ -3413,7 +3498,20 @@ THE SOFTWARE. var currentPageCount = this._calculatePageCount(); if (oldPageCount != currentPageCount) { this._$gotoPageInput.empty(); - for (var i = 1; i <= currentPageCount; i++) { + + //Skip some pages is there are too many pages + var pageStep = 1; + if (currentPageCount > 10000) { + pageStep = 100; + } else if (currentPageCount > 5000) { + pageStep = 10; + } else if (currentPageCount > 2000) { + pageStep = 5; + } else if (currentPageCount > 1000) { + pageStep = 2; + } + + for (var i = pageStep; i <= currentPageCount; i += pageStep) { this._$gotoPageInput.append('<option value="' + i + '">' + i + '</option>'); } @@ -3461,6 +3559,9 @@ THE SOFTWARE. if (this._currentPageNo > pageCount) { this._currentPageNo = pageCount; } + if (this._currentPageNo <= 0) { + this._currentPageNo = 1; + } //if user sets one of the options on the combobox, then select it. var $pageSizeChangeCombobox = this._$bottomPanel.find('.jtable-page-size-change select'); @@ -3473,9 +3574,20 @@ THE SOFTWARE. } } + this._savePagingSettings(); this._reloadTable(); }, + /* Saves user preferences for paging + *************************************************************************/ + _savePagingSettings: function () { + if (!this.options.saveUserPreferences) { + return; + } + + this._setCookie('page-size', this.options.pageSize); + }, + /* Overrides _createRecordLoadUrl method to add paging info to URL. *************************************************************************/ _createRecordLoadUrl: function () { @@ -3525,10 +3637,13 @@ THE SOFTWARE. /* Overrides _onRecordsLoaded method to to do paging specific tasks. *************************************************************************/ _onRecordsLoaded: function (data) { - this._totalRecordCount = data.TotalRecordCount; - this._createPagingList(); - this._createPagingInfo(); - this._refreshGotoPageInput(); + if (this.options.paging) { + this._totalRecordCount = data.TotalRecordCount; + this._createPagingList(); + this._createPagingInfo(); + this._refreshGotoPageInput(); + } + base._onRecordsLoaded.apply(this, arguments); }, @@ -3552,7 +3667,7 @@ THE SOFTWARE. /* Creates and shows the page list. *************************************************************************/ _createPagingList: function () { - if (!this.options.paging || this.options.pageSize <= 0) { + if (this.options.pageSize <= 0) { return; } @@ -3579,13 +3694,13 @@ THE SOFTWARE. .html('<<') .data('pageNumber', 1) .appendTo(this._$pagingListArea); - + var $previous = $('<span></span>') .addClass('jtable-page-number-previous') .html('<') .data('pageNumber', this._currentPageNo - 1) .appendTo(this._$pagingListArea); - + if (this._currentPageNo <= 1) { $first.addClass('jtable-page-number-disabled'); $previous.addClass('jtable-page-number-disabled'); @@ -3638,8 +3753,8 @@ THE SOFTWARE. .html(pageNumber) .data('pageNumber', pageNumber) .appendTo(this._$pagingListArea); - - if(this._currentPageNo == pageNumber) { + + if (this._currentPageNo == pageNumber) { $pageNumber.addClass('jtable-page-number-active'); $pageNumber.addClass('jtable-page-number-disabled'); } @@ -3713,7 +3828,7 @@ THE SOFTWARE. }); }, - /* Changes current page tp given value. + /* Changes current page to given value. *************************************************************************/ _changePage: function (pageNo) { pageNo = this._normalizeNumber(pageNo, 1, this._calculatePageCount(), 1); @@ -3940,8 +4055,7 @@ THE SOFTWARE. options: { tableId: undefined, columnResizable: true, - columnSelectable: true, - saveUserPreferences: true + columnSelectable: true }, /************************************************************************ @@ -3966,7 +4080,6 @@ THE SOFTWARE. this._createColumnResizeBar(); this._createColumnSelection(); - this._cookieKeyPrefix = this._generateCookieKeyPrefix(); if (this.options.saveUserPreferences) { this._loadColumnSettings(); } @@ -4358,7 +4471,7 @@ THE SOFTWARE. columnSettings[fieldName] = { columnVisibility: settings[0], columnWidth: settings[1] - }; ; + }; }); var headerCells = this._$table.find('>thead >tr >th.jtable-column-header'); @@ -4374,72 +4487,6 @@ THE SOFTWARE. $cell.data('width-in-percent', columnSettings[fieldName].columnWidth).css('width', columnSettings[fieldName].columnWidth + '%'); } }); - }, - - /************************************************************************ - * COOKIE * - *************************************************************************/ - - /* Sets a cookie with given key. - *************************************************************************/ - _setCookie: function (key, value) { - key = this._cookieKeyPrefix + key; - - var expireDate = new Date(); - expireDate.setDate(expireDate.getDate() + 30); - document.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(value) + "; expires=" + expireDate.toUTCString(); - }, - - /* Gets a cookie with given key. - *************************************************************************/ - _getCookie: function (key) { - key = this._cookieKeyPrefix + key; - - var equalities = document.cookie.split('; '); - for (var i = 0; i < equalities.length; i++) { - if (!equalities[i]) { - continue; - } - - var splitted = equalities[i].split('='); - if (splitted.length != 2) { - continue; - } - - if (decodeURIComponent(splitted[0]) === key) { - return decodeURIComponent(splitted[1] || ''); - } - } - - return null; - }, - - /* Generates a hash key to be prefix for all cookies for this jtable instance. - *************************************************************************/ - _generateCookieKeyPrefix: function () { - - var simpleHash = function (value) { - var hash = 0; - if (value.length == 0) { - return hash; - } - - for (var i = 0; i < value.length; i++) { - var ch = value.charCodeAt(i); - hash = ((hash << 5) - hash) + ch; - hash = hash & hash; - } - - return hash; - }; - - var strToHash = ''; - if (this.options.tableId) { - strToHash = strToHash + this.options.tableId + '#'; - } - - strToHash = strToHash + this._columnList.join('$') + '#c' + this._$table.find('thead th').length; - return 'jtable#' + simpleHash(strToHash); } }); diff --git a/lib/jquery.jtable.min.js b/lib/jquery.jtable.min.js index 4501f99..de818af 100644 --- a/lib/jquery.jtable.min.js +++ b/lib/jquery.jtable.min.js @@ -1,5 +1,5 @@ /* -jTable 2.2.0 +jTable 2.2.1 http://www.jtable.org --------------------------------------------------------------------------- Copyright (C) 2011-2012 by Halil Ýbrahim Kalkan (http://www.halilibrahimkalkan.com) @@ -22,124 +22,125 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -(function(c){c.widget("hik.jtable",{options:{actions:{},fields:{},animationsEnabled:!0,defaultDateFormat:"yy-mm-dd",dialogShowEffect:"fade",dialogHideEffect:"fade",showCloseButton:!1,loadingAnimationDelay:500,ajaxSettings:{type:"POST",dataType:"json"},toolbar:{hoverAnimation:!0,hoverAnimationDuration:60,hoverAnimationEasing:void 0,items:[]},closeRequested:function(){},formCreated:function(){},formSubmitting:function(){},formClosed:function(){},loadingRecords:function(){},recordsLoaded:function(){}, +(function(d){d.widget("hik.jtable",{options:{actions:{},fields:{},animationsEnabled:!0,defaultDateFormat:"yy-mm-dd",dialogShowEffect:"fade",dialogHideEffect:"fade",showCloseButton:!1,loadingAnimationDelay:500,saveUserPreferences:!0,ajaxSettings:{type:"POST",dataType:"json"},toolbar:{hoverAnimation:!0,hoverAnimationDuration:60,hoverAnimationEasing:void 0,items:[]},closeRequested:function(){},formCreated:function(){},formSubmitting:function(){},formClosed:function(){},loadingRecords:function(){},recordsLoaded:function(){}, rowInserted:function(){},rowsRemoved:function(){},messages:{serverCommunicationError:"An error occured while communicating to the server.",loadingMessage:"Loading records...",noDataAvailable:"No data available!",areYouSure:"Are you sure?",save:"Save",saving:"Saving",cancel:"Cancel",error:"Error",close:"Close",cannotLoadOptionsFor:"Can not load options for field {0}"}},_$mainContainer:null,_$titleDiv:null,_$toolbarDiv:null,_$table:null,_$tableBody:null,_$tableRows:null,_$busyDiv:null,_$busyMessageDiv:null, -_$errorDialogDiv:null,_columnList:null,_fieldList:null,_keyField:null,_firstDataColumnOffset:0,_lastPostData:null,_cache:null,_create:function(){this._normalizeFieldsOptions();this._initializeFields();this._createFieldAndColumnList();this._createMainContainer();this._createTableTitle();this._createToolBar();this._createTable();this._createBusyPanel();this._createErrorDialogDiv();this._addNoDataRow()},_normalizeFieldsOptions:function(){var b=this;c.each(b.options.fields,function(a,d){b._normalizeFieldOptions(a, -d)})},_normalizeFieldOptions:function(b,a){void 0==a.listClass&&(a.listClass="");void 0==a.inputClass&&(a.inputClass="");if(a.dependsOn&&"string"===c.type(a.dependsOn)){var d=a.dependsOn.split(",");a.dependsOn=[];for(var f=0;f<d.length;f++)a.dependsOn.push(c.trim(d[f]))}},_initializeFields:function(){this._lastPostData={};this._$tableRows=[];this._columnList=[];this._fieldList=[];this._cache=[]},_createFieldAndColumnList:function(){var b=this;c.each(b.options.fields,function(a,d){b._fieldList.push(a); -!0==d.key&&(b._keyField=a);!1!=d.list&&"hidden"!=d.type&&b._columnList.push(a)})},_createMainContainer:function(){this._$mainContainer=c("<div />").addClass("jtable-main-container").appendTo(this.element)},_createTableTitle:function(){var b=this;if(b.options.title){var a=c("<div />").addClass("jtable-title").appendTo(b._$mainContainer);c("<div />").addClass("jtable-title-text").appendTo(a).append(b.options.title);if(b.options.showCloseButton){var d=c("<span />").html(b.options.messages.close);c("<button></button>").addClass("jtable-command-button jtable-close-button").attr("title", -b.options.messages.close).append(d).appendTo(a).click(function(a){a.preventDefault();a.stopPropagation();b._onCloseRequested()})}b._$titleDiv=a}},_createTable:function(){this._$table=c("<table></table>").addClass("jtable").appendTo(this._$mainContainer);this._createTableHead();this._createTableBody()},_createTableHead:function(){var b=c("<thead></thead>").appendTo(this._$table);this._addRowToTableHead(b)},_addRowToTableHead:function(b){b=c("<tr></tr>").appendTo(b);this._addColumnsToHeaderRow(b)}, -_addColumnsToHeaderRow:function(b){for(var a=0;a<this._columnList.length;a++){var d=this._columnList[a];this._createHeaderCellForField(d,this.options.fields[d]).appendTo(b)}},_createHeaderCellForField:function(b,a){a.width=a.width||"10%";var d=c("<span />").addClass("jtable-column-header-text").html(a.title),d=c("<div />").addClass("jtable-column-header-container").append(d);return c("<th></th>").addClass("jtable-column-header").css("width",a.width).data("fieldName",b).append(d)},_createEmptyCommandHeader:function(){return c("<th></th>").addClass("jtable-command-column-header").css("width", -"1%")},_createTableBody:function(){this._$tableBody=c("<tbody></tbody>").appendTo(this._$table)},_createBusyPanel:function(){this._$busyMessageDiv=c("<div />").addClass("jtable-busy-message").prependTo(this._$mainContainer);this._$busyDiv=c("<div />").addClass("jtable-busy-panel-background").prependTo(this._$mainContainer);this._hideBusy()},_createErrorDialogDiv:function(){var b=this;b._$errorDialogDiv=c("<div></div>").appendTo(b._$mainContainer);b._$errorDialogDiv.dialog({autoOpen:!1,show:b.options.dialogShowEffect, -hide:b.options.dialogHideEffect,modal:!0,title:b.options.messages.error,buttons:[{text:b.options.messages.close,click:function(){b._$errorDialogDiv.dialog("close")}}]})},load:function(b,a){this._lastPostData=b;this._reloadTable(a)},reload:function(b){this._reloadTable(b)},getRowByKey:function(b){for(var a=0;a<this._$tableRows.length;a++)if(b==this._getKeyValueOfRecord(this._$tableRows[a].data("record")))return this._$tableRows[a];return null},destroy:function(){this.element.empty();c.Widget.prototype.destroy.call(this)}, -_setOption:function(){},_reloadTable:function(b){var a=this;a._showBusy(a.options.messages.loadingMessage,a.options.loadingAnimationDelay);var d=a._createRecordLoadUrl();a._onLoadingRecords();a._ajax({url:d,data:a._lastPostData,success:function(f){a._hideBusy();"OK"!=f.Result?a._showError(f.Message):(a._removeAllRows("reloading"),a._addRecordsToTable(f.Records),a._onRecordsLoaded(f),b&&b())},error:function(){a._hideBusy();a._showError(a.options.messages.serverCommunicationError)}})},_createRecordLoadUrl:function(){return this.options.actions.listAction}, -_createRowFromRecord:function(b){b=c("<tr></tr>").addClass("jtable-data-row").attr("data-record-key",this._getKeyValueOfRecord(b)).data("record",b);this._addCellsToRowUsingRecord(b);return b},_addCellsToRowUsingRecord:function(b){for(var a=b.data("record"),d=0;d<this._columnList.length;d++)this._createCellForRecordField(a,this._columnList[d]).appendTo(b)},_createCellForRecordField:function(b,a){return c("<td></td>").addClass(this.options.fields[a].listClass).append(this._getDisplayTextForRecordField(b, -a))},_addRecordsToTable:function(b){var a=this;c.each(b,function(b,f){a._addRow(a._createRowFromRecord(f))});a._refreshRowStyles()},_addRowToTable:function(b,a,d,f){a={index:this._normalizeNumber(a,0,this._$tableRows.length,this._$tableRows.length)};!0==d&&(a.isNewRow=!0);!1==f&&(a.animationsEnabled=!1);this._addRow(b,a)},_addRow:function(b,a){a=c.extend({index:this._$tableRows.length,isNewRow:!1,animationsEnabled:!0},a);0>=this._$tableRows.length&&this._removeNoDataRow();a.index=this._normalizeNumber(a.index, -0,this._$tableRows.length,this._$tableRows.length);a.index==this._$tableRows.length?(this._$tableBody.append(b),this._$tableRows.push(b)):0==a.index?(this._$tableBody.prepend(b),this._$tableRows.unshift(b)):(this._$tableRows[a.index-1].after(b),this._$tableRows.splice(a.index,0,b));this._onRowInserted(b,a.isNewRow);a.isNewRow&&(this._refreshRowStyles(),this.options.animationsEnabled&&a.animationsEnabled&&this._showNewRowAnimation(b))},_showNewRowAnimation:function(b){b.addClass("jtable-row-created", -"slow","",function(){b.removeClass("jtable-row-created",5E3)})},_removeRowsFromTable:function(b,a){var d=this;0>=b.length||(b.addClass("jtable-row-removed").remove(),b.each(function(){var a=d._findRowIndex(c(this));0<=a&&d._$tableRows.splice(a,1)}),d._onRowsRemoved(b,a),0==d._$tableRows.length&&d._addNoDataRow(),d._refreshRowStyles())},_findRowIndex:function(b){return this._findIndexInArray(b,this._$tableRows,function(a,b){return a.data("record")==b.data("record")})},_removeAllRows:function(b){if(!(0>= -this._$tableRows.length)){var a=this._$tableBody.find("tr.jtable-data-row");this._$tableBody.empty();this._$tableRows=[];this._onRowsRemoved(a,b);this._addNoDataRow()}},_addNoDataRow:function(){if(!(0<this._$tableBody.find(">tr.jtable-no-data-row").length)){var b=c("<tr></tr>").addClass("jtable-no-data-row").appendTo(this._$tableBody),a=this._$table.find("thead th").length;c("<td></td>").attr("colspan",a).html(this.options.messages.noDataAvailable).appendTo(b)}},_removeNoDataRow:function(){this._$tableBody.find(".jtable-no-data-row").remove()}, -_refreshRowStyles:function(){for(var b=0;b<this._$tableRows.length;b++)0==b%2?this._$tableRows[b].addClass("jtable-row-even"):this._$tableRows[b].removeClass("jtable-row-even")},_getDisplayTextForRecordField:function(b,a){var d=this.options.fields[a],f=b[a];return d.display?d.display({record:b}):"date"==d.type?this._getDisplayTextForDateRecordField(d,f):"checkbox"==d.type?this._getCheckBoxTextForFieldByValue(a,f):d.options?(d=this._getOptionsForField(a,{record:b,value:f,source:"list",dependedValues:this._createDependedValuesUsingRecord(b, -d.dependsOn)}),this._findOptionByValue(d,f).DisplayText):f},_createDependedValuesUsingRecord:function(b,a){if(!a)return{};for(var d={},f=0;f<a.length;f++)d[a[f]]=b[a[f]];return d},_findOptionByValue:function(b,a){for(var d=0;d<b.length;d++)if(b[d].Value==a)return b[d];return{}},_getDisplayTextForDateRecordField:function(b,a){if(!a)return"";var d=b.displayFormat||this.options.defaultDateFormat,f=this._parseDate(a);return c.datepicker.formatDate(d,f)},_getOptionsForField:function(b,a){var d=this.options.fields[b], -f=d.options;c.isFunction(f)&&(a=c.extend(!0,{_cacheCleared:!1,dependedValues:{},clearCache:function(){this._cacheCleared=!0}},a),f=f(a));if("string"==typeof f){var g="options_"+b+"_"+f;a._cacheCleared||!this._cache[g]?(this._cache[g]=this._buildOptionsFromArray(this._downloadOptions(b,f)),this._sortFieldOptions(this._cache[g],d.optionsSorting)):void 0!=a.value&&void 0==this._findOptionByValue(this._cache[g],a.value).DisplayText&&(this._cache[g]=this._buildOptionsFromArray(this._downloadOptions(b, -f)),this._sortFieldOptions(this._cache[g],d.optionsSorting));f=this._cache[g]}else f=jQuery.isArray(f)?this._buildOptionsFromArray(f):this._buildOptionsArrayFromObject(f),this._sortFieldOptions(f,d.optionsSorting);return f},_downloadOptions:function(b,a){var d=this,f=[];d._ajax({url:a,async:!1,success:function(a){"OK"!=a.Result?d._showError(a.Message):f=a.Options},error:function(){var a=d._formatString(d.options.messages.cannotLoadOptionsFor,b);d._showError(a)}});return f},_sortFieldOptions:function(b, -a){if(b&&b.length&&a){var d;d=0==a.indexOf("value")?function(a){return a.Value}:function(a){return a.DisplayText};var f;f="string"==c.type(d(b[0]))?function(a,f){return d(a).localeCompare(d(f))}:function(a,f){return d(a)-d(f)};0<a.indexOf("desc")?b.sort(function(a,b){return f(b,a)}):b.sort(function(a,b){return f(a,b)})}},_buildOptionsArrayFromObject:function(b){var a=[];c.each(b,function(b,f){a.push({Value:b,DisplayText:f})});return a},_buildOptionsFromArray:function(b){for(var a=[],d=0;d<b.length;d++)c.isPlainObject(b[d])? -a.push(b[d]):a.push({Value:b[d],DisplayText:b[d]});return a},_parseDate:function(b){if(0<=b.indexOf("Date"))return new Date(parseInt(b.substr(6)));if(10==b.length)return new Date(parseInt(b.substr(0,4)),parseInt(b.substr(5,2))-1,parseInt(b.substr(8,2)));if(19==b.length)return new Date(parseInt(b.substr(0,4)),parseInt(b.substr(5,2))-1,parseInt(b.substr(8,2)),parseInt(b.substr(11,2)),parseInt(b.substr(14,2)),parseInt(b.substr(17,2)));this._logWarn("Given date is not properly formatted: "+b);return"format error!"}, -_createToolBar:function(){this._$toolbarDiv=c("<div />").addClass("jtable-toolbar").appendTo(this._$titleDiv);for(var b=0;b<this.options.toolbar.items.length;b++)this._addToolBarItem(this.options.toolbar.items[b])},_addToolBarItem:function(b){if(void 0==b||void 0==b.text&&void 0==b.icon)return this._logWarn("Can not add tool bar item since it is not valid!"),this._logWarn(b),null;var a=c("<span></span>").addClass("jtable-toolbar-item").appendTo(this._$toolbarDiv);b.cssClass&&a.addClass(b.cssClass); -b.tooltip&&a.attr("title",b.tooltip);if(b.icon){var d=c('<span class="jtable-toolbar-item-icon"></span>').appendTo(a);!0!==b.icon&&c.type("string"===b.icon)&&d.css("background",'url("'+b.icon+'")')}b.text&&c('<span class=""></span>').html(b.text).addClass("jtable-toolbar-item-text").appendTo(a);b.click&&a.click(function(){b.click()});var f=void 0,g=void 0;this.options.toolbar.hoverAnimation&&(f=this.options.toolbar.hoverAnimationDuration,g=this.options.toolbar.hoverAnimationEasing);a.hover(function(){a.addClass("jtable-toolbar-item-hover", -f,g)},function(){a.removeClass("jtable-toolbar-item-hover",f,g)});return a},_showError:function(b){this._$errorDialogDiv.html(b).dialog("open")},_setBusyTimer:null,_showBusy:function(b,a){var d=this,f=function(){d._$busyMessageDiv.is(":visible")||(d._$busyDiv.width(d._$mainContainer.width()),d._$busyDiv.height(d._$mainContainer.height()),d._$busyDiv.show(),d._$busyMessageDiv.show());d._$busyMessageDiv.html(b)};a?d._setBusyTimer=setTimeout(f,a):f()},_hideBusy:function(){clearTimeout(this._setBusyTimer); -this._$busyDiv.hide();this._$busyMessageDiv.html("").hide()},_isBusy:function(){return this._$busyMessageDiv.is(":visible")},_performAjaxCall:function(b,a,d,f,g){this._ajax({url:b,data:a,async:d,success:f,error:g})},_ajax:function(b){var a=c.extend({},this.options.ajaxSettings,b);a.success=function(a){b.success&&b.success(a)};a.error=function(){b.error&&b.error()};a.complete=function(){b.complete&&b.complete()};c.ajax(a)},_getKeyValueOfRecord:function(b){return b[this._keyField]},_onLoadingRecords:function(){this._trigger("loadingRecords", -null,{})},_onRecordsLoaded:function(b){this._trigger("recordsLoaded",null,{records:b.Records,serverResponse:b})},_onRowInserted:function(b,a){this._trigger("rowInserted",null,{row:b,record:b.data("record"),isNewRow:a})},_onRowsRemoved:function(b,a){this._trigger("rowsRemoved",null,{rows:b,reason:a})},_onCloseRequested:function(){this._trigger("closeRequested",null,{})}})})(jQuery); -(function(c){c.extend(!0,c.hik.jtable.prototype,{_getPropertyOfObject:function(b,a){if(0>a.indexOf("."))return b[a];var d=a.substring(0,a.indexOf(".")),f=a.substring(a.indexOf(".")+1);return this._getPropertyOfObject(b[d],f)},_setPropertyOfObject:function(b,a,d){if(0>a.indexOf("."))b[a]=d;else{var f=a.substring(0,a.indexOf("."));a=a.substring(a.indexOf(".")+1);this._setPropertyOfObject(b[f],a,d)}},_insertToArrayIfDoesNotExists:function(b,a){0>c.inArray(a,b)&&b.push(a)},_findIndexInArray:function(b, -a,d){d||(d=function(a,f){return a==f});for(var f=0;f<a.length;f++)if(d(b,a[f]))return f;return-1},_normalizeNumber:function(b,a,d,f){return void 0==b||null==b||isNaN(b)?f:b<a?a:b>d?d:b},_formatString:function(){if(0==arguments.length)return null;for(var b=arguments[0],a=1;a<arguments.length;a++)b=b.replace("{"+(a-1)+"}",arguments[a]);return b},_logDebug:function(b){window.console&&console.log("jTable DEBUG: "+b)},_logInfo:function(b){window.console&&console.log("jTable INFO: "+b)},_logWarn:function(b){window.console&& -console.log("jTable WARNING: "+b)},_logError:function(b){window.console&&console.log("jTable ERROR: "+b)}});Array.prototype.indexOf||(Array.prototype.indexOf=function(b,a){var d=this.length,f=Number(a)||0,f=0>f?Math.ceil(f):Math.floor(f);for(0>f&&(f+=d);f<d;f++)if(f in this&&this[f]===b)return f;return-1})})(jQuery); -(function(c){c.extend(!0,c.hik.jtable.prototype,{_submitFormUsingAjax:function(b,a,d,f){this._ajax({url:b,data:a,success:d,error:f})},_createInputLabelForRecordField:function(b){return c("<div />").addClass("jtable-input-label").html(this.options.fields[b].title)},_createInputForRecordField:function(b){var a=b.fieldName,d=b.value,f=b.record,g=b.formType;b=b.form;var e=this.options.fields[a];if(void 0==d||null==d)d=e.defaultValue;return e.input?(d=c(e.input({value:d,record:f,formType:g,form:b})),d.attr("id")|| -d.attr("id","Edit-"+a),c("<div />").addClass("jtable-input jtable-custom-input").append(d)):"date"==e.type?this._createDateInputForField(e,a,d):"textarea"==e.type?this._createTextAreaForField(e,a,d):"password"==e.type?this._createPasswordInputForField(e,a,d):"checkbox"==e.type?this._createCheckboxForField(e,a,d):e.options?"radiobutton"==e.type?this._createRadioButtonListForField(e,a,d,f,g):this._createDropDownListForField(e,a,d,f,g,b):this._createTextInputForField(e,a,d)},_createInputForHidden:function(b, -a){void 0==a&&(a="");return c('<input type="hidden" name="'+b+'" id="Edit-'+b+'"></input>').val(a)},_createDateInputForField:function(b,a,d){a=c('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="text" name="'+a+'"></input>');void 0!=d&&a.val(d);a.datepicker({dateFormat:b.displayFormat||this.options.defaultDateFormat});return c("<div />").addClass("jtable-input jtable-date-input").append(a)},_createTextAreaForField:function(b,a,d){b=c('<textarea class="'+b.inputClass+'" id="Edit-'+a+'" name="'+ -a+'"></textarea>');void 0!=d&&b.val(d);return c("<div />").addClass("jtable-input jtable-textarea-input").append(b)},_createTextInputForField:function(b,a,d){b=c('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="text" name="'+a+'"></input>');void 0!=d&&b.val(d);return c("<div />").addClass("jtable-input jtable-text-input").append(b)},_createPasswordInputForField:function(b,a,d){b=c('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="password" name="'+a+'"></input>');void 0!=d&&b.val(d);return c("<div />").addClass("jtable-input jtable-password-input").append(b)}, -_createCheckboxForField:function(b,a,d){var f=this;void 0==d&&(d=f._getCheckBoxPropertiesForFieldByState(a,!1).Value);var g=c("<div />").addClass("jtable-input jtable-checkbox-input"),e=c('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="checkbox" name="'+a+'" />').appendTo(g);void 0!=d&&e.val(d);var j=c("<span>"+(b.formText||f._getCheckBoxTextForFieldByValue(a,d))+"</span>").appendTo(g);f._getIsCheckBoxSelectedForFieldByValue(a,d)&&e.attr("checked","checked");var k=function(){var g=f._getCheckBoxPropertiesForFieldByState(a, -e.is(":checked"));e.attr("value",g.Value);j.html(b.formText||g.DisplayText)};e.click(function(){k()});!1!=b.setOnTextClick&&j.addClass("jtable-option-text-clickable").click(function(){e.is(":checked")?e.attr("checked",!1):e.attr("checked",!0);k()});return g},_createDropDownListForField:function(b,a,d,f,g,e){var j=c("<div />").addClass("jtable-input jtable-dropdown-input"),k=c('<select class="'+b.inputClass+'" id="Edit-'+a+'" name="'+a+'"></select>').appendTo(j);b=this._getOptionsForField(a,{record:f, -source:g,form:e,dependedValues:this._createDependedValuesUsingForm(e,b.dependsOn)});this._fillDropDownListWithOptions(k,b,d);return j},_fillDropDownListWithOptions:function(b,a,d){b.empty();for(var f=0;f<a.length;f++)c("<option"+(a[f].Value==d?' selected="selected"':"")+">"+a[f].DisplayText+"</option>").val(a[f].Value).appendTo(b)},_createDependedValuesUsingForm:function(b,a){if(!a)return{};for(var d={},f=0;f<a.length;f++){var g=a[f],e=b.find("select[name="+g+"]");0>=e.length||(d[g]=e.val())}return d}, -_createRadioButtonListForField:function(b,a,d,f,g){var e=c("<div />").addClass("jtable-input jtable-radiobuttonlist-input");f=this._getOptionsForField(a,{record:f,source:g});c.each(f,function(f,g){var h=c('<div class=""></div>').addClass("jtable-radio-input").appendTo(e),l=c('<input type="radio" id="Edit-'+a+"-"+f+'" class="'+b.inputClass+'" name="'+a+'"'+(g.Value==d+""?' checked="true"':"")+" />").val(g.Value).appendTo(h),h=c("<span></span>").html(g.DisplayText).appendTo(h);!1!=b.setOnTextClick&& -h.addClass("jtable-option-text-clickable").click(function(){l.is(":checked")||l.attr("checked",!0)})});return e},_getCheckBoxTextForFieldByValue:function(b,a){return this.options.fields[b].values[a]},_getIsCheckBoxSelectedForFieldByValue:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[1].Value.toString()==a.toString()},_getCheckBoxPropertiesForFieldByState:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[a?1:0]},_createCheckBoxStateArrayForFieldWithCaching:function(b){var a= -"checkbox_"+b;this._cache[a]||(this._cache[a]=this._createCheckBoxStateArrayForField(b));return this._cache[a]},_createCheckBoxStateArrayForField:function(b){var a=[],d=0;c.each(this.options.fields[b].values,function(f,b){2>d++&&a.push({Value:f,DisplayText:b})});return a},_makeCascadeDropDowns:function(b,a,d){var f=this;b.find("select").each(function(){var g=c(this),e=g.attr("name");if(e){var j=f.options.fields[e];j.dependsOn&&c.each(j.dependsOn,function(c,h){b.find("select[name="+h+"]").change(function(){var c= -{record:a,source:d,form:b,dependedValues:{}};c.dependedValues=f._createDependedValuesUsingForm(b,j.dependsOn);c=f._getOptionsForField(e,c);f._fillDropDownListWithOptions(g,c,void 0);g.change()})})}})},_updateRecordValuesFromForm:function(b,a){for(var d=0;d<this._fieldList.length;d++){var f=this._fieldList[d],g=this.options.fields[f];if(!1!=g.edit){var e=a.find('[name="'+f+'"]');if(!(0>=e.length))if("date"==g.type)if(e=e.val()){g=g.displayFormat||this.options.defaultDateFormat;try{var j=c.datepicker.parseDate(g, -e);b[f]="/Date("+j.getTime()+")/"}catch(k){this._logWarn("Date format is incorrect for field "+f+": "+e),b[f]=void 0}}else this._logDebug("Date is empty for "+f),b[f]=void 0;else g.options&&"radiobutton"==g.type?(g=e.filter(":checked"),b[f]=g.length?g.val():void 0):b[f]=e.val()}}},_setEnabledOfDialogButton:function(b,a,d){b&&(!1!=a?b.removeAttr("disabled").removeClass("ui-state-disabled"):b.attr("disabled","disabled").addClass("ui-state-disabled"),d&&b.find("span").text(d))}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._create;c.extend(!0,c.hik.jtable.prototype,{options:{recordAdded:function(){},messages:{addNewRecord:"Add new record"}},_$addRecordDiv:null,_create:function(){b.apply(this,arguments);this._createAddRecordDialogDiv()},_createAddRecordDialogDiv:function(){var a=this;a.options.actions.createAction&&(a._$addRecordDiv=c("<div />").appendTo(a._$mainContainer),a._$addRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,width:"auto", -minWidth:"300",modal:!0,title:a.options.messages.addNewRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$addRecordDiv.dialog("close")}},{id:"AddRecordDialogSaveButton",text:a.options.messages.save,click:function(){var b=c("#AddRecordDialogSaveButton"),f=a._$addRecordDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:f,formType:"create"})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveAddRecordForm(f,b))}}],close:function(){var b=a._$addRecordDiv.find("form").first(), -f=c("#AddRecordDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"create"});a._setEnabledOfDialogButton(f,!0,a.options.messages.save);b.remove()}}),a.options.addRecordButton?a.options.addRecordButton.click(function(b){b.preventDefault();a._showAddRecordForm()}):a._addToolBarItem({icon:!0,cssClass:"jtable-toolbar-item-add-record",text:a.options.messages.addNewRecord,click:function(){a._showAddRecordForm()}}))},showCreateForm:function(){this._showAddRecordForm()},addRecord:function(a){var b= -this;a=c.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.createAction,success:function(){},error:function(){}},a);a.record?a.clientOnly?(b._addRow(b._createRowFromRecord(a.record),{isNewRow:!0,animationsEnabled:a.animationsEnabled}),a.success()):b._submitFormUsingAjax(a.url,c.param(a.record),function(f){"OK"!=f.Result?(b._showError(f.Message),a.error(f)):f.Record?(b._onRecordAdded(f),b._addRow(b._createRowFromRecord(f.Record),{isNewRow:!0,animationsEnabled:a.animationsEnabled}), -a.success(f)):(b._logError("Server must return the created Record object."),a.error(f))},function(){b._showError(b.options.messages.serverCommunicationError);a.error()}):b._logWarn("options parameter in addRecord method must contain a record property.")},_showAddRecordForm:function(){for(var a=c('<form id="jtable-create-form" class="jtable-dialog-form jtable-create-form" action="'+this.options.actions.createAction+'" method="POST"></form>'),b=0;b<this._fieldList.length;b++){var f=this._fieldList[b], -g=this.options.fields[f];!(!0==g.key&&!0!=g.create)&&!1!=g.create&&("hidden"==g.type?a.append(this._createInputForHidden(f,g.defaultValue)):(g=c("<div />").addClass("jtable-input-field-container").appendTo(a),g.append(this._createInputLabelForRecordField(f)),g.append(this._createInputForRecordField({fieldName:f,formType:"create",form:a}))))}this._makeCascadeDropDowns(a,void 0,"create");this._$addRecordDiv.append(a).dialog("open");this._trigger("formCreated",null,{form:a,formType:"create"})},_saveAddRecordForm:function(a, -b){var f=this;a.data("submitting",!0);f._submitFormUsingAjax(a.attr("action"),a.serialize(),function(a){"OK"!=a.Result?(f._showError(a.Message),f._setEnabledOfDialogButton(b,!0,f.options.messages.save)):a.Record?(f._onRecordAdded(a),f._addRow(f._createRowFromRecord(a.Record),{isNewRow:!0}),f._$addRecordDiv.dialog("close")):(f._logError("Server must return the created Record object."),f._setEnabledOfDialogButton(b,!0,f.options.messages.save))},function(){f._showError(f.options.messages.serverCommunicationError); -f._setEnabledOfDialogButton(b,!0,f.options.messages.save)})},_onRecordAdded:function(a){this._trigger("recordAdded",null,{record:a.Record,serverResponse:a})}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._create,a=c.hik.jtable.prototype._addColumnsToHeaderRow,d=c.hik.jtable.prototype._addCellsToRowUsingRecord;c.extend(!0,c.hik.jtable.prototype,{options:{recordUpdated:function(){},rowUpdated:function(){},messages:{editRecord:"Edit Record"}},_$editDiv:null,_$editingRow:null,_create:function(){b.apply(this,arguments);this._createEditDialogDiv()},_createEditDialogDiv:function(){var a=this;a._$editDiv=c("<div></div>").appendTo(a._$mainContainer);a._$editDiv.dialog({autoOpen:!1, -show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,width:"auto",minWidth:"300",modal:!0,title:a.options.messages.editRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$editDiv.dialog("close")}},{id:"EditDialogSaveButton",text:a.options.messages.save,click:function(){if(a._$editingRow.hasClass("jtable-row-removed"))a._$editDiv.dialog("close");else{var b=a._$editDiv.find("#EditDialogSaveButton"),e=a._$editDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:e,formType:"edit", -row:a._$editingRow})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveEditForm(e,b))}}}],close:function(){var b=a._$editDiv.find("form:first"),e=c("#EditDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"edit",row:a._$editingRow});a._setEnabledOfDialogButton(e,!0,a.options.messages.save);b.remove()}})},updateRecord:function(a){var b=this;a=c.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.updateAction,success:function(){}, -error:function(){}},a);if(a.record){var e=b._getKeyValueOfRecord(a.record);if(void 0==e||null==e)b._logWarn("options parameter in updateRecord method must contain a record that contains the key field property.");else{var j=b.getRowByKey(e);null==j?b._logWarn("Can not found any row by key: "+e):a.clientOnly?(c.extend(j.data("record"),a.record),b._updateRowTexts(j),b._onRecordUpdated(j,null),a.animationsEnabled&&b._showUpdateAnimationForRow(j),a.success()):b._submitFormUsingAjax(a.url,c.param(a.record), -function(e){"OK"!=e.Result?(b._showError(e.Message),a.error(e)):(c.extend(j.data("record"),a.record),b._updateRecordValuesFromServerResponse(j.data("record"),e),b._updateRowTexts(j),b._onRecordUpdated(j,e),a.animationsEnabled&&b._showUpdateAnimationForRow(j),a.success(e))},function(){b._showError(b.options.messages.serverCommunicationError);a.error()})}}else b._logWarn("options parameter in updateRecord method must contain a record property.")},_addColumnsToHeaderRow:function(b){a.apply(this,arguments); -void 0!=this.options.actions.updateAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){var b=this;d.apply(this,arguments);if(void 0!=b.options.actions.updateAction){var e=c("<span></span>").html(b.options.messages.editRecord),e=c('<button title="'+b.options.messages.editRecord+'"></button>').addClass("jtable-command-button jtable-edit-command-button").append(e).click(function(e){e.preventDefault();e.stopPropagation();b._showEditForm(a)});c("<td></td>").addClass("jtable-command-column").append(e).appendTo(a)}}, -_showEditForm:function(a){for(var b=a.data("record"),e=c('<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form" action="'+this.options.actions.updateAction+'" method="POST"></form>'),d=0;d<this._fieldList.length;d++){var k=this._fieldList[d],h=this.options.fields[k],l=b[k];if(!0==h.key)if(!0!=h.edit){e.append(this._createInputForHidden(k,l));continue}else e.append(this._createInputForHidden("jtRecordKey",l));!1!=h.edit&&("hidden"==h.type?e.append(this._createInputForHidden(k,l)): -(h=c('<div class="jtable-input-field-container"></div>').appendTo(e),h.append(this._createInputLabelForRecordField(k)),l=this._getValueForRecordField(b,k),h.append(this._createInputForRecordField({fieldName:k,value:l,record:b,formType:"edit",form:e}))))}this._makeCascadeDropDowns(e,b,"edit");this._$editingRow=a;this._$editDiv.append(e).dialog("open");this._trigger("formCreated",null,{form:e,formType:"edit",record:b,row:a})},_saveEditForm:function(a,b){var e=this;e._submitFormUsingAjax(a.attr("action"), -a.serialize(),function(c){if("OK"!=c.Result)e._showError(c.Message),e._setEnabledOfDialogButton(b,!0,e.options.messages.save);else{var d=e._$editingRow.data("record");e._updateRecordValuesFromForm(d,a);e._updateRecordValuesFromServerResponse(d,c);e._updateRowTexts(e._$editingRow);e._$editingRow.attr("data-record-key",e._getKeyValueOfRecord(d));e._onRecordUpdated(e._$editingRow,c);e.options.animationsEnabled&&e._showUpdateAnimationForRow(e._$editingRow);e._$editDiv.dialog("close")}},function(){e._showError(e.options.messages.serverCommunicationError); -e._setEnabledOfDialogButton(b,!0,e.options.messages.save)})},_updateRecordValuesFromServerResponse:function(a,b){b&&b.Record&&c.extend(!0,a,b.Record)},_getValueForRecordField:function(a,b){var e=this.options.fields[b],c=a[b];return"date"==e.type?this._getDisplayTextForDateRecordField(e,c):c},_updateRowTexts:function(a){for(var b=a.data("record"),e=a.find("td"),c=0;c<this._columnList.length;c++){var d=this._getDisplayTextForRecordField(b,this._columnList[c]);e.eq(this._firstDataColumnOffset+c).html(d|| +_$errorDialogDiv:null,_columnList:null,_fieldList:null,_keyField:null,_firstDataColumnOffset:0,_lastPostData:null,_cache:null,_create:function(){this._normalizeFieldsOptions();this._initializeFields();this._createFieldAndColumnList();this._createMainContainer();this._createTableTitle();this._createToolBar();this._createTable();this._createBusyPanel();this._createErrorDialogDiv();this._addNoDataRow();this._cookieKeyPrefix=this._generateCookieKeyPrefix()},_normalizeFieldsOptions:function(){var b=this; +d.each(b.options.fields,function(a,c){b._normalizeFieldOptions(a,c)})},_normalizeFieldOptions:function(b,a){void 0==a.listClass&&(a.listClass="");void 0==a.inputClass&&(a.inputClass="");if(a.dependsOn&&"string"===d.type(a.dependsOn)){var c=a.dependsOn.split(",");a.dependsOn=[];for(var e=0;e<c.length;e++)a.dependsOn.push(d.trim(c[e]))}},_initializeFields:function(){this._lastPostData={};this._$tableRows=[];this._columnList=[];this._fieldList=[];this._cache=[]},_createFieldAndColumnList:function(){var b= +this;d.each(b.options.fields,function(a,c){b._fieldList.push(a);!0==c.key&&(b._keyField=a);!1!=c.list&&"hidden"!=c.type&&b._columnList.push(a)})},_createMainContainer:function(){this._$mainContainer=d("<div />").addClass("jtable-main-container").appendTo(this.element)},_createTableTitle:function(){var b=this;if(b.options.title){var a=d("<div />").addClass("jtable-title").appendTo(b._$mainContainer);d("<div />").addClass("jtable-title-text").appendTo(a).append(b.options.title);if(b.options.showCloseButton){var c= +d("<span />").html(b.options.messages.close);d("<button></button>").addClass("jtable-command-button jtable-close-button").attr("title",b.options.messages.close).append(c).appendTo(a).click(function(a){a.preventDefault();a.stopPropagation();b._onCloseRequested()})}b._$titleDiv=a}},_createTable:function(){this._$table=d("<table></table>").addClass("jtable").appendTo(this._$mainContainer);this._createTableHead();this._createTableBody()},_createTableHead:function(){var b=d("<thead></thead>").appendTo(this._$table); +this._addRowToTableHead(b)},_addRowToTableHead:function(b){b=d("<tr></tr>").appendTo(b);this._addColumnsToHeaderRow(b)},_addColumnsToHeaderRow:function(b){for(var a=0;a<this._columnList.length;a++){var c=this._columnList[a];this._createHeaderCellForField(c,this.options.fields[c]).appendTo(b)}},_createHeaderCellForField:function(b,a){a.width=a.width||"10%";var c=d("<span />").addClass("jtable-column-header-text").html(a.title),c=d("<div />").addClass("jtable-column-header-container").append(c);return d("<th></th>").addClass("jtable-column-header").css("width", +a.width).data("fieldName",b).append(c)},_createEmptyCommandHeader:function(){return d("<th></th>").addClass("jtable-command-column-header").css("width","1%")},_createTableBody:function(){this._$tableBody=d("<tbody></tbody>").appendTo(this._$table)},_createBusyPanel:function(){this._$busyMessageDiv=d("<div />").addClass("jtable-busy-message").prependTo(this._$mainContainer);this._$busyDiv=d("<div />").addClass("jtable-busy-panel-background").prependTo(this._$mainContainer);this._hideBusy()},_createErrorDialogDiv:function(){var b= +this;b._$errorDialogDiv=d("<div></div>").appendTo(b._$mainContainer);b._$errorDialogDiv.dialog({autoOpen:!1,show:b.options.dialogShowEffect,hide:b.options.dialogHideEffect,modal:!0,title:b.options.messages.error,buttons:[{text:b.options.messages.close,click:function(){b._$errorDialogDiv.dialog("close")}}]})},load:function(b,a){this._lastPostData=b;this._reloadTable(a)},reload:function(b){this._reloadTable(b)},getRowByKey:function(b){for(var a=0;a<this._$tableRows.length;a++)if(b==this._getKeyValueOfRecord(this._$tableRows[a].data("record")))return this._$tableRows[a]; +return null},destroy:function(){this.element.empty();d.Widget.prototype.destroy.call(this)},_setOption:function(){},_reloadTable:function(b){var a=this;a._showBusy(a.options.messages.loadingMessage,a.options.loadingAnimationDelay);var c=a._createRecordLoadUrl();a._onLoadingRecords();a._ajax({url:c,data:a._lastPostData,success:function(e){a._hideBusy();"OK"!=e.Result?a._showError(e.Message):(a._removeAllRows("reloading"),a._addRecordsToTable(e.Records),a._onRecordsLoaded(e),b&&b())},error:function(){a._hideBusy(); +a._showError(a.options.messages.serverCommunicationError)}})},_createRecordLoadUrl:function(){return this.options.actions.listAction},_createRowFromRecord:function(b){b=d("<tr></tr>").addClass("jtable-data-row").attr("data-record-key",this._getKeyValueOfRecord(b)).data("record",b);this._addCellsToRowUsingRecord(b);return b},_addCellsToRowUsingRecord:function(b){for(var a=b.data("record"),c=0;c<this._columnList.length;c++)this._createCellForRecordField(a,this._columnList[c]).appendTo(b)},_createCellForRecordField:function(b, +a){return d("<td></td>").addClass(this.options.fields[a].listClass).append(this._getDisplayTextForRecordField(b,a))},_addRecordsToTable:function(b){var a=this;d.each(b,function(b,e){a._addRow(a._createRowFromRecord(e))});a._refreshRowStyles()},_addRowToTable:function(b,a,c,e){a={index:this._normalizeNumber(a,0,this._$tableRows.length,this._$tableRows.length)};!0==c&&(a.isNewRow=!0);!1==e&&(a.animationsEnabled=!1);this._addRow(b,a)},_addRow:function(b,a){a=d.extend({index:this._$tableRows.length,isNewRow:!1, +animationsEnabled:!0},a);0>=this._$tableRows.length&&this._removeNoDataRow();a.index=this._normalizeNumber(a.index,0,this._$tableRows.length,this._$tableRows.length);a.index==this._$tableRows.length?(this._$tableBody.append(b),this._$tableRows.push(b)):0==a.index?(this._$tableBody.prepend(b),this._$tableRows.unshift(b)):(this._$tableRows[a.index-1].after(b),this._$tableRows.splice(a.index,0,b));this._onRowInserted(b,a.isNewRow);a.isNewRow&&(this._refreshRowStyles(),this.options.animationsEnabled&& +a.animationsEnabled&&this._showNewRowAnimation(b))},_showNewRowAnimation:function(b){b.addClass("jtable-row-created","slow","",function(){b.removeClass("jtable-row-created",5E3)})},_removeRowsFromTable:function(b,a){var c=this;0>=b.length||(b.addClass("jtable-row-removed").remove(),b.each(function(){var a=c._findRowIndex(d(this));0<=a&&c._$tableRows.splice(a,1)}),c._onRowsRemoved(b,a),0==c._$tableRows.length&&c._addNoDataRow(),c._refreshRowStyles())},_findRowIndex:function(b){return this._findIndexInArray(b, +this._$tableRows,function(a,b){return a.data("record")==b.data("record")})},_removeAllRows:function(b){if(!(0>=this._$tableRows.length)){var a=this._$tableBody.find("tr.jtable-data-row");this._$tableBody.empty();this._$tableRows=[];this._onRowsRemoved(a,b);this._addNoDataRow()}},_addNoDataRow:function(){if(!(0<this._$tableBody.find(">tr.jtable-no-data-row").length)){var b=d("<tr></tr>").addClass("jtable-no-data-row").appendTo(this._$tableBody),a=this._$table.find("thead th").length;d("<td></td>").attr("colspan", +a).html(this.options.messages.noDataAvailable).appendTo(b)}},_removeNoDataRow:function(){this._$tableBody.find(".jtable-no-data-row").remove()},_refreshRowStyles:function(){for(var b=0;b<this._$tableRows.length;b++)0==b%2?this._$tableRows[b].addClass("jtable-row-even"):this._$tableRows[b].removeClass("jtable-row-even")},_getDisplayTextForRecordField:function(b,a){var c=this.options.fields[a],e=b[a];return c.display?c.display({record:b}):"date"==c.type?this._getDisplayTextForDateRecordField(c,e):"checkbox"== +c.type?this._getCheckBoxTextForFieldByValue(a,e):c.options?(c=this._getOptionsForField(a,{record:b,value:e,source:"list",dependedValues:this._createDependedValuesUsingRecord(b,c.dependsOn)}),this._findOptionByValue(c,e).DisplayText):e},_createDependedValuesUsingRecord:function(b,a){if(!a)return{};for(var c={},e=0;e<a.length;e++)c[a[e]]=b[a[e]];return c},_findOptionByValue:function(b,a){for(var c=0;c<b.length;c++)if(b[c].Value==a)return b[c];return{}},_getDisplayTextForDateRecordField:function(b,a){if(!a)return""; +var c=b.displayFormat||this.options.defaultDateFormat,e=this._parseDate(a);return d.datepicker.formatDate(c,e)},_getOptionsForField:function(b,a){var c=this.options.fields[b],e=c.options;d.isFunction(e)&&(a=d.extend(!0,{_cacheCleared:!1,dependedValues:{},clearCache:function(){this._cacheCleared=!0}},a),e=e(a));if("string"==typeof e){var g="options_"+b+"_"+e;a._cacheCleared||!this._cache[g]?(this._cache[g]=this._buildOptionsFromArray(this._downloadOptions(b,e)),this._sortFieldOptions(this._cache[g], +c.optionsSorting)):void 0!=a.value&&void 0==this._findOptionByValue(this._cache[g],a.value).DisplayText&&(this._cache[g]=this._buildOptionsFromArray(this._downloadOptions(b,e)),this._sortFieldOptions(this._cache[g],c.optionsSorting));e=this._cache[g]}else e=jQuery.isArray(e)?this._buildOptionsFromArray(e):this._buildOptionsArrayFromObject(e),this._sortFieldOptions(e,c.optionsSorting);return e},_downloadOptions:function(b,a){var c=this,e=[];c._ajax({url:a,async:!1,success:function(a){"OK"!=a.Result? +c._showError(a.Message):e=a.Options},error:function(){var a=c._formatString(c.options.messages.cannotLoadOptionsFor,b);c._showError(a)}});return e},_sortFieldOptions:function(b,a){if(b&&b.length&&a){var c;c=0==a.indexOf("value")?function(a){return a.Value}:function(a){return a.DisplayText};var e;e="string"==d.type(c(b[0]))?function(a,b){return c(a).localeCompare(c(b))}:function(a,b){return c(a)-c(b)};0<a.indexOf("desc")?b.sort(function(a,b){return e(b,a)}):b.sort(function(a,b){return e(a,b)})}},_buildOptionsArrayFromObject:function(b){var a= +[];d.each(b,function(b,e){a.push({Value:b,DisplayText:e})});return a},_buildOptionsFromArray:function(b){for(var a=[],c=0;c<b.length;c++)d.isPlainObject(b[c])?a.push(b[c]):a.push({Value:b[c],DisplayText:b[c]});return a},_parseDate:function(b){if(0<=b.indexOf("Date"))return new Date(parseInt(b.substr(6),10));if(10==b.length)return new Date(parseInt(b.substr(0,4),10),parseInt(b.substr(5,2),10)-1,parseInt(b.substr(8,2),10));if(19==b.length)return new Date(parseInt(b.substr(0,4),10),parseInt(b.substr(5, +2),10)-1,parseInt(b.substr(8,2,10)),parseInt(b.substr(11,2),10),parseInt(b.substr(14,2),10),parseInt(b.substr(17,2),10));this._logWarn("Given date is not properly formatted: "+b);return"format error!"},_createToolBar:function(){this._$toolbarDiv=d("<div />").addClass("jtable-toolbar").appendTo(this._$titleDiv);for(var b=0;b<this.options.toolbar.items.length;b++)this._addToolBarItem(this.options.toolbar.items[b])},_addToolBarItem:function(b){if(void 0==b||void 0==b.text&&void 0==b.icon)return this._logWarn("Can not add tool bar item since it is not valid!"), +this._logWarn(b),null;var a=d("<span></span>").addClass("jtable-toolbar-item").appendTo(this._$toolbarDiv);b.cssClass&&a.addClass(b.cssClass);b.tooltip&&a.attr("title",b.tooltip);if(b.icon){var c=d('<span class="jtable-toolbar-item-icon"></span>').appendTo(a);!0!==b.icon&&d.type("string"===b.icon)&&c.css("background",'url("'+b.icon+'")')}b.text&&d('<span class=""></span>').html(b.text).addClass("jtable-toolbar-item-text").appendTo(a);b.click&&a.click(function(){b.click()});var e=void 0,g=void 0;this.options.toolbar.hoverAnimation&& +(e=this.options.toolbar.hoverAnimationDuration,g=this.options.toolbar.hoverAnimationEasing);a.hover(function(){a.addClass("jtable-toolbar-item-hover",e,g)},function(){a.removeClass("jtable-toolbar-item-hover",e,g)});return a},_showError:function(b){this._$errorDialogDiv.html(b).dialog("open")},_setBusyTimer:null,_showBusy:function(b,a){var c=this,e=function(){c._$busyMessageDiv.is(":visible")||(c._$busyDiv.width(c._$mainContainer.width()),c._$busyDiv.height(c._$mainContainer.height()),c._$busyDiv.show(), +c._$busyMessageDiv.show());c._$busyMessageDiv.html(b)};a?c._setBusyTimer=setTimeout(e,a):e()},_hideBusy:function(){clearTimeout(this._setBusyTimer);this._$busyDiv.hide();this._$busyMessageDiv.html("").hide()},_isBusy:function(){return this._$busyMessageDiv.is(":visible")},_performAjaxCall:function(b,a,c,e,g){this._ajax({url:b,data:a,async:c,success:e,error:g})},_ajax:function(b){var a=d.extend({},this.options.ajaxSettings,b);a.success=function(a){b.success&&b.success(a)};a.error=function(){b.error&& +b.error()};a.complete=function(){b.complete&&b.complete()};d.ajax(a)},_getKeyValueOfRecord:function(b){return b[this._keyField]},_setCookie:function(b,a){b=this._cookieKeyPrefix+b;var c=new Date;c.setDate(c.getDate()+30);document.cookie=encodeURIComponent(b)+"="+encodeURIComponent(a)+"; expires="+c.toUTCString()},_getCookie:function(b){b=this._cookieKeyPrefix+b;for(var a=document.cookie.split("; "),c=0;c<a.length;c++)if(a[c]){var e=a[c].split("=");if(2==e.length&&decodeURIComponent(e[0])===b)return decodeURIComponent(e[1]|| +"")}return null},_generateCookieKeyPrefix:function(){var b="";this.options.tableId&&(b=b+this.options.tableId+"#");b=b+this._columnList.join("$")+"#c"+this._$table.find("thead th").length;var a=0;if(0!=b.length)for(var c=0;c<b.length;c++)var e=b.charCodeAt(c),a=(a<<5)-a+e,a=a&a;return"jtable#"+a},_onLoadingRecords:function(){this._trigger("loadingRecords",null,{})},_onRecordsLoaded:function(b){this._trigger("recordsLoaded",null,{records:b.Records,serverResponse:b})},_onRowInserted:function(b,a){this._trigger("rowInserted", +null,{row:b,record:b.data("record"),isNewRow:a})},_onRowsRemoved:function(b,a){this._trigger("rowsRemoved",null,{rows:b,reason:a})},_onCloseRequested:function(){this._trigger("closeRequested",null,{})}})})(jQuery); +(function(d){d.extend(!0,d.hik.jtable.prototype,{_getPropertyOfObject:function(b,a){if(0>a.indexOf("."))return b[a];var c=a.substring(0,a.indexOf(".")),e=a.substring(a.indexOf(".")+1);return this._getPropertyOfObject(b[c],e)},_setPropertyOfObject:function(b,a,c){if(0>a.indexOf("."))b[a]=c;else{var e=a.substring(0,a.indexOf("."));a=a.substring(a.indexOf(".")+1);this._setPropertyOfObject(b[e],a,c)}},_insertToArrayIfDoesNotExists:function(b,a){0>d.inArray(a,b)&&b.push(a)},_findIndexInArray:function(b, +a,c){c||(c=function(a,b){return a==b});for(var e=0;e<a.length;e++)if(c(b,a[e]))return e;return-1},_normalizeNumber:function(b,a,c,e){return void 0==b||null==b||isNaN(b)?e:b<a?a:b>c?c:b},_formatString:function(){if(0==arguments.length)return null;for(var b=arguments[0],a=1;a<arguments.length;a++)b=b.replace("{"+(a-1)+"}",arguments[a]);return b},_logDebug:function(b){window.console&&console.log("jTable DEBUG: "+b)},_logInfo:function(b){window.console&&console.log("jTable INFO: "+b)},_logWarn:function(b){window.console&& +console.log("jTable WARNING: "+b)},_logError:function(b){window.console&&console.log("jTable ERROR: "+b)}});Array.prototype.indexOf||(Array.prototype.indexOf=function(b,a){var c=this.length,e=Number(a)||0,e=0>e?Math.ceil(e):Math.floor(e);for(0>e&&(e+=c);e<c;e++)if(e in this&&this[e]===b)return e;return-1})})(jQuery); +(function(d){d.extend(!0,d.hik.jtable.prototype,{_submitFormUsingAjax:function(b,a,c,e){this._ajax({url:b,data:a,success:c,error:e})},_createInputLabelForRecordField:function(b){return d("<div />").addClass("jtable-input-label").html(this.options.fields[b].title)},_createInputForRecordField:function(b){var a=b.fieldName,c=b.value,e=b.record,g=b.formType;b=b.form;var f=this.options.fields[a];if(void 0==c||null==c)c=f.defaultValue;return f.input?(c=d(f.input({value:c,record:e,formType:g,form:b})),c.attr("id")|| +c.attr("id","Edit-"+a),d("<div />").addClass("jtable-input jtable-custom-input").append(c)):"date"==f.type?this._createDateInputForField(f,a,c):"textarea"==f.type?this._createTextAreaForField(f,a,c):"password"==f.type?this._createPasswordInputForField(f,a,c):"checkbox"==f.type?this._createCheckboxForField(f,a,c):f.options?"radiobutton"==f.type?this._createRadioButtonListForField(f,a,c,e,g):this._createDropDownListForField(f,a,c,e,g,b):this._createTextInputForField(f,a,c)},_createInputForHidden:function(b, +a){void 0==a&&(a="");return d('<input type="hidden" name="'+b+'" id="Edit-'+b+'"></input>').val(a)},_createDateInputForField:function(b,a,c){a=d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="text" name="'+a+'"></input>');void 0!=c&&a.val(c);a.datepicker({dateFormat:b.displayFormat||this.options.defaultDateFormat});return d("<div />").addClass("jtable-input jtable-date-input").append(a)},_createTextAreaForField:function(b,a,c){b=d('<textarea class="'+b.inputClass+'" id="Edit-'+a+'" name="'+ +a+'"></textarea>');void 0!=c&&b.val(c);return d("<div />").addClass("jtable-input jtable-textarea-input").append(b)},_createTextInputForField:function(b,a,c){b=d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="text" name="'+a+'"></input>');void 0!=c&&b.val(c);return d("<div />").addClass("jtable-input jtable-text-input").append(b)},_createPasswordInputForField:function(b,a,c){b=d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="password" name="'+a+'"></input>');void 0!=c&&b.val(c);return d("<div />").addClass("jtable-input jtable-password-input").append(b)}, +_createCheckboxForField:function(b,a,c){var e=this;void 0==c&&(c=e._getCheckBoxPropertiesForFieldByState(a,!1).Value);var g=d("<div />").addClass("jtable-input jtable-checkbox-input"),f=d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="checkbox" name="'+a+'" />').appendTo(g);void 0!=c&&f.val(c);var j=d("<span>"+(b.formText||e._getCheckBoxTextForFieldByValue(a,c))+"</span>").appendTo(g);e._getIsCheckBoxSelectedForFieldByValue(a,c)&&f.attr("checked","checked");var k=function(){var g=e._getCheckBoxPropertiesForFieldByState(a, +f.is(":checked"));f.attr("value",g.Value);j.html(b.formText||g.DisplayText)};f.click(function(){k()});!1!=b.setOnTextClick&&j.addClass("jtable-option-text-clickable").click(function(){f.is(":checked")?f.attr("checked",!1):f.attr("checked",!0);k()});return g},_createDropDownListForField:function(b,a,c,e,g,f){var j=d("<div />").addClass("jtable-input jtable-dropdown-input"),k=d('<select class="'+b.inputClass+'" id="Edit-'+a+'" name="'+a+'"></select>').appendTo(j);b=this._getOptionsForField(a,{record:e, +source:g,form:f,dependedValues:this._createDependedValuesUsingForm(f,b.dependsOn)});this._fillDropDownListWithOptions(k,b,c);return j},_fillDropDownListWithOptions:function(b,a,c){b.empty();for(var e=0;e<a.length;e++)d("<option"+(a[e].Value==c?' selected="selected"':"")+">"+a[e].DisplayText+"</option>").val(a[e].Value).appendTo(b)},_createDependedValuesUsingForm:function(b,a){if(!a)return{};for(var c={},e=0;e<a.length;e++){var g=a[e],f=b.find("select[name="+g+"]");0>=f.length||(c[g]=f.val())}return c}, +_createRadioButtonListForField:function(b,a,c,e,g){var f=d("<div />").addClass("jtable-input jtable-radiobuttonlist-input");e=this._getOptionsForField(a,{record:e,source:g});d.each(e,function(e,g){var h=d('<div class=""></div>').addClass("jtable-radio-input").appendTo(f),l=d('<input type="radio" id="Edit-'+a+"-"+e+'" class="'+b.inputClass+'" name="'+a+'"'+(g.Value==c+""?' checked="true"':"")+" />").val(g.Value).appendTo(h),h=d("<span></span>").html(g.DisplayText).appendTo(h);!1!=b.setOnTextClick&& +h.addClass("jtable-option-text-clickable").click(function(){l.is(":checked")||l.attr("checked",!0)})});return f},_getCheckBoxTextForFieldByValue:function(b,a){return this.options.fields[b].values[a]},_getIsCheckBoxSelectedForFieldByValue:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[1].Value.toString()==a.toString()},_getCheckBoxPropertiesForFieldByState:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[a?1:0]},_createCheckBoxStateArrayForFieldWithCaching:function(b){var a= +"checkbox_"+b;this._cache[a]||(this._cache[a]=this._createCheckBoxStateArrayForField(b));return this._cache[a]},_createCheckBoxStateArrayForField:function(b){var a=[],c=0;d.each(this.options.fields[b].values,function(b,g){2>c++&&a.push({Value:b,DisplayText:g})});return a},_makeCascadeDropDowns:function(b,a,c){var e=this;b.find("select").each(function(){var g=d(this),f=g.attr("name");if(f){var j=e.options.fields[f];j.dependsOn&&d.each(j.dependsOn,function(d,h){b.find("select[name="+h+"]").change(function(){var d= +{record:a,source:c,form:b,dependedValues:{}};d.dependedValues=e._createDependedValuesUsingForm(b,j.dependsOn);d=e._getOptionsForField(f,d);e._fillDropDownListWithOptions(g,d,void 0);g.change()})})}})},_updateRecordValuesFromForm:function(b,a){for(var c=0;c<this._fieldList.length;c++){var e=this._fieldList[c],g=this.options.fields[e];if(!1!=g.edit){var f=a.find('[name="'+e+'"]');if(!(0>=f.length))if("date"==g.type)if(f=f.val()){g=g.displayFormat||this.options.defaultDateFormat;try{var j=d.datepicker.parseDate(g, +f);b[e]="/Date("+j.getTime()+")/"}catch(k){this._logWarn("Date format is incorrect for field "+e+": "+f),b[e]=void 0}}else this._logDebug("Date is empty for "+e),b[e]=void 0;else g.options&&"radiobutton"==g.type?(g=f.filter(":checked"),b[e]=g.length?g.val():void 0):b[e]=f.val()}}},_setEnabledOfDialogButton:function(b,a,c){b&&(!1!=a?b.removeAttr("disabled").removeClass("ui-state-disabled"):b.attr("disabled","disabled").addClass("ui-state-disabled"),c&&b.find("span").text(c))}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._create;d.extend(!0,d.hik.jtable.prototype,{options:{recordAdded:function(){},messages:{addNewRecord:"Add new record"}},_$addRecordDiv:null,_create:function(){b.apply(this,arguments);this._createAddRecordDialogDiv()},_createAddRecordDialogDiv:function(){var a=this;a.options.actions.createAction&&(a._$addRecordDiv=d("<div />").appendTo(a._$mainContainer),a._$addRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,width:"auto", +minWidth:"300",modal:!0,title:a.options.messages.addNewRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$addRecordDiv.dialog("close")}},{id:"AddRecordDialogSaveButton",text:a.options.messages.save,click:function(){var b=d("#AddRecordDialogSaveButton"),e=a._$addRecordDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:e,formType:"create"})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveAddRecordForm(e,b))}}],close:function(){var b=a._$addRecordDiv.find("form").first(), +e=d("#AddRecordDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"create"});a._setEnabledOfDialogButton(e,!0,a.options.messages.save);b.remove()}}),a.options.addRecordButton?a.options.addRecordButton.click(function(b){b.preventDefault();a._showAddRecordForm()}):a._addToolBarItem({icon:!0,cssClass:"jtable-toolbar-item-add-record",text:a.options.messages.addNewRecord,click:function(){a._showAddRecordForm()}}))},showCreateForm:function(){this._showAddRecordForm()},addRecord:function(a){var b= +this;a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.createAction,success:function(){},error:function(){}},a);a.record?a.clientOnly?(b._addRow(b._createRowFromRecord(a.record),{isNewRow:!0,animationsEnabled:a.animationsEnabled}),a.success()):b._submitFormUsingAjax(a.url,d.param(a.record),function(e){"OK"!=e.Result?(b._showError(e.Message),a.error(e)):e.Record?(b._onRecordAdded(e),b._addRow(b._createRowFromRecord(e.Record),{isNewRow:!0,animationsEnabled:a.animationsEnabled}), +a.success(e)):(b._logError("Server must return the created Record object."),a.error(e))},function(){b._showError(b.options.messages.serverCommunicationError);a.error()}):b._logWarn("options parameter in addRecord method must contain a record property.")},_showAddRecordForm:function(){for(var a=d('<form id="jtable-create-form" class="jtable-dialog-form jtable-create-form" action="'+this.options.actions.createAction+'" method="POST"></form>'),b=0;b<this._fieldList.length;b++){var e=this._fieldList[b], +g=this.options.fields[e];!(!0==g.key&&!0!=g.create)&&!1!=g.create&&("hidden"==g.type?a.append(this._createInputForHidden(e,g.defaultValue)):(g=d("<div />").addClass("jtable-input-field-container").appendTo(a),g.append(this._createInputLabelForRecordField(e)),g.append(this._createInputForRecordField({fieldName:e,formType:"create",form:a}))))}this._makeCascadeDropDowns(a,void 0,"create");this._$addRecordDiv.append(a).dialog("open");this._trigger("formCreated",null,{form:a,formType:"create"})},_saveAddRecordForm:function(a, +b){var e=this;a.data("submitting",!0);e._submitFormUsingAjax(a.attr("action"),a.serialize(),function(a){"OK"!=a.Result?(e._showError(a.Message),e._setEnabledOfDialogButton(b,!0,e.options.messages.save)):a.Record?(e._onRecordAdded(a),e._addRow(e._createRowFromRecord(a.Record),{isNewRow:!0}),e._$addRecordDiv.dialog("close")):(e._logError("Server must return the created Record object."),e._setEnabledOfDialogButton(b,!0,e.options.messages.save))},function(){e._showError(e.options.messages.serverCommunicationError); +e._setEnabledOfDialogButton(b,!0,e.options.messages.save)})},_onRecordAdded:function(a){this._trigger("recordAdded",null,{record:a.Record,serverResponse:a})}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord;d.extend(!0,d.hik.jtable.prototype,{options:{recordUpdated:function(){},rowUpdated:function(){},messages:{editRecord:"Edit Record"}},_$editDiv:null,_$editingRow:null,_create:function(){b.apply(this,arguments);this._createEditDialogDiv()},_createEditDialogDiv:function(){var a=this;a._$editDiv=d("<div></div>").appendTo(a._$mainContainer);a._$editDiv.dialog({autoOpen:!1, +show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,width:"auto",minWidth:"300",modal:!0,title:a.options.messages.editRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$editDiv.dialog("close")}},{id:"EditDialogSaveButton",text:a.options.messages.save,click:function(){if(a._$editingRow.hasClass("jtable-row-removed"))a._$editDiv.dialog("close");else{var b=a._$editDiv.find("#EditDialogSaveButton"),f=a._$editDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:f,formType:"edit", +row:a._$editingRow})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveEditForm(f,b))}}}],close:function(){var b=a._$editDiv.find("form:first"),f=d("#EditDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"edit",row:a._$editingRow});a._setEnabledOfDialogButton(f,!0,a.options.messages.save);b.remove()}})},updateRecord:function(a){var b=this;a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.updateAction,success:function(){}, +error:function(){}},a);if(a.record){var f=b._getKeyValueOfRecord(a.record);if(void 0==f||null==f)b._logWarn("options parameter in updateRecord method must contain a record that contains the key field property.");else{var c=b.getRowByKey(f);null==c?b._logWarn("Can not found any row by key: "+f):a.clientOnly?(d.extend(c.data("record"),a.record),b._updateRowTexts(c),b._onRecordUpdated(c,null),a.animationsEnabled&&b._showUpdateAnimationForRow(c),a.success()):b._submitFormUsingAjax(a.url,d.param(a.record), +function(f){"OK"!=f.Result?(b._showError(f.Message),a.error(f)):(d.extend(c.data("record"),a.record),b._updateRecordValuesFromServerResponse(c.data("record"),f),b._updateRowTexts(c),b._onRecordUpdated(c,f),a.animationsEnabled&&b._showUpdateAnimationForRow(c),a.success(f))},function(){b._showError(b.options.messages.serverCommunicationError);a.error()})}}else b._logWarn("options parameter in updateRecord method must contain a record property.")},_addColumnsToHeaderRow:function(b){a.apply(this,arguments); +void 0!=this.options.actions.updateAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){var b=this;c.apply(this,arguments);if(void 0!=b.options.actions.updateAction){var f=d("<span></span>").html(b.options.messages.editRecord),f=d('<button title="'+b.options.messages.editRecord+'"></button>').addClass("jtable-command-button jtable-edit-command-button").append(f).click(function(f){f.preventDefault();f.stopPropagation();b._showEditForm(a)});d("<td></td>").addClass("jtable-command-column").append(f).appendTo(a)}}, +_showEditForm:function(a){for(var b=a.data("record"),f=d('<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form" action="'+this.options.actions.updateAction+'" method="POST"></form>'),c=0;c<this._fieldList.length;c++){var k=this._fieldList[c],h=this.options.fields[k],l=b[k];if(!0==h.key)if(!0!=h.edit){f.append(this._createInputForHidden(k,l));continue}else f.append(this._createInputForHidden("jtRecordKey",l));!1!=h.edit&&("hidden"==h.type?f.append(this._createInputForHidden(k,l)): +(h=d('<div class="jtable-input-field-container"></div>').appendTo(f),h.append(this._createInputLabelForRecordField(k)),l=this._getValueForRecordField(b,k),h.append(this._createInputForRecordField({fieldName:k,value:l,record:b,formType:"edit",form:f}))))}this._makeCascadeDropDowns(f,b,"edit");this._$editingRow=a;this._$editDiv.append(f).dialog("open");this._trigger("formCreated",null,{form:f,formType:"edit",record:b,row:a})},_saveEditForm:function(a,b){var f=this;f._submitFormUsingAjax(a.attr("action"), +a.serialize(),function(c){if("OK"!=c.Result)f._showError(c.Message),f._setEnabledOfDialogButton(b,!0,f.options.messages.save);else{var d=f._$editingRow.data("record");f._updateRecordValuesFromForm(d,a);f._updateRecordValuesFromServerResponse(d,c);f._updateRowTexts(f._$editingRow);f._$editingRow.attr("data-record-key",f._getKeyValueOfRecord(d));f._onRecordUpdated(f._$editingRow,c);f.options.animationsEnabled&&f._showUpdateAnimationForRow(f._$editingRow);f._$editDiv.dialog("close")}},function(){f._showError(f.options.messages.serverCommunicationError); +f._setEnabledOfDialogButton(b,!0,f.options.messages.save)})},_updateRecordValuesFromServerResponse:function(a,b){b&&b.Record&&d.extend(!0,a,b.Record)},_getValueForRecordField:function(a,b){var f=this.options.fields[b],c=a[b];return"date"==f.type?this._getDisplayTextForDateRecordField(f,c):c},_updateRowTexts:function(a){for(var b=a.data("record"),f=a.find("td"),c=0;c<this._columnList.length;c++){var d=this._getDisplayTextForRecordField(b,this._columnList[c]);f.eq(this._firstDataColumnOffset+c).html(d|| "")}this._onRowUpdated(a)},_showUpdateAnimationForRow:function(a){a.stop(!0,!0).addClass("jtable-row-updated","slow","",function(){a.removeClass("jtable-row-updated",5E3)})},_onRowUpdated:function(a){this._trigger("rowUpdated",null,{row:a,record:a.data("record")})},_onRecordUpdated:function(a,b){this._trigger("recordUpdated",null,{record:a.data("record"),row:a,serverResponse:b})}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._create,a=c.hik.jtable.prototype._addColumnsToHeaderRow,d=c.hik.jtable.prototype._addCellsToRowUsingRecord;c.extend(!0,c.hik.jtable.prototype,{options:{deleteConfirmation:!0,recordDeleted:function(){},messages:{deleteConfirmation:"This record will be deleted. Are you sure?",deleteText:"Delete",deleting:"Deleting",canNotDeletedRecords:"Can not delete {0} of {1} records!",deleteProggress:"Deleting {0} of {1} records, processing..."}},_$deleteRecordDiv:null, -_$deletingRow:null,_create:function(){b.apply(this,arguments);this._createDeleteDialogDiv()},_createDeleteDialogDiv:function(){var a=this;a._$deleteRecordDiv=c('<div><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span class="jtable-delete-confirm-message"></span></p></div>').appendTo(a._$mainContainer);a._$deleteRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,modal:!0,title:a.options.messages.areYouSure,buttons:[{text:a.options.messages.cancel, -click:function(){a._$deleteRecordDiv.dialog("close")}},{id:"DeleteDialogButton",text:a.options.messages.deleteText,click:function(){if(a._$deletingRow.hasClass("jtable-row-removed"))a._$deleteRecordDiv.dialog("close");else{var b=c("#DeleteDialogButton");a._setEnabledOfDialogButton(b,!1,a.options.messages.deleting);a._deleteRecordFromServer(a._$deletingRow,function(){a._removeRowsFromTableWithAnimation(a._$deletingRow);a._$deleteRecordDiv.dialog("close")},function(e){a._showError(e);a._setEnabledOfDialogButton(b, -!0,a.options.messages.deleteText)})}}}],close:function(){var b=c("#DeleteDialogButton");a._setEnabledOfDialogButton(b,!0,a.options.messages.deleteText)}})},deleteRows:function(a){var b=this;if(0>=a.length)b._logWarn("No rows specified to jTable deleteRows method.");else if(b._isBusy())b._logWarn("Can not delete rows since jTable is busy!");else if(1==a.length)b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)});else{b._showBusy(b._formatString(b.options.messages.deleteProggress, -0,a.length));var e=0,d=function(){var e=a.filter(".jtable-row-ready-to-remove");e.length<a.length&&b._showError(b._formatString(b.options.messages.canNotDeletedRecords,a.length-e.length,a.length));0<e.length&&b._removeRowsFromTableWithAnimation(e);b._hideBusy()},k=0;a.each(function(){var h=c(this);b._deleteRecordFromServer(h,function(){++k;++e;h.addClass("jtable-row-ready-to-remove");b._showBusy(b._formatString(b.options.messages.deleteProggress,k,a.length));e>=a.length&&d()},function(){++e;e>=a.length&& -d()})})}},deleteRecord:function(a){var b=this;a=c.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.deleteAction,success:function(){},error:function(){}},a);if(void 0==a.key)b._logWarn("options parameter in deleteRecord method must contain a key property.");else{var e=b.getRowByKey(a.key);null==e?b._logWarn("Can not found any row by key: "+a.key):a.clientOnly?(b._removeRowsFromTableWithAnimation(e,a.animationsEnabled),a.success()):b._deleteRecordFromServer(e, -function(c){b._removeRowsFromTableWithAnimation(e,a.animationsEnabled);a.success(c)},function(e){b._showError(e);a.error(e)},a.url)}},_addColumnsToHeaderRow:function(b){a.apply(this,arguments);void 0!=this.options.actions.deleteAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){d.apply(this,arguments);var b=this;if(void 0!=b.options.actions.deleteAction){var e=c("<span></span>").html(b.options.messages.deleteText),e=c('<button title="'+b.options.messages.deleteText+ -'"></button>').addClass("jtable-command-button jtable-delete-command-button").append(e).click(function(e){e.preventDefault();e.stopPropagation();b._deleteButtonClickedForRow(a)});c("<td></td>").addClass("jtable-command-column").append(e).appendTo(a)}},_deleteButtonClickedForRow:function(a){var b=this,e,d=b.options.messages.deleteConfirmation;if(c.isFunction(b.options.deleteConfirmation)){e={row:a,record:a.data("record"),deleteConfirm:!0,deleteConfirmMessage:d,cancel:!1,cancelMessage:null};b.options.deleteConfirmation(e); -if(e.cancel){e.cancelMessage&&b._showError(e.cancelMessage);return}d=e.deleteConfirmMessage;e=e.deleteConfirm}else e=b.options.deleteConfirmation;!1!=e?(b._$deleteRecordDiv.find(".jtable-delete-confirm-message").html(d),b._showDeleteDialog(a)):b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)})},_showDeleteDialog:function(a){this._$deletingRow=a;this._$deleteRecordDiv.dialog("open")},_deleteRecordFromServer:function(a,b,e,c){var d=this;if(!0!= -a.data("deleting")){a.data("deleting",!0);var h={};h[d._keyField]=d._getKeyValueOfRecord(a.data("record"));this._ajax({url:c||d.options.actions.deleteAction,data:h,success:function(c){"OK"!=c.Result?(a.data("deleting",!1),e&&e(c.Message)):(d._trigger("recordDeleted",null,{record:a.data("record"),row:a,serverResponse:c}),b&&b(c))},error:function(){a.data("deleting",!1);e&&e(d.options.messages.serverCommunicationError)}})}},_removeRowsFromTableWithAnimation:function(a,b){var e=this;void 0==b&&(b=e.options.animationsEnabled); -b?a.stop(!0,!0).addClass("jtable-row-deleting","slow","").promise().done(function(){e._removeRowsFromTable(a,"deleted")}):e._removeRowsFromTable(a,"deleted")}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._create,a=c.hik.jtable.prototype._addColumnsToHeaderRow,d=c.hik.jtable.prototype._addCellsToRowUsingRecord,f=c.hik.jtable.prototype._onLoadingRecords,g=c.hik.jtable.prototype._onRecordsLoaded,e=c.hik.jtable.prototype._onRowsRemoved;c.extend(!0,c.hik.jtable.prototype,{options:{selecting:!1,multiselect:!1,selectingCheckboxes:!1,selectOnRowClick:!0,selectionChanged:function(){}},_selectedRecordIdsBeforeLoad:null,_$selectAllCheckbox:null,_shiftKeyDown:!1,_create:function(){this.options.selecting&& -this.options.selectingCheckboxes&&++this._firstDataColumnOffset;this._bindKeyboardEvents();b.apply(this,arguments)},_bindKeyboardEvents:function(){var a=this;c(document).keydown(function(b){switch(b.which){case 16:a._shiftKeyDown=!0}}).keyup(function(b){switch(b.which){case 16:a._shiftKeyDown=!1}})},selectedRows:function(){return this._getSelectedRows()},selectRows:function(a){this._selectRows(a);this._onSelectionChanged()},_addColumnsToHeaderRow:function(b){this.options.selecting&&this.options.selectingCheckboxes&& -(this.options.multiselect?b.append(this._createSelectAllHeader()):b.append(this._createEmptyCommandHeader()));a.apply(this,arguments)},_addCellsToRowUsingRecord:function(a){this.options.selecting&&this._makeRowSelectable(a);d.apply(this,arguments)},_onLoadingRecords:function(){this._storeSelectionList();f.apply(this,arguments)},_onRecordsLoaded:function(){this._restoreSelectionList();g.apply(this,arguments)},_onRowsRemoved:function(a,b){"reloading"!=b&&(this.options.selecting&&0<a.filter(".jtable-row-selected").length)&& -this._onSelectionChanged();e.apply(this,arguments)},_createSelectAllHeader:function(){var a=this,b=c('<th class=""></th>').addClass("jtable-command-column-header jtable-column-header-selecting"),e=c("<div />").addClass("jtable-column-header-container").appendTo(b);a._$selectAllCheckbox=c('<input type="checkbox" />').appendTo(e).click(function(){if(0>=a._$tableRows.length)a._$selectAllCheckbox.attr("checked",!1);else{var b=a._$tableBody.find("tr.jtable-data-row");a._$selectAllCheckbox.is(":checked")? -a._selectRows(b):a._deselectRows(b);a._onSelectionChanged()}});return b},_storeSelectionList:function(){var a=this;a.options.selecting&&(a._selectedRecordIdsBeforeLoad=[],a._getSelectedRows().each(function(){a._selectedRecordIdsBeforeLoad.push(a._getKeyValueOfRecord(c(this).data("record")))}))},_restoreSelectionList:function(){if(this.options.selecting){for(var a=0,b=0;b<this._$tableRows.length;++b){var e=this._getKeyValueOfRecord(this._$tableRows[b].data("record"));-1<c.inArray(e,this._selectedRecordIdsBeforeLoad)&& -(this._selectRows(this._$tableRows[b]),++a)}0<this._selectedRecordIdsBeforeLoad.length&&this._selectedRecordIdsBeforeLoad.length!=a&&this._onSelectionChanged();this._selectedRecordIdsBeforeLoad=[];this._refreshSelectAllCheckboxState()}},_getSelectedRows:function(){return this._$tableBody.find(".jtable-row-selected")},_makeRowSelectable:function(a){var b=this;b.options.selectOnRowClick&&a.click(function(){b._invertRowSelection(a)});if(b.options.selectingCheckboxes){var e=c("<td></td>").addClass("jtable-selecting-column"), -d=c('<input type="checkbox" />').appendTo(e);b.options.selectOnRowClick||d.click(function(){b._invertRowSelection(a)});a.append(e)}},_invertRowSelection:function(a){if(a.hasClass("jtable-row-selected"))this._deselectRows(a);else if(this._shiftKeyDown){var b=this._findRowIndex(a),e=this._findFirstSelectedRowIndexBeforeIndex(b)+1;0<e&&e<b?this._selectRows(this._$tableBody.find("tr").slice(e,b+1)):(e=this._findFirstSelectedRowIndexAfterIndex(b)-1,e>b?this._selectRows(this._$tableBody.find("tr").slice(b, -e+1)):this._selectRows(a))}else this._selectRows(a);this._onSelectionChanged()},_findFirstSelectedRowIndexBeforeIndex:function(a){for(a-=1;0<=a;--a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_findFirstSelectedRowIndexAfterIndex:function(a){for(a+=1;a<this._$tableRows.length;++a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_selectRows:function(a){this.options.multiselect||this._deselectRows(this._getSelectedRows());a.addClass("jtable-row-selected"); -this.options.selectingCheckboxes&&a.find("td.jtable-selecting-column input").attr("checked",!0);this._refreshSelectAllCheckboxState()},_deselectRows:function(a){a.removeClass("jtable-row-selected");this.options.selectingCheckboxes&&a.find("td.jtable-selecting-column input").removeAttr("checked");this._refreshSelectAllCheckboxState()},_refreshSelectAllCheckboxState:function(){if(this.options.selectingCheckboxes&&this.options.multiselect){var a=this._$tableRows.length,b=this._getSelectedRows().length; -0==b?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",!1)):b==a?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",!0)):(this._$selectAllCheckbox.attr("checked",!1),this._$selectAllCheckbox.prop("indeterminate",!0))}},_onSelectionChanged:function(){this._trigger("selectionChanged",null,{})}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype.load,a=c.hik.jtable.prototype._create,d=c.hik.jtable.prototype._setOption,f=c.hik.jtable.prototype._createRecordLoadUrl,g=c.hik.jtable.prototype._addRowToTable,e=c.hik.jtable.prototype._addRow,j=c.hik.jtable.prototype._removeRowsFromTable,k=c.hik.jtable.prototype._onRecordsLoaded;c.extend(!0,c.hik.jtable.prototype,{options:{paging:!1,pageList:"normal",pageSize:10,pageSizes:[10,25,50,100,250,500],pageSizeChangeArea:!0,gotoPageArea:"combobox",messages:{pagingInfo:"Showing {0}-{1} of {2}", -pageSizeChangeLabel:"Row count",gotoPageLabel:"Go to page"}},_$bottomPanel:null,_$pagingListArea:null,_$pageSizeChangeArea:null,_$pageInfoSpan:null,_$gotoPageArea:null,_$gotoPageInput:null,_totalRecordCount:0,_currentPageNo:1,_create:function(){a.apply(this,arguments);this.options.paging&&(this._createBottomPanel(),this._createPageListArea(),this._createGotoPageInput(),this._createPageSizeSelection())},_createBottomPanel:function(){this._$bottomPanel=c("<div />").addClass("jtable-bottom-panel").insertAfter(this._$table); -c("<div />").addClass("jtable-left-area").appendTo(this._$bottomPanel);c("<div />").addClass("jtable-right-area").appendTo(this._$bottomPanel)},_createPageListArea:function(){this._$pagingListArea=c("<span></span>").addClass("jtable-page-list").appendTo(this._$bottomPanel.find(".jtable-left-area"));this._$pageInfoSpan=c("<span></span>").addClass("jtable-page-info").appendTo(this._$bottomPanel.find(".jtable-right-area"))},_createPageSizeSelection:function(){var a=this;if(a.options.pageSizeChangeArea){0> -a._findIndexInArray(a.options.pageSize,a.options.pageSizes)&&(a.options.pageSizes.push(parseInt(a.options.pageSize)),a.options.pageSizes.sort(function(a,b){return a-b}));a._$pageSizeChangeArea=c("<span></span>").addClass("jtable-page-size-change").appendTo(a._$bottomPanel.find(".jtable-left-area"));a._$pageSizeChangeArea.append("<span>"+a.options.messages.pageSizeChangeLabel+": </span>");for(var b=c("<select></select>").appendTo(a._$pageSizeChangeArea),e=0;e<a.options.pageSizes.length;e++)b.append('<option value="'+ -a.options.pageSizes[e]+'">'+a.options.pageSizes[e]+"</option>");b.val(a.options.pageSize);b.change(function(){a._changePageSize(parseInt(c(this).val()))})}},_createGotoPageInput:function(){var a=this;a.options.gotoPageArea&&"none"!=a.options.gotoPageArea&&(this._$gotoPageArea=c("<span></span>").addClass("jtable-goto-page").appendTo(a._$bottomPanel.find(".jtable-left-area")),this._$gotoPageArea.append("<span>"+a.options.messages.gotoPageLabel+": </span>"),"combobox"==a.options.gotoPageArea?(a._$gotoPageInput= -c("<select></select>").appendTo(this._$gotoPageArea).data("pageCount",1).change(function(){a._changePage(parseInt(c(this).val()))}),a._$gotoPageInput.append('<option value="1">1</option>')):a._$gotoPageInput=c('<input type="text" maxlength="10" value="'+a._currentPageNo+'" />').appendTo(this._$gotoPageArea).keypress(function(b){13==b.which?(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val()))):43==b.which?(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val())+1)):45==b.which? -(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val())-1)):47<b.keyCode&&58>b.keyCode&&!1==b.shiftKey&&!1==b.altKey||(8==b.keyCode||9==b.keyCode)||b.preventDefault()}))},_refreshGotoPageInput:function(){if(this.options.gotoPageArea&&"none"!=this.options.gotoPageArea){0>=this._totalRecordCount?this._$gotoPageArea.hide():this._$gotoPageArea.show();if("combobox"==this.options.gotoPageArea){var a=this._$gotoPageInput.data("pageCount"),b=this._calculatePageCount();if(a!=b){this._$gotoPageInput.empty(); -for(a=1;a<=b;a++)this._$gotoPageInput.append('<option value="'+a+'">'+a+"</option>");this._$gotoPageInput.data("pageCount",b)}}this._$gotoPageInput.val(this._currentPageNo)}},load:function(){this._currentPageNo=1;b.apply(this,arguments)},_setOption:function(a,b){d.apply(this,arguments);"pageSize"==a&&this._changePageSize(parseInt(b))},_changePageSize:function(a){if(a!=this.options.pageSize){this.options.pageSize=a;var b=this._calculatePageCount();this._currentPageNo>b&&(this._currentPageNo=b);b=this._$bottomPanel.find(".jtable-page-size-change select"); -0<b.length&&parseInt(b.val())!=a&&0<b.find("option[value="+a+"]").length&&b.val(a);this._reloadTable()}},_createRecordLoadUrl:function(){var a=f.apply(this,arguments);return a=this._addPagingInfoToUrl(a,this._currentPageNo)},_addRowToTable:function(a,b,e){e&&this.options.paging?this._reloadTable():g.apply(this,arguments)},_addRow:function(a,b){b&&b.isNewRow&&this.options.paging?this._reloadTable():e.apply(this,arguments)},_removeRowsFromTable:function(a,b){j.apply(this,arguments);this.options.paging&& -(0>=this._$tableRows.length&&1<this._currentPageNo&&--this._currentPageNo,this._reloadTable())},_onRecordsLoaded:function(a){this._totalRecordCount=a.TotalRecordCount;this._createPagingList();this._createPagingInfo();this._refreshGotoPageInput();k.apply(this,arguments)},_addPagingInfoToUrl:function(a,b){if(!this.options.paging)return a;var e=(b-1)*this.options.pageSize,c=this.options.pageSize;return a+(0>a.indexOf("?")?"?":"&")+"jtStartIndex="+e+"&jtPageSize="+c},_createPagingList:function(){if(this.options.paging&& -!(0>=this.options.pageSize)&&(this._$pagingListArea.empty(),!(0>=this._totalRecordCount))){var a=this._calculatePageCount();this._createFirstAndPreviousPageButtons();"normal"==this.options.pageList&&this._createPageNumberButtons(this._calculatePageNumbers(a));this._createLastAndNextPageButtons(a);this._bindClickEventsToPageNumberButtons()}},_createFirstAndPreviousPageButtons:function(){var a=c("<span></span>").addClass("jtable-page-number-first").html("<<").data("pageNumber",1).appendTo(this._$pagingListArea), -b=c("<span></span>").addClass("jtable-page-number-previous").html("<").data("pageNumber",this._currentPageNo-1).appendTo(this._$pagingListArea);1>=this._currentPageNo&&(a.addClass("jtable-page-number-disabled"),b.addClass("jtable-page-number-disabled"))},_createLastAndNextPageButtons:function(a){var b=c("<span></span>").addClass("jtable-page-number-next").html(">").data("pageNumber",this._currentPageNo+1).appendTo(this._$pagingListArea),e=c("<span></span>").addClass("jtable-page-number-last").html(">>").data("pageNumber", -a).appendTo(this._$pagingListArea);this._currentPageNo>=a&&(b.addClass("jtable-page-number-disabled"),e.addClass("jtable-page-number-disabled"))},_createPageNumberButtons:function(a){for(var b=0,e=0;e<a.length;e++)1<a[e]-b&&c("<span></span>").addClass("jtable-page-number-space").html("...").appendTo(this._$pagingListArea),this._createPageNumberButton(a[e]),b=a[e]},_createPageNumberButton:function(a){var b=c("<span></span>").addClass("jtable-page-number").html(a).data("pageNumber",a).appendTo(this._$pagingListArea); -this._currentPageNo==a&&(b.addClass("jtable-page-number-active"),b.addClass("jtable-page-number-disabled"))},_calculatePageCount:function(){var a=Math.floor(this._totalRecordCount/this.options.pageSize);0!=this._totalRecordCount%this.options.pageSize&&++a;return a},_calculatePageNumbers:function(a){if(4>=a){for(var b=[],e=1;e<=a;++e)b.push(e);return b}b=[1,2,a-1,a];e=this._normalizeNumber(this._currentPageNo-1,1,a,1);a=this._normalizeNumber(this._currentPageNo+1,1,a,1);this._insertToArrayIfDoesNotExists(b, -e);this._insertToArrayIfDoesNotExists(b,this._currentPageNo);this._insertToArrayIfDoesNotExists(b,a);b.sort(function(a,b){return a-b});return b},_createPagingInfo:function(){if(0>=this._totalRecordCount)this._$pageInfoSpan.empty();else{var a=(this._currentPageNo-1)*this.options.pageSize+1,b=this._currentPageNo*this.options.pageSize,b=this._normalizeNumber(b,a,this._totalRecordCount,0);b>=a&&(a=this._formatString(this.options.messages.pagingInfo,a,b,this._totalRecordCount),this._$pageInfoSpan.html(a))}}, -_bindClickEventsToPageNumberButtons:function(){var a=this;a._$pagingListArea.find(".jtable-page-number,.jtable-page-number-previous,.jtable-page-number-next,.jtable-page-number-first,.jtable-page-number-last").not(".jtable-page-number-disabled").click(function(b){b.preventDefault();a._changePage(c(this).data("pageNumber"))})},_changePage:function(a){a=this._normalizeNumber(a,1,this._calculatePageCount(),1);a==this._currentPageNo?this._refreshGotoPageInput():(this._currentPageNo=a,this._reloadTable())}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._initializeFields,a=c.hik.jtable.prototype._normalizeFieldOptions,d=c.hik.jtable.prototype._createHeaderCellForField,f=c.hik.jtable.prototype._createRecordLoadUrl;c.extend(!0,c.hik.jtable.prototype,{options:{sorting:!1,multiSorting:!1,defaultSorting:""},_lastSorting:null,_initializeFields:function(){b.apply(this,arguments);this._lastSorting=[];this.options.sorting&&this._buildDefaultSortingArray()},_normalizeFieldOptions:function(b,e){a.apply(this,arguments); -e.sorting=!1!=e.sorting},_createHeaderCellForField:function(a,b){var c=d.apply(this,arguments);this.options.sorting&&b.sorting&&this._makeColumnSortable(c,a);return c},_createRecordLoadUrl:function(){var a=f.apply(this,arguments);return a=this._addSortingInfoToUrl(a)},_buildDefaultSortingArray:function(){var a=this;c.each(a.options.defaultSorting.split(","),function(b,d){c.each(a.options.fields,function(b,e){if(e.sorting){var c=d.indexOf(b);-1<c&&(-1<d.toUpperCase().indexOf("DESC",c)?a._lastSorting.push({fieldName:b, -sortOrder:"DESC"}):a._lastSorting.push({fieldName:b,sortOrder:"ASC"}))}})})},_makeColumnSortable:function(a,b){var d=this;a.addClass("jtable-column-header-sortable").click(function(b){b.preventDefault();if(!d.options.multiSorting||!b.ctrlKey)d._lastSorting=[];d._sortTableByColumn(a)});c.each(this._lastSorting,function(c,d){d.fieldName==b&&("DESC"==d.sortOrder?a.addClass("jtable-column-header-sorted-desc"):a.addClass("jtable-column-header-sorted-asc"))})},_sortTableByColumn:function(a){0==this._lastSorting.length&& +(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord;d.extend(!0,d.hik.jtable.prototype,{options:{deleteConfirmation:!0,recordDeleted:function(){},messages:{deleteConfirmation:"This record will be deleted. Are you sure?",deleteText:"Delete",deleting:"Deleting",canNotDeletedRecords:"Can not delete {0} of {1} records!",deleteProggress:"Deleting {0} of {1} records, processing..."}},_$deleteRecordDiv:null, +_$deletingRow:null,_create:function(){b.apply(this,arguments);this._createDeleteDialogDiv()},_createDeleteDialogDiv:function(){var a=this;a._$deleteRecordDiv=d('<div><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span class="jtable-delete-confirm-message"></span></p></div>').appendTo(a._$mainContainer);a._$deleteRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,modal:!0,title:a.options.messages.areYouSure,buttons:[{text:a.options.messages.cancel, +click:function(){a._$deleteRecordDiv.dialog("close")}},{id:"DeleteDialogButton",text:a.options.messages.deleteText,click:function(){if(a._$deletingRow.hasClass("jtable-row-removed"))a._$deleteRecordDiv.dialog("close");else{var b=d("#DeleteDialogButton");a._setEnabledOfDialogButton(b,!1,a.options.messages.deleting);a._deleteRecordFromServer(a._$deletingRow,function(){a._removeRowsFromTableWithAnimation(a._$deletingRow);a._$deleteRecordDiv.dialog("close")},function(f){a._showError(f);a._setEnabledOfDialogButton(b, +!0,a.options.messages.deleteText)})}}}],close:function(){var b=d("#DeleteDialogButton");a._setEnabledOfDialogButton(b,!0,a.options.messages.deleteText)}})},deleteRows:function(a){var b=this;if(0>=a.length)b._logWarn("No rows specified to jTable deleteRows method.");else if(b._isBusy())b._logWarn("Can not delete rows since jTable is busy!");else if(1==a.length)b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)});else{b._showBusy(b._formatString(b.options.messages.deleteProggress, +0,a.length));var f=0,c=function(){var c=a.filter(".jtable-row-ready-to-remove");c.length<a.length&&b._showError(b._formatString(b.options.messages.canNotDeletedRecords,a.length-c.length,a.length));0<c.length&&b._removeRowsFromTableWithAnimation(c);b._hideBusy()},k=0;a.each(function(){var h=d(this);b._deleteRecordFromServer(h,function(){++k;++f;h.addClass("jtable-row-ready-to-remove");b._showBusy(b._formatString(b.options.messages.deleteProggress,k,a.length));f>=a.length&&c()},function(){++f;f>=a.length&& +c()})})}},deleteRecord:function(a){var b=this;a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.deleteAction,success:function(){},error:function(){}},a);if(void 0==a.key)b._logWarn("options parameter in deleteRecord method must contain a key property.");else{var c=b.getRowByKey(a.key);null==c?b._logWarn("Can not found any row by key: "+a.key):a.clientOnly?(b._removeRowsFromTableWithAnimation(c,a.animationsEnabled),a.success()):b._deleteRecordFromServer(c, +function(d){b._removeRowsFromTableWithAnimation(c,a.animationsEnabled);a.success(d)},function(c){b._showError(c);a.error(c)},a.url)}},_addColumnsToHeaderRow:function(b){a.apply(this,arguments);void 0!=this.options.actions.deleteAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){c.apply(this,arguments);var b=this;if(void 0!=b.options.actions.deleteAction){var f=d("<span></span>").html(b.options.messages.deleteText),f=d('<button title="'+b.options.messages.deleteText+ +'"></button>').addClass("jtable-command-button jtable-delete-command-button").append(f).click(function(c){c.preventDefault();c.stopPropagation();b._deleteButtonClickedForRow(a)});d("<td></td>").addClass("jtable-command-column").append(f).appendTo(a)}},_deleteButtonClickedForRow:function(a){var b=this,c,j=b.options.messages.deleteConfirmation;if(d.isFunction(b.options.deleteConfirmation)){c={row:a,record:a.data("record"),deleteConfirm:!0,deleteConfirmMessage:j,cancel:!1,cancelMessage:null};b.options.deleteConfirmation(c); +if(c.cancel){c.cancelMessage&&b._showError(c.cancelMessage);return}j=c.deleteConfirmMessage;c=c.deleteConfirm}else c=b.options.deleteConfirmation;!1!=c?(b._$deleteRecordDiv.find(".jtable-delete-confirm-message").html(j),b._showDeleteDialog(a)):b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)})},_showDeleteDialog:function(a){this._$deletingRow=a;this._$deleteRecordDiv.dialog("open")},_deleteRecordFromServer:function(a,b,c,d){var k=this;if(!0!= +a.data("deleting")){a.data("deleting",!0);var h={};h[k._keyField]=k._getKeyValueOfRecord(a.data("record"));this._ajax({url:d||k.options.actions.deleteAction,data:h,success:function(d){"OK"!=d.Result?(a.data("deleting",!1),c&&c(d.Message)):(k._trigger("recordDeleted",null,{record:a.data("record"),row:a,serverResponse:d}),b&&b(d))},error:function(){a.data("deleting",!1);c&&c(k.options.messages.serverCommunicationError)}})}},_removeRowsFromTableWithAnimation:function(a,b){var c=this;void 0==b&&(b=c.options.animationsEnabled); +b?a.stop(!0,!0).addClass("jtable-row-deleting","slow","").promise().done(function(){c._removeRowsFromTable(a,"deleted")}):c._removeRowsFromTable(a,"deleted")}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord,e=d.hik.jtable.prototype._onLoadingRecords,g=d.hik.jtable.prototype._onRecordsLoaded,f=d.hik.jtable.prototype._onRowsRemoved;d.extend(!0,d.hik.jtable.prototype,{options:{selecting:!1,multiselect:!1,selectingCheckboxes:!1,selectOnRowClick:!0,selectionChanged:function(){}},_selectedRecordIdsBeforeLoad:null,_$selectAllCheckbox:null,_shiftKeyDown:!1,_create:function(){this.options.selecting&& +this.options.selectingCheckboxes&&(++this._firstDataColumnOffset,this._bindKeyboardEvents());b.apply(this,arguments)},_bindKeyboardEvents:function(){var a=this;d(document).keydown(function(b){switch(b.which){case 16:a._shiftKeyDown=!0}}).keyup(function(b){switch(b.which){case 16:a._shiftKeyDown=!1}})},selectedRows:function(){return this._getSelectedRows()},selectRows:function(a){this._selectRows(a);this._onSelectionChanged()},_addColumnsToHeaderRow:function(b){this.options.selecting&&this.options.selectingCheckboxes&& +(this.options.multiselect?b.append(this._createSelectAllHeader()):b.append(this._createEmptyCommandHeader()));a.apply(this,arguments)},_addCellsToRowUsingRecord:function(a){this.options.selecting&&this._makeRowSelectable(a);c.apply(this,arguments)},_onLoadingRecords:function(){this.options.selecting&&this._storeSelectionList();e.apply(this,arguments)},_onRecordsLoaded:function(){this.options.selecting&&this._restoreSelectionList();g.apply(this,arguments)},_onRowsRemoved:function(a,b){this.options.selecting&& +("reloading"!=b&&0<a.filter(".jtable-row-selected").length)&&this._onSelectionChanged();f.apply(this,arguments)},_createSelectAllHeader:function(){var a=this,b=d('<th class=""></th>').addClass("jtable-command-column-header jtable-column-header-selecting"),c=d("<div />").addClass("jtable-column-header-container").appendTo(b);a._$selectAllCheckbox=d('<input type="checkbox" />').appendTo(c).click(function(){if(0>=a._$tableRows.length)a._$selectAllCheckbox.attr("checked",!1);else{var b=a._$tableBody.find(">tr.jtable-data-row"); +a._$selectAllCheckbox.is(":checked")?a._selectRows(b):a._deselectRows(b);a._onSelectionChanged()}});return b},_storeSelectionList:function(){var a=this;a.options.selecting&&(a._selectedRecordIdsBeforeLoad=[],a._getSelectedRows().each(function(){a._selectedRecordIdsBeforeLoad.push(a._getKeyValueOfRecord(d(this).data("record")))}))},_restoreSelectionList:function(){if(this.options.selecting){for(var a=0,b=0;b<this._$tableRows.length;++b){var c=this._getKeyValueOfRecord(this._$tableRows[b].data("record")); +-1<d.inArray(c,this._selectedRecordIdsBeforeLoad)&&(this._selectRows(this._$tableRows[b]),++a)}0<this._selectedRecordIdsBeforeLoad.length&&this._selectedRecordIdsBeforeLoad.length!=a&&this._onSelectionChanged();this._selectedRecordIdsBeforeLoad=[];this._refreshSelectAllCheckboxState()}},_getSelectedRows:function(){return this._$tableBody.find(">tr.jtable-row-selected")},_makeRowSelectable:function(a){var b=this;b.options.selectOnRowClick&&a.click(function(){b._invertRowSelection(a)});if(b.options.selectingCheckboxes){var c= +d("<td></td>").addClass("jtable-selecting-column"),f=d('<input type="checkbox" />').appendTo(c);b.options.selectOnRowClick||f.click(function(){b._invertRowSelection(a)});a.append(c)}},_invertRowSelection:function(a){if(a.hasClass("jtable-row-selected"))this._deselectRows(a);else if(this._shiftKeyDown){var b=this._findRowIndex(a),c=this._findFirstSelectedRowIndexBeforeIndex(b)+1;0<c&&c<b?this._selectRows(this._$tableBody.find("tr").slice(c,b+1)):(c=this._findFirstSelectedRowIndexAfterIndex(b)-1,c> +b?this._selectRows(this._$tableBody.find("tr").slice(b,c+1)):this._selectRows(a))}else this._selectRows(a);this._onSelectionChanged()},_findFirstSelectedRowIndexBeforeIndex:function(a){for(a-=1;0<=a;--a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_findFirstSelectedRowIndexAfterIndex:function(a){for(a+=1;a<this._$tableRows.length;++a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_selectRows:function(a){this.options.multiselect||this._deselectRows(this._getSelectedRows()); +a.addClass("jtable-row-selected");this.options.selectingCheckboxes&&a.find(">td.jtable-selecting-column >input").prop("checked",!0);this._refreshSelectAllCheckboxState()},_deselectRows:function(a){a.removeClass("jtable-row-selected");this.options.selectingCheckboxes&&a.find(">td.jtable-selecting-column >input").prop("checked",!1);this._refreshSelectAllCheckboxState()},_refreshSelectAllCheckboxState:function(){if(this.options.selectingCheckboxes&&this.options.multiselect){var a=this._$tableRows.length, +b=this._getSelectedRows().length;0==b?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",!1)):b==a?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",!0)):(this._$selectAllCheckbox.attr("checked",!1),this._$selectAllCheckbox.prop("indeterminate",!0))}},_onSelectionChanged:function(){this._trigger("selectionChanged",null,{})}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype.load,a=d.hik.jtable.prototype._create,c=d.hik.jtable.prototype._setOption,e=d.hik.jtable.prototype._createRecordLoadUrl,g=d.hik.jtable.prototype._addRowToTable,f=d.hik.jtable.prototype._addRow,j=d.hik.jtable.prototype._removeRowsFromTable,k=d.hik.jtable.prototype._onRecordsLoaded;d.extend(!0,d.hik.jtable.prototype,{options:{paging:!1,pageList:"normal",pageSize:10,pageSizes:[10,25,50,100,250,500],pageSizeChangeArea:!0,gotoPageArea:"combobox",messages:{pagingInfo:"Showing {0}-{1} of {2}", +pageSizeChangeLabel:"Row count",gotoPageLabel:"Go to page"}},_$bottomPanel:null,_$pagingListArea:null,_$pageSizeChangeArea:null,_$pageInfoSpan:null,_$gotoPageArea:null,_$gotoPageInput:null,_totalRecordCount:0,_currentPageNo:1,_create:function(){a.apply(this,arguments);this.options.paging&&(this._loadPagingSettings(),this._createBottomPanel(),this._createPageListArea(),this._createGotoPageInput(),this._createPageSizeSelection())},_loadPagingSettings:function(){if(this.options.saveUserPreferences){var a= +this._getCookie("page-size");a&&(this.options.pageSize=this._normalizeNumber(a,1,1E6,this.options.pageSize))}},_createBottomPanel:function(){this._$bottomPanel=d("<div />").addClass("jtable-bottom-panel").insertAfter(this._$table);d("<div />").addClass("jtable-left-area").appendTo(this._$bottomPanel);d("<div />").addClass("jtable-right-area").appendTo(this._$bottomPanel)},_createPageListArea:function(){this._$pagingListArea=d("<span></span>").addClass("jtable-page-list").appendTo(this._$bottomPanel.find(".jtable-left-area")); +this._$pageInfoSpan=d("<span></span>").addClass("jtable-page-info").appendTo(this._$bottomPanel.find(".jtable-right-area"))},_createPageSizeSelection:function(){var a=this;if(a.options.pageSizeChangeArea){0>a._findIndexInArray(a.options.pageSize,a.options.pageSizes)&&(a.options.pageSizes.push(parseInt(a.options.pageSize)),a.options.pageSizes.sort(function(a,b){return a-b}));a._$pageSizeChangeArea=d("<span></span>").addClass("jtable-page-size-change").appendTo(a._$bottomPanel.find(".jtable-left-area")); +a._$pageSizeChangeArea.append("<span>"+a.options.messages.pageSizeChangeLabel+": </span>");for(var b=d("<select></select>").appendTo(a._$pageSizeChangeArea),c=0;c<a.options.pageSizes.length;c++)b.append('<option value="'+a.options.pageSizes[c]+'">'+a.options.pageSizes[c]+"</option>");b.val(a.options.pageSize);b.change(function(){a._changePageSize(parseInt(d(this).val()))})}},_createGotoPageInput:function(){var a=this;a.options.gotoPageArea&&"none"!=a.options.gotoPageArea&&(this._$gotoPageArea=d("<span></span>").addClass("jtable-goto-page").appendTo(a._$bottomPanel.find(".jtable-left-area")), +this._$gotoPageArea.append("<span>"+a.options.messages.gotoPageLabel+": </span>"),"combobox"==a.options.gotoPageArea?(a._$gotoPageInput=d("<select></select>").appendTo(this._$gotoPageArea).data("pageCount",1).change(function(){a._changePage(parseInt(d(this).val()))}),a._$gotoPageInput.append('<option value="1">1</option>')):a._$gotoPageInput=d('<input type="text" maxlength="10" value="'+a._currentPageNo+'" />').appendTo(this._$gotoPageArea).keypress(function(b){13==b.which?(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val()))): +43==b.which?(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val())+1)):45==b.which?(b.preventDefault(),a._changePage(parseInt(a._$gotoPageInput.val())-1)):47<b.keyCode&&58>b.keyCode&&!1==b.shiftKey&&!1==b.altKey||(8==b.keyCode||9==b.keyCode)||b.preventDefault()}))},_refreshGotoPageInput:function(){if(this.options.gotoPageArea&&"none"!=this.options.gotoPageArea){0>=this._totalRecordCount?this._$gotoPageArea.hide():this._$gotoPageArea.show();if("combobox"==this.options.gotoPageArea){var a= +this._$gotoPageInput.data("pageCount"),b=this._calculatePageCount();if(a!=b){this._$gotoPageInput.empty();a=1;1E4<b?a=100:5E3<b?a=10:2E3<b?a=5:1E3<b&&(a=2);for(var c=a;c<=b;c+=a)this._$gotoPageInput.append('<option value="'+c+'">'+c+"</option>");this._$gotoPageInput.data("pageCount",b)}}this._$gotoPageInput.val(this._currentPageNo)}},load:function(){this._currentPageNo=1;b.apply(this,arguments)},_setOption:function(a,b){c.apply(this,arguments);"pageSize"==a&&this._changePageSize(parseInt(b))},_changePageSize:function(a){if(a!= +this.options.pageSize){this.options.pageSize=a;var b=this._calculatePageCount();this._currentPageNo>b&&(this._currentPageNo=b);0>=this._currentPageNo&&(this._currentPageNo=1);b=this._$bottomPanel.find(".jtable-page-size-change select");0<b.length&&parseInt(b.val())!=a&&0<b.find("option[value="+a+"]").length&&b.val(a);this._savePagingSettings();this._reloadTable()}},_savePagingSettings:function(){this.options.saveUserPreferences&&this._setCookie("page-size",this.options.pageSize)},_createRecordLoadUrl:function(){var a= +e.apply(this,arguments);return a=this._addPagingInfoToUrl(a,this._currentPageNo)},_addRowToTable:function(a,b,c){c&&this.options.paging?this._reloadTable():g.apply(this,arguments)},_addRow:function(a,b){b&&b.isNewRow&&this.options.paging?this._reloadTable():f.apply(this,arguments)},_removeRowsFromTable:function(a,b){j.apply(this,arguments);this.options.paging&&(0>=this._$tableRows.length&&1<this._currentPageNo&&--this._currentPageNo,this._reloadTable())},_onRecordsLoaded:function(a){this.options.paging&& +(this._totalRecordCount=a.TotalRecordCount,this._createPagingList(),this._createPagingInfo(),this._refreshGotoPageInput());k.apply(this,arguments)},_addPagingInfoToUrl:function(a,b){if(!this.options.paging)return a;var c=(b-1)*this.options.pageSize,d=this.options.pageSize;return a+(0>a.indexOf("?")?"?":"&")+"jtStartIndex="+c+"&jtPageSize="+d},_createPagingList:function(){if(!(0>=this.options.pageSize)&&(this._$pagingListArea.empty(),!(0>=this._totalRecordCount))){var a=this._calculatePageCount(); +this._createFirstAndPreviousPageButtons();"normal"==this.options.pageList&&this._createPageNumberButtons(this._calculatePageNumbers(a));this._createLastAndNextPageButtons(a);this._bindClickEventsToPageNumberButtons()}},_createFirstAndPreviousPageButtons:function(){var a=d("<span></span>").addClass("jtable-page-number-first").html("<<").data("pageNumber",1).appendTo(this._$pagingListArea),b=d("<span></span>").addClass("jtable-page-number-previous").html("<").data("pageNumber",this._currentPageNo- +1).appendTo(this._$pagingListArea);1>=this._currentPageNo&&(a.addClass("jtable-page-number-disabled"),b.addClass("jtable-page-number-disabled"))},_createLastAndNextPageButtons:function(a){var b=d("<span></span>").addClass("jtable-page-number-next").html(">").data("pageNumber",this._currentPageNo+1).appendTo(this._$pagingListArea),c=d("<span></span>").addClass("jtable-page-number-last").html(">>").data("pageNumber",a).appendTo(this._$pagingListArea);this._currentPageNo>=a&&(b.addClass("jtable-page-number-disabled"), +c.addClass("jtable-page-number-disabled"))},_createPageNumberButtons:function(a){for(var b=0,c=0;c<a.length;c++)1<a[c]-b&&d("<span></span>").addClass("jtable-page-number-space").html("...").appendTo(this._$pagingListArea),this._createPageNumberButton(a[c]),b=a[c]},_createPageNumberButton:function(a){var b=d("<span></span>").addClass("jtable-page-number").html(a).data("pageNumber",a).appendTo(this._$pagingListArea);this._currentPageNo==a&&(b.addClass("jtable-page-number-active"),b.addClass("jtable-page-number-disabled"))}, +_calculatePageCount:function(){var a=Math.floor(this._totalRecordCount/this.options.pageSize);0!=this._totalRecordCount%this.options.pageSize&&++a;return a},_calculatePageNumbers:function(a){if(4>=a){for(var b=[],c=1;c<=a;++c)b.push(c);return b}b=[1,2,a-1,a];c=this._normalizeNumber(this._currentPageNo-1,1,a,1);a=this._normalizeNumber(this._currentPageNo+1,1,a,1);this._insertToArrayIfDoesNotExists(b,c);this._insertToArrayIfDoesNotExists(b,this._currentPageNo);this._insertToArrayIfDoesNotExists(b,a); +b.sort(function(a,b){return a-b});return b},_createPagingInfo:function(){if(0>=this._totalRecordCount)this._$pageInfoSpan.empty();else{var a=(this._currentPageNo-1)*this.options.pageSize+1,b=this._currentPageNo*this.options.pageSize,b=this._normalizeNumber(b,a,this._totalRecordCount,0);b>=a&&(a=this._formatString(this.options.messages.pagingInfo,a,b,this._totalRecordCount),this._$pageInfoSpan.html(a))}},_bindClickEventsToPageNumberButtons:function(){var a=this;a._$pagingListArea.find(".jtable-page-number,.jtable-page-number-previous,.jtable-page-number-next,.jtable-page-number-first,.jtable-page-number-last").not(".jtable-page-number-disabled").click(function(b){b.preventDefault(); +a._changePage(d(this).data("pageNumber"))})},_changePage:function(a){a=this._normalizeNumber(a,1,this._calculatePageCount(),1);a==this._currentPageNo?this._refreshGotoPageInput():(this._currentPageNo=a,this._reloadTable())}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._initializeFields,a=d.hik.jtable.prototype._normalizeFieldOptions,c=d.hik.jtable.prototype._createHeaderCellForField,e=d.hik.jtable.prototype._createRecordLoadUrl;d.extend(!0,d.hik.jtable.prototype,{options:{sorting:!1,multiSorting:!1,defaultSorting:""},_lastSorting:null,_initializeFields:function(){b.apply(this,arguments);this._lastSorting=[];this.options.sorting&&this._buildDefaultSortingArray()},_normalizeFieldOptions:function(b,c){a.apply(this,arguments); +c.sorting=!1!=c.sorting},_createHeaderCellForField:function(a,b){var d=c.apply(this,arguments);this.options.sorting&&b.sorting&&this._makeColumnSortable(d,a);return d},_createRecordLoadUrl:function(){var a=e.apply(this,arguments);return a=this._addSortingInfoToUrl(a)},_buildDefaultSortingArray:function(){var a=this;d.each(a.options.defaultSorting.split(","),function(b,c){d.each(a.options.fields,function(b,d){if(d.sorting){var f=c.indexOf(b);-1<f&&(-1<c.toUpperCase().indexOf("DESC",f)?a._lastSorting.push({fieldName:b, +sortOrder:"DESC"}):a._lastSorting.push({fieldName:b,sortOrder:"ASC"}))}})})},_makeColumnSortable:function(a,b){var c=this;a.addClass("jtable-column-header-sortable").click(function(b){b.preventDefault();if(!c.options.multiSorting||!b.ctrlKey)c._lastSorting=[];c._sortTableByColumn(a)});d.each(this._lastSorting,function(c,d){d.fieldName==b&&("DESC"==d.sortOrder?a.addClass("jtable-column-header-sorted-desc"):a.addClass("jtable-column-header-sorted-asc"))})},_sortTableByColumn:function(a){0==this._lastSorting.length&& a.siblings().removeClass("jtable-column-header-sorted-asc jtable-column-header-sorted-desc");for(var b=0;b<this._lastSorting.length;b++)this._lastSorting[b].fieldName==a.data("fieldName")&&this._lastSorting.splice(b--,1);a.hasClass("jtable-column-header-sorted-asc")?(a.removeClass("jtable-column-header-sorted-asc").addClass("jtable-column-header-sorted-desc"),this._lastSorting.push({fieldName:a.data("fieldName"),sortOrder:"DESC"})):(a.removeClass("jtable-column-header-sorted-desc").addClass("jtable-column-header-sorted-asc"), -this._lastSorting.push({fieldName:a.data("fieldName"),sortOrder:"ASC"}));this._reloadTable()},_addSortingInfoToUrl:function(a){if(!this.options.sorting||0==this._lastSorting.length)return a;var b=[];c.each(this._lastSorting,function(a,c){b.push(c.fieldName+" "+c.sortOrder)});return a+(0>a.indexOf("?")?"?":"&")+"jtSorting="+b.join(",")}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._create,a=c.hik.jtable.prototype._normalizeFieldOptions,d=c.hik.jtable.prototype._createHeaderCellForField,f=c.hik.jtable.prototype._createCellForRecordField;c.extend(!0,c.hik.jtable.prototype,{options:{tableId:void 0,columnResizable:!0,columnSelectable:!0,saveUserPreferences:!0},_$columnSelectionDiv:null,_$columnResizeBar:null,_cookieKeyPrefix:null,_currentResizeArgs:null,_create:function(){b.apply(this,arguments);this._createColumnResizeBar();this._createColumnSelection(); -this._cookieKeyPrefix=this._generateCookieKeyPrefix();this.options.saveUserPreferences&&this._loadColumnSettings();this._normalizeColumnWidths()},_normalizeFieldOptions:function(b,e){a.apply(this,arguments);this.options.columnResizable&&(e.columnResizable=!1!=e.columnResizable);e.visibility||(e.visibility="visible")},_createHeaderCellForField:function(a,b){var c=d.apply(this,arguments);this.options.columnResizable&&(b.columnResizable&&a!=this._columnList[this._columnList.length-1])&&this._makeColumnResizable(c); -"hidden"==b.visibility&&c.hide();return c},_createCellForRecordField:function(a,b){var c=f.apply(this,arguments);"hidden"==this.options.fields[b].visibility&&c.hide();return c},changeColumnVisibility:function(a,b){this._changeColumnVisibilityInternal(a,b);this._normalizeColumnWidths();this.options.saveUserPreferences&&this._saveColumnSettings()},_changeColumnVisibilityInternal:function(a,b){var c=this._columnList.indexOf(a);if(0>c)this._logWarn('Column "'+a+'" does not exist in fields!');else if(0> -["visible","hidden","fixed"].indexOf(b))this._logWarn('Visibility value is not valid: "'+b+'"! Options are: visible, hidden, fixed.');else{var d=this.options.fields[a];d.visibility!=b&&(c=this._firstDataColumnOffset+c+1,"hidden"!=d.visibility&&"hidden"==b?this._$table.find(">thead >tr >th:nth-child("+c+"),>tbody >tr >td:nth-child("+c+")").hide():"hidden"==d.visibility&&"hidden"!=b&&this._$table.find(">thead >tr >th:nth-child("+c+"),>tbody >tr >td:nth-child("+c+")").show().css("display","table-cell"), -d.visibility=b)}},_createColumnSelection:function(){var a=this;this._$columnSelectionDiv=c("<div />").addClass("jtable-column-selection-container").appendTo(a._$mainContainer);this._$table.children("thead").bind("contextmenu",function(b){if(a.options.columnSelectable){b.preventDefault();c("<div />").addClass("jtable-contextmenu-overlay").click(function(){c(this).remove();a._$columnSelectionDiv.hide()}).bind("contextmenu",function(){return!1}).appendTo(document.body);a._fillColumnSelection();var d= -a._$mainContainer.offset(),f=b.pageY-d.top;b=b.pageX-d.left;d=a._$mainContainer.width();100<d&&b>d-100&&(b=d-100);a._$columnSelectionDiv.css({left:b,top:f,"min-width":"100px"}).show()}})},_fillColumnSelection:function(){for(var a=this,b=c("<ul></ul>").addClass("jtable-column-select-list"),d=0;d<this._columnList.length;d++){var f=this._columnList[d],h=this.options.fields[f],l=c("<li></li>").appendTo(b),l=c('<label for="'+f+'"></label>').append(c("<span>"+(h.title||f)+"</span>")).appendTo(l),f=c('<input type="checkbox" name="'+ -f+'">').prependTo(l).click(function(){var b=c(this),e=b.attr("name");"fixed"!=a.options.fields[e].visibility&&a.changeColumnVisibility(e,b.is(":checked")?"visible":"hidden")});"hidden"!=h.visibility&&f.attr("checked","checked");"fixed"==h.visibility&&f.attr("disabled","disabled")}this._$columnSelectionDiv.html(b)},_createColumnResizeBar:function(){this._$columnResizeBar=c("<div />").addClass("jtable-column-resize-bar").appendTo(this._$mainContainer).hide()},_makeColumnResizable:function(a){var b= -this;c("<div />").addClass("jtable-column-resize-handler").appendTo(a.find(".jtable-column-header-container")).mousedown(function(d){d.preventDefault();d.stopPropagation();var f=b._$mainContainer.offset(),h=a.nextAll("th.jtable-column-header:visible:first");if(h.length){b._currentResizeArgs={currentColumnStartWidth:a.outerWidth(),minWidth:10,maxWidth:a.outerWidth()+h.outerWidth()-10,mouseStartX:d.pageX,minResizeX:function(){return this.mouseStartX-(this.currentColumnStartWidth-this.minWidth)},maxResizeX:function(){return this.mouseStartX+ -(this.maxWidth-this.currentColumnStartWidth)}};var l=function(a){b._currentResizeArgs&&(a=b._normalizeNumber(a.pageX,b._currentResizeArgs.minResizeX(),b._currentResizeArgs.maxResizeX()),b._$columnResizeBar.css("left",a-f.left+"px"))},m=function(d){if(b._currentResizeArgs){c(document).unbind("mousemove",l);c(document).unbind("mouseup",m);b._$columnResizeBar.hide();d=b._normalizeNumber(b._currentResizeArgs.currentColumnStartWidth+(d.pageX-b._currentResizeArgs.mouseStartX),b._currentResizeArgs.minWidth, -b._currentResizeArgs.maxWidth);var f=h.outerWidth()+(b._currentResizeArgs.currentColumnStartWidth-d),j=a.data("width-in-percent")/b._currentResizeArgs.currentColumnStartWidth;a.data("width-in-percent",d*j);h.data("width-in-percent",f*j);a.css("width",a.data("width-in-percent")+"%");h.css("width",h.data("width-in-percent")+"%");b._normalizeColumnWidths();b._currentResizeArgs=null;b.options.saveUserPreferences&&b._saveColumnSettings()}};b._$columnResizeBar.show().css({top:a.offset().top-f.top+"px", -left:d.pageX-f.left+"px",height:b._$table.outerHeight()+"px"});c(document).bind("mousemove",l);c(document).bind("mouseup",m)}})},_normalizeColumnWidths:function(){var a=this._$table.find(">thead th.jtable-command-column-header").data("width-in-percent",1).css("width","1%"),b=this._$table.find(">thead th.jtable-column-header"),d=0;b.each(function(){var a=c(this);a.is(":visible")&&(d+=a.outerWidth())});var f={},h=100-a.length;b.each(function(){var a=c(this);if(a.is(":visible")){var b=a.data("fieldName"), -a=a.outerWidth()*h/d;f[b]=a}});b.each(function(){var a=c(this);if(a.is(":visible")){var b=a.data("fieldName");a.data("width-in-percent",f[b]).css("width",f[b]+"%")}})},_saveColumnSettings:function(){var a=this,b="";this._$table.find(">thead >tr >th.jtable-column-header").each(function(){var d=c(this),f=d.data("fieldName"),d=d.data("width-in-percent");b=b+(f+"="+a.options.fields[f].visibility+";"+d)+"|"});this._setCookie("column-settings",b.substr(0,b.length-1))},_loadColumnSettings:function(){var a= -this,b=this._getCookie("column-settings");if(b){var d={};c.each(b.split("|"),function(a,b){var c=b.split("="),e=c[0],c=c[1].split(";");d[e]={columnVisibility:c[0],columnWidth:c[1]}});this._$table.find(">thead >tr >th.jtable-column-header").each(function(){var b=c(this),e=b.data("fieldName"),f=a.options.fields[e];d[e]&&("fixed"!=f.visibility&&a._changeColumnVisibilityInternal(e,d[e].columnVisibility),b.data("width-in-percent",d[e].columnWidth).css("width",d[e].columnWidth+"%"))})}},_setCookie:function(a, -b){a=this._cookieKeyPrefix+a;var c=new Date;c.setDate(c.getDate()+30);document.cookie=encodeURIComponent(a)+"="+encodeURIComponent(b)+"; expires="+c.toUTCString()},_getCookie:function(a){a=this._cookieKeyPrefix+a;for(var b=document.cookie.split("; "),c=0;c<b.length;c++)if(b[c]){var d=b[c].split("=");if(2==d.length&&decodeURIComponent(d[0])===a)return decodeURIComponent(d[1]||"")}return null},_generateCookieKeyPrefix:function(){var a="";this.options.tableId&&(a=a+this.options.tableId+"#");a=a+this._columnList.join("$")+ -"#c"+this._$table.find("thead th").length;var b=0;if(0!=a.length)for(var c=0;c<a.length;c++)var d=a.charCodeAt(c),b=(b<<5)-b+d,b=b&b;return"jtable#"+b}})})(jQuery); -(function(c){var b=c.hik.jtable.prototype._removeRowsFromTable;c.extend(!0,c.hik.jtable.prototype,{options:{openChildAsAccordion:!1},openChildTable:function(a,b,f){var g=this;b.showCloseButton=!1!=b.showCloseButton;b.showCloseButton&&!b.closeRequested&&(b.closeRequested=function(){g.closeChildTable(a)});g.options.openChildAsAccordion&&a.siblings(".jtable-data-row").each(function(){g.closeChildTable(c(this))});g.closeChildTable(a,function(){var e=g.getChildRow(a).children("td").empty(),j=c("<div />").addClass("jtable-child-table-container").appendTo(e); -e.data("childTable",j);j.jtable(b);g.openChildRow(a);j.hide().slideDown("fast",function(){f&&f({childTable:j})})})},closeChildTable:function(a,b){var c=this,g=this.getChildRow(a).children("td"),e=g.data("childTable");e?(g.data("childTable",null),e.slideUp("fast",function(){e.jtable("destroy");e.remove();c.closeChildRow(a);b&&b()})):b&&b()},isChildRowOpen:function(a){return this.getChildRow(a).is(":visible")},getChildRow:function(a){return a.data("childRow")||this._createChildRow(a)},openChildRow:function(a){a= -this.getChildRow(a);a.is(":visible")||a.show();return a},closeChildRow:function(a){a=this.getChildRow(a);a.is(":visible")&&a.hide()},_removeRowsFromTable:function(a,d){var f=this;"deleted"==d&&a.each(function(){var a=c(this),b=a.data("childRow");b&&(f.closeChildTable(a),b.remove())});b.apply(this,arguments)},_createChildRow:function(a){var b=this._$table.find("thead th").length,b=c("<tr></tr>").addClass("jtable-child-row").append('<td colspan="'+b+'"></td>');a.after(b);a.data("childRow",b);b.hide(); +this._lastSorting.push({fieldName:a.data("fieldName"),sortOrder:"ASC"}));this._reloadTable()},_addSortingInfoToUrl:function(a){if(!this.options.sorting||0==this._lastSorting.length)return a;var b=[];d.each(this._lastSorting,function(a,c){b.push(c.fieldName+" "+c.sortOrder)});return a+(0>a.indexOf("?")?"?":"&")+"jtSorting="+b.join(",")}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._normalizeFieldOptions,c=d.hik.jtable.prototype._createHeaderCellForField,e=d.hik.jtable.prototype._createCellForRecordField;d.extend(!0,d.hik.jtable.prototype,{options:{tableId:void 0,columnResizable:!0,columnSelectable:!0},_$columnSelectionDiv:null,_$columnResizeBar:null,_cookieKeyPrefix:null,_currentResizeArgs:null,_create:function(){b.apply(this,arguments);this._createColumnResizeBar();this._createColumnSelection();this.options.saveUserPreferences&& +this._loadColumnSettings();this._normalizeColumnWidths()},_normalizeFieldOptions:function(b,c){a.apply(this,arguments);this.options.columnResizable&&(c.columnResizable=!1!=c.columnResizable);c.visibility||(c.visibility="visible")},_createHeaderCellForField:function(a,b){var d=c.apply(this,arguments);this.options.columnResizable&&(b.columnResizable&&a!=this._columnList[this._columnList.length-1])&&this._makeColumnResizable(d);"hidden"==b.visibility&&d.hide();return d},_createCellForRecordField:function(a, +b){var c=e.apply(this,arguments);"hidden"==this.options.fields[b].visibility&&c.hide();return c},changeColumnVisibility:function(a,b){this._changeColumnVisibilityInternal(a,b);this._normalizeColumnWidths();this.options.saveUserPreferences&&this._saveColumnSettings()},_changeColumnVisibilityInternal:function(a,b){var c=this._columnList.indexOf(a);if(0>c)this._logWarn('Column "'+a+'" does not exist in fields!');else if(0>["visible","hidden","fixed"].indexOf(b))this._logWarn('Visibility value is not valid: "'+ +b+'"! Options are: visible, hidden, fixed.');else{var d=this.options.fields[a];d.visibility!=b&&(c=this._firstDataColumnOffset+c+1,"hidden"!=d.visibility&&"hidden"==b?this._$table.find(">thead >tr >th:nth-child("+c+"),>tbody >tr >td:nth-child("+c+")").hide():"hidden"==d.visibility&&"hidden"!=b&&this._$table.find(">thead >tr >th:nth-child("+c+"),>tbody >tr >td:nth-child("+c+")").show().css("display","table-cell"),d.visibility=b)}},_createColumnSelection:function(){var a=this;this._$columnSelectionDiv= +d("<div />").addClass("jtable-column-selection-container").appendTo(a._$mainContainer);this._$table.children("thead").bind("contextmenu",function(b){if(a.options.columnSelectable){b.preventDefault();d("<div />").addClass("jtable-contextmenu-overlay").click(function(){d(this).remove();a._$columnSelectionDiv.hide()}).bind("contextmenu",function(){return!1}).appendTo(document.body);a._fillColumnSelection();var c=a._$mainContainer.offset(),e=b.pageY-c.top;b=b.pageX-c.left;c=a._$mainContainer.width(); +100<c&&b>c-100&&(b=c-100);a._$columnSelectionDiv.css({left:b,top:e,"min-width":"100px"}).show()}})},_fillColumnSelection:function(){for(var a=this,b=d("<ul></ul>").addClass("jtable-column-select-list"),c=0;c<this._columnList.length;c++){var e=this._columnList[c],h=this.options.fields[e],l=d("<li></li>").appendTo(b),l=d('<label for="'+e+'"></label>').append(d("<span>"+(h.title||e)+"</span>")).appendTo(l),e=d('<input type="checkbox" name="'+e+'">').prependTo(l).click(function(){var b=d(this),c=b.attr("name"); +"fixed"!=a.options.fields[c].visibility&&a.changeColumnVisibility(c,b.is(":checked")?"visible":"hidden")});"hidden"!=h.visibility&&e.attr("checked","checked");"fixed"==h.visibility&&e.attr("disabled","disabled")}this._$columnSelectionDiv.html(b)},_createColumnResizeBar:function(){this._$columnResizeBar=d("<div />").addClass("jtable-column-resize-bar").appendTo(this._$mainContainer).hide()},_makeColumnResizable:function(a){var b=this;d("<div />").addClass("jtable-column-resize-handler").appendTo(a.find(".jtable-column-header-container")).mousedown(function(c){c.preventDefault(); +c.stopPropagation();var e=b._$mainContainer.offset(),h=a.nextAll("th.jtable-column-header:visible:first");if(h.length){b._currentResizeArgs={currentColumnStartWidth:a.outerWidth(),minWidth:10,maxWidth:a.outerWidth()+h.outerWidth()-10,mouseStartX:c.pageX,minResizeX:function(){return this.mouseStartX-(this.currentColumnStartWidth-this.minWidth)},maxResizeX:function(){return this.mouseStartX+(this.maxWidth-this.currentColumnStartWidth)}};var l=function(a){b._currentResizeArgs&&(a=b._normalizeNumber(a.pageX, +b._currentResizeArgs.minResizeX(),b._currentResizeArgs.maxResizeX()),b._$columnResizeBar.css("left",a-e.left+"px"))},m=function(c){if(b._currentResizeArgs){d(document).unbind("mousemove",l);d(document).unbind("mouseup",m);b._$columnResizeBar.hide();c=b._normalizeNumber(b._currentResizeArgs.currentColumnStartWidth+(c.pageX-b._currentResizeArgs.mouseStartX),b._currentResizeArgs.minWidth,b._currentResizeArgs.maxWidth);var e=h.outerWidth()+(b._currentResizeArgs.currentColumnStartWidth-c),j=a.data("width-in-percent")/ +b._currentResizeArgs.currentColumnStartWidth;a.data("width-in-percent",c*j);h.data("width-in-percent",e*j);a.css("width",a.data("width-in-percent")+"%");h.css("width",h.data("width-in-percent")+"%");b._normalizeColumnWidths();b._currentResizeArgs=null;b.options.saveUserPreferences&&b._saveColumnSettings()}};b._$columnResizeBar.show().css({top:a.offset().top-e.top+"px",left:c.pageX-e.left+"px",height:b._$table.outerHeight()+"px"});d(document).bind("mousemove",l);d(document).bind("mouseup",m)}})},_normalizeColumnWidths:function(){var a= +this._$table.find(">thead th.jtable-command-column-header").data("width-in-percent",1).css("width","1%"),b=this._$table.find(">thead th.jtable-column-header"),c=0;b.each(function(){var a=d(this);a.is(":visible")&&(c+=a.outerWidth())});var e={},h=100-a.length;b.each(function(){var a=d(this);if(a.is(":visible")){var b=a.data("fieldName"),a=a.outerWidth()*h/c;e[b]=a}});b.each(function(){var a=d(this);if(a.is(":visible")){var b=a.data("fieldName");a.data("width-in-percent",e[b]).css("width",e[b]+"%")}})}, +_saveColumnSettings:function(){var a=this,b="";this._$table.find(">thead >tr >th.jtable-column-header").each(function(){var c=d(this),e=c.data("fieldName"),c=c.data("width-in-percent");b=b+(e+"="+a.options.fields[e].visibility+";"+c)+"|"});this._setCookie("column-settings",b.substr(0,b.length-1))},_loadColumnSettings:function(){var a=this,b=this._getCookie("column-settings");if(b){var c={};d.each(b.split("|"),function(a,b){var d=b.split("="),e=d[0],d=d[1].split(";");c[e]={columnVisibility:d[0],columnWidth:d[1]}}); +this._$table.find(">thead >tr >th.jtable-column-header").each(function(){var b=d(this),e=b.data("fieldName"),f=a.options.fields[e];c[e]&&("fixed"!=f.visibility&&a._changeColumnVisibilityInternal(e,c[e].columnVisibility),b.data("width-in-percent",c[e].columnWidth).css("width",c[e].columnWidth+"%"))})}}})})(jQuery); +(function(d){var b=d.hik.jtable.prototype._removeRowsFromTable;d.extend(!0,d.hik.jtable.prototype,{options:{openChildAsAccordion:!1},openChildTable:function(a,b,e){var g=this;b.showCloseButton=!1!=b.showCloseButton;b.showCloseButton&&!b.closeRequested&&(b.closeRequested=function(){g.closeChildTable(a)});g.options.openChildAsAccordion&&a.siblings(".jtable-data-row").each(function(){g.closeChildTable(d(this))});g.closeChildTable(a,function(){var f=g.getChildRow(a).children("td").empty(),j=d("<div />").addClass("jtable-child-table-container").appendTo(f); +f.data("childTable",j);j.jtable(b);g.openChildRow(a);j.hide().slideDown("fast",function(){e&&e({childTable:j})})})},closeChildTable:function(a,b){var d=this,g=this.getChildRow(a).children("td"),f=g.data("childTable");f?(g.data("childTable",null),f.slideUp("fast",function(){f.jtable("destroy");f.remove();d.closeChildRow(a);b&&b()})):b&&b()},isChildRowOpen:function(a){return this.getChildRow(a).is(":visible")},getChildRow:function(a){return a.data("childRow")||this._createChildRow(a)},openChildRow:function(a){a= +this.getChildRow(a);a.is(":visible")||a.show();return a},closeChildRow:function(a){a=this.getChildRow(a);a.is(":visible")&&a.hide()},_removeRowsFromTable:function(a,c){var e=this;"deleted"==c&&a.each(function(){var a=d(this),b=a.data("childRow");b&&(e.closeChildTable(a),b.remove())});b.apply(this,arguments)},_createChildRow:function(a){var b=this._$table.find("thead th").length,b=d("<tr></tr>").addClass("jtable-child-row").append('<td colspan="'+b+'"></td>');a.after(b);a.data("childRow",b);b.hide(); return b}})})(jQuery);
\ No newline at end of file diff --git a/lib/localization/jquery.jtable.it.js b/lib/localization/jquery.jtable.it.js index 728b481..1b2096a 100644 --- a/lib/localization/jquery.jtable.it.js +++ b/lib/localization/jquery.jtable.it.js @@ -23,8 +23,8 @@ pagingInfo: 'Visualizzazione record da {0} a {1} su {2}', canNotDeletedRecords: 'Impossibile eliminare il record {0} di {1}!', deleteProggress: 'Eliminazione di {0} di {1} record in corso...', - pageSizeChangeLabel: 'Row count', //New. Must be localized. - gotoPageLabel: 'Go to page' //New. Must be localized. + pageSizeChangeLabel: 'Righe per pagina', + gotoPageLabel: 'Vai alla pagina' }); })(jQuery);
\ No newline at end of file diff --git a/lib/localization/jquery.jtable.nl-NL.js b/lib/localization/jquery.jtable.nl-NL.js new file mode 100644 index 0000000..942ef0f --- /dev/null +++ b/lib/localization/jquery.jtable.nl-NL.js @@ -0,0 +1,30 @@ +/* + jTable localization file for 'Dutch - The Netherlands' language. + Author: Bert Janssen +*/ +(function ($) { + + $.extend(true, $.hik.jtable.prototype.options.messages, { + serverCommunicationError: 'Fout bij het communiceren met de server', + loadingMessage: 'Laden...', + noDataAvailable: 'Geen gegevens beschikbaar!', + addNewRecord: '+ Toevoegen', + editRecord: 'Bewerken', + areYouSure: 'Weet u het zeker?', + deleteConfirmation: 'Gegevens verwijderen?', + save: 'Opslaan', + saving: 'Gegevens opslaan', + cancel: 'Annuleren', + deleteText: 'Wissen', + deleting: 'Gegevens wissen', + error: 'Er is een fout opgetreden!', + close: 'Sluiten', + cannotLoadOptionsFor: 'Kan de instellingen voor {0} niet laden', + pagingInfo: 'Pagina {0} tot {1} van {2}', + canNotDeletedRecords: 'Kan gegevens {0} van {1} niet wissen!', + deleteProggress: 'Gegevens {0} van {1} wissen...', + pageSizeChangeLabel: 'Row count', //New. Must be localized. + gotoPageLabel: 'Go to page' //New. Must be localized. +}); + +})(jQuery); |