{"version":3,"sources":["jquery.ewjtable.js"],"names":["$","unloadingPage","window","on","widget","options","actions","fields","animationsEnabled","defaultDateFormat","dialogShowEffect","dialogHideEffect","showCloseButton","loadingAnimationDelay","saveUserPreferences","jqueryuiTheme","unAuthorizedRequestRedirectUrl","ajaxSettings","type","dataType","toolbar","hoverAnimation","hoverAnimationDuration","hoverAnimationEasing","undefined","items","closeRequested","event","data","formCreated","formSubmitting","formClosed","loadingRecords","recordsLoaded","rowInserted","rowsRemoved","messages","serverCommunicationError","loadingMessage","noDataAvailable","close","_$mainContainer","_$titleDiv","_$toolbarDiv","_$table","_$tableBody","_$tableRows","_$busyDiv","_$busyMessageDiv","_columnList","_fieldList","_keyField","_firstDataColumnOffset","_lastPostData","_cache","_create","this","_normalizeFieldsOptions","_initializeFields","_createFieldAndColumnList","_createMainContainer","_createTableTitle","_createToolBar","_createTable","_createBusyPanel","_addNoDataRow","_cookieKeyPrefix","_generateCookieKeyPrefix","self","each","fieldName","props","_normalizeFieldOptions","listClass","inputClass","dependsOn","dependsOnArray","split","i","length","push","trim","name","key","list","addClass","appendTo","element","_jqueryuiThemeAddClass","title","$titleDiv","append","$textSpan","html","attr","click","e","preventDefault","stopPropagation","_onCloseRequested","tableId","_createTableHead","_createTableBody","$thead","_addRowToTableHead","$tr","_addColumnsToHeaderRow","_createHeaderCellForField","field","$headerTextSpan","$headerContainerDiv","$th","css","width","_createEmptyCommandHeader","prependTo","_hideBusy","load","postData","completeCallback","_reloadTable","reload","getRowByKey","_getKeyValueOfRecord","destroy","empty","Widget","prototype","call","_setOption","value","completeReload","result","_removeAllRows","_addRecordsToTable","records","_onRecordsLoaded","_showError","message","_showBusy","_onLoadingRecords","isFunction","listAction","funcResult","_createJtParamsForLoading","_isDeferredObject","done","fail","always","loadUrl","_createRecordLoadUrl","_ajax","url","success","error","_createRowFromRecord","record","_addCellsToRowUsingRecord","$row","_createCellForRecordField","_getDisplayTextForRecordField","index","_addRow","_refreshRowStyles","_addRowToTable","$tableRow","isNewRow","_normalizeNumber","extend","_removeNoDataRow","prepend","unshift","after","splice","_onRowInserted","_showNewRowAnimation","className","removeClass","_removeRowsFromTable","$rows","reason","remove","_findRowIndex","_onRowsRemoved","_findIndexInArray","$row1","$row2","find","totalColumnCount","fieldValue","display","_getDisplayTextForDateRecordField","displayFormat","ew","formatDate","_addToolBarItem","item","text","icon","_logWarn","$toolBarItem","cssClass","tooltip","$icon","hover","alert","_setBusyTimer","delay","height","show","makeVisible","setTimeout","clearTimeout","hide","_isBusy","is","$elm","hoverClassName","_performAjaxCall","async","_unAuthorizedRequestHandler","location","href","opts","statusCode","401","unAuthorizedRequest","jqXHR","textStatus","errorThrown","abort","arguments","complete","ajax","_setCookie","expireDate","Date","setDate","getDate","document","cookie","encodeURIComponent","toUTCString","_getCookie","equalities","splitted","decodeURIComponent","strToHash","hash","charCodeAt","simpleHash","join","_trigger","serverResponse","row","rows","jQuery","ewjtable","_getPropertyOfObject","obj","propName","indexOf","preDot","substring","postDot","_setPropertyOfObject","_insertToArrayIfDoesNotExists","array","inArray","compareFunc","a","b","number","min","max","defaultValue","isNaN","_formatString","str","placeHolder","replace","then","_logDebug","console","log","_logInfo","_logError","Array","elt","len","from","Number","Math","ceil","floor","base","selecting","multiselect","selectingCheckboxes","selectOnRowClick","selectionChanged","_selectedRecordIdsBeforeLoad","_$selectAllCheckbox","_shiftKeyDown","_bindKeyboardEvents","apply","keydown","which","keyup","selectedRows","_getSelectedRows","selectRows","_selectRows","_onSelectionChanged","Event","_createSelectAllHeader","_makeRowSelectable","_storeSelectionList","_restoreSelectionList","filter","$columnHeader","$headerContainer","prop","allRows","_deselectRows","selectedRowCount","recordId","_refreshSelectAllCheckboxState","target","_invertRowSelection","$cell","id","random","$selectCheckbox","hasClass","rowIndex","beforeIndex","_findFirstSelectedRowIndexBeforeIndex","slice","afterIndex","_findFirstSelectedRowIndexAfterIndex","totalRowCount","paging","pageList","pageSize","pageSizes","pageSizeChangeArea","gotoPageArea","pagingInfo","pageSizeChangeLabel","gotoPageLabel","_$bottomPanel","_$pagingListArea","_$pageSizeChangeArea","_$pageInfoSpan","_$gotoPageArea","_$gotoPageInput","_totalRecordCount","_currentPageNo","_loadPagingSettings","_createBottomPanel","_createPageListArea","_createGotoPageInput","_createPageSizeSelection","insertAfter","parseInt","sort","$pageSizeChangeCombobox","val","change","_changePageSize","_changePage","keypress","keyCode","shiftKey","altKey","_refreshGotoPageInput","oldPageCount","currentPageCount","_calculatePageCount","pageStep","pageCount","_savePagingSettings","_addPagingInfoToUrl","jtParams","start","recperpage","totalRecordCount","_createPagingList","_createPagingInfo","pageNumber","startIndex","_createFirstAndPreviousPageButtons","_createPageNumberButtons","_calculatePageNumbers","_createLastAndNextPageButtons","_bindClickEventsToPageNumberButtons","wrapInner","$first","$previous","$next","$last","pageNumbers","previousNumber","_createPageNumberButton","$pageNumber","shownPageNumbers","previousPageNo","nextPageNo","startNo","endNo","pagingInfoMessage","not","pageNo","sorting","multiSorting","defaultSorting","_lastSorting","_buildDefaultSortingArray","$headerCell","_makeColumnSortable","_addSortingInfoToUrl","orderIndex","orderValue","fieldProps","colOffset","toUpperCase","sortOrder","ctrlKey","_sortTableByColumn","sortIndex","sortField","siblings","idx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCC,SAAUA,GAEV,IAAIC,EAEJD,EAAEE,QAAQC,GAAG,gBAAgB,WAC5BF,GAAgB,KAEjBD,EAAEE,QAAQC,GAAG,UAAU,WACtBF,GAAgB,KAGjBD,EAAEI,OAAO,cAAe,CAKvBC,QAAS,CAGRC,QAAS,GACTC,OAAQ,GACRC,mBAAmB,EACnBC,kBAAmB,KACnBC,iBAAkB,OAClBC,iBAAkB,OAClBC,iBAAiB,EACjBC,sBAAuB,IACvBC,qBAAqB,EACrBC,eAAe,EACfC,+BAAgC,KAEhCC,aAAc,CACbC,KAAM,OACNC,SAAU,QAGXC,QAAS,CACRC,gBAAgB,EAChBC,uBAAwB,GACxBC,0BAAsBC,E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AcpS,KAAK,aAChC+Y,UAAW,WAGZ3G,EAAc/I,YAAY,sCAAsC5F,SAAS,qCACzE7B,KAAKyW,aAAajV,KAAK,CACtBV,UAAa0P,EAAcpS,KAAK,aAChC+Y,UAAW,SAKbnX,KAAKgE,gBAKN6S,qBAAsB,SAAU7Q,GAC/B,IAAKhG,KAAKnD,QAAQyZ,SAAuC,GAA5BtW,KAAKyW,aAAalV,OAC9C,OAAOyE,EAGR,IAAIsQ,EAAU,GAKd,OAJA9Z,EAAEqE,KAAKb,KAAKyW,cAAc,SAAUgB,EAAK/S,GACxC4R,EAAQ9U,KAAKkD,EAAM5D,UAAY,IAAM4D,EAAMyS,cAGpCnR,GAAOA,EAAI6G,QAAQ,KAAO,EAAI,IAAM,KAAO,WAAayJ,EAAQnK,KAAK,MAK9E3G,0BAA2B,WAC1B,IAAIgP,EAAWzF,EAAKvJ,0BAA0BiK,MAAMzP,KAAM+K,WAE1D,GAAI/K,KAAKnD,QAAQyZ,SAAWtW,KAAKyW,aAAalV,OAAQ,CACrD,IAAI+U,EAAU,GACd9Z,EAAEqE,KAAKb,KAAKyW,cAAc,SAAUgB,EAAK/S,GACxC4R,EAAQ9U,KAAKkD,EAAM5D,UAAY,IAAM4D,EAAMyS,cAG5C3C,EAAS8B,QAAUA,EAAQnK,KAAK,KAGjC,OAAOqI,KAjMV,CAsMGhI","sourcesContent":["/*\r\n\r\newjTable (requires ew*.js)\r\n@license Copyright (C) 2017 by e.World Technology Limited (http://www.hkvstore.com)\r\n\r\nBased on:\r\n\r\njTable 2.4.0\r\nhttp://www.jtable.org\r\n\r\n---------------------------------------------------------------------------\r\n\r\nCopyright (C) 2011-2014 by Halil İbrahim Kalkan (http://www.halilibrahimkalkan.com)\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n\r\n*/\r\n\r\n/************************************************************************\r\n* CORE ewjTable module *\r\n*************************************************************************/\r\n(function ($) {\r\n\r\n\tvar unloadingPage;\r\n\r\n\t$(window).on('beforeunload', function () {\r\n\t\tunloadingPage = true;\r\n\t});\r\n\t$(window).on('unload', function () {\r\n\t\tunloadingPage = false;\r\n\t});\r\n\r\n\t$.widget(\"ew.ewjtable\", {\r\n\r\n\t\t/************************************************************************\r\n\t\t* DEFAULT OPTIONS / EVENTS *\r\n\t\t*************************************************************************/\r\n\t\toptions: {\r\n\r\n\t\t\t//Options\r\n\t\t\tactions: {},\r\n\t\t\tfields: {},\r\n\t\t\tanimationsEnabled: true,\r\n\t\t\tdefaultDateFormat: null,\r\n\t\t\tdialogShowEffect: 'fade',\r\n\t\t\tdialogHideEffect: 'fade',\r\n\t\t\tshowCloseButton: false,\r\n\t\t\tloadingAnimationDelay: 500,\r\n\t\t\tsaveUserPreferences: true,\r\n\t\t\tjqueryuiTheme: false,\r\n\t\t\tunAuthorizedRequestRedirectUrl: null,\r\n\r\n\t\t\tajaxSettings: {\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\tdataType: 'json'\r\n\t\t\t},\r\n\r\n\t\t\ttoolbar: {\r\n\t\t\t\thoverAnimation: true,\r\n\t\t\t\thoverAnimationDuration: 60,\r\n\t\t\t\thoverAnimationEasing: undefined,\r\n\t\t\t\titems: []\r\n\t\t\t},\r\n\r\n\t\t\t//Events\r\n\t\t\tcloseRequested: function (event, data) { },\r\n\t\t\tformCreated: function (event, data) { },\r\n\t\t\tformSubmitting: function (event, data) { },\r\n\t\t\tformClosed: function (event, data) { },\r\n\t\t\tloadingRecords: function (event, data) { },\r\n\t\t\trecordsLoaded: function (event, data) { },\r\n\t\t\trowInserted: function (event, data) { },\r\n\t\t\trowsRemoved: function (event, data) { },\r\n\r\n\t\t\t//Localization\r\n\t\t\tmessages: {\r\n\t\t\t\tserverCommunicationError: 'An error occured while communicating to the server.',\r\n\t\t\t\tloadingMessage: 'Loading records...',\r\n\t\t\t\tnoDataAvailable: 'No data available!',\r\n\t\t\t\tclose: 'Close'\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE FIELDS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_$mainContainer: null, //Reference to the main container of all elements that are created by this plug-in (jQuery object)\r\n\r\n\t\t_$titleDiv: null, //Reference to the title div (jQuery object)\r\n\t\t_$toolbarDiv: null, //Reference to the toolbar div (jQuery object)\r\n\r\n\t\t_$table: null, //Reference to the main (jQuery object)\r\n\t\t_$tableBody: null, //Reference to in the table (jQuery object)\r\n\t\t_$tableRows: null, //Array of all in the table (except \"no data\" row) (jQuery object array)\r\n\r\n\t\t_$busyDiv: null, //Reference to the div that is used to block UI while busy (jQuery object)\r\n\t\t_$busyMessageDiv: null, //Reference to the div that is used to show some message when UI is blocked (jQuery object)\r\n\r\n\t\t_columnList: null, //Name of all data columns in the table (select column and command columns are not included) (string array)\r\n\t\t_fieldList: null, //Name of all fields of a record (defined in fields option) (string array)\r\n\t\t_keyField: null, //Name of the key field of a record (that is defined as 'key: true' in the fields option) (string)\r\n\r\n\t\t_firstDataColumnOffset: 0, //Start index of first record field in table columns (some columns can be placed before first data column, such as select checkbox column) (integer)\r\n\t\t_lastPostData: null, //Last posted data on load method (object)\r\n\r\n\t\t_cache: null, //General purpose cache dictionary (object)\r\n\r\n\t\t/************************************************************************\r\n\t\t* CONSTRUCTOR AND INITIALIZATION METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Contructor.\r\n\t\t*************************************************************************/\r\n\t\t_create: function () {\r\n\r\n\t\t\t//Initialization\r\n\t\t\tthis._normalizeFieldsOptions();\r\n\t\t\tthis._initializeFields();\r\n\t\t\tthis._createFieldAndColumnList();\r\n\r\n\t\t\t//Creating DOM elements\r\n\t\t\tthis._createMainContainer();\r\n\t\t\tthis._createTableTitle();\r\n\t\t\tthis._createToolBar();\r\n\t\t\tthis._createTable();\r\n\t\t\tthis._createBusyPanel();\r\n\t\t\tthis._addNoDataRow();\r\n\r\n\t\t\tthis._cookieKeyPrefix = this._generateCookieKeyPrefix();\r\n\t\t},\r\n\r\n\t\t/* Normalizes some options for all fields (sets default values).\r\n\t\t*************************************************************************/\r\n\t\t_normalizeFieldsOptions: function () {\r\n\t\t\tvar self = this;\r\n\t\t\t$.each(self.options.fields, function (fieldName, props) {\r\n\t\t\t\tself._normalizeFieldOptions(fieldName, props);\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Normalizes some options for a field (sets default values).\r\n\t\t*************************************************************************/\r\n\t\t_normalizeFieldOptions: function (fieldName, props) {\r\n\t\t\tif (props.listClass == undefined) {\r\n\t\t\t\tprops.listClass = '';\r\n\t\t\t}\r\n\t\t\tif (props.inputClass == undefined) {\r\n\t\t\t\tprops.inputClass = '';\r\n\t\t\t}\r\n\r\n\t\t\t//Convert dependsOn to array if it's a comma seperated lists\r\n\t\t\tif (props.dependsOn && $.type(props.dependsOn) === 'string') {\r\n\t\t\t\tvar dependsOnArray = props.dependsOn.split(',');\r\n\t\t\t\tprops.dependsOn = [];\r\n\t\t\t\tfor (var i = 0; i < dependsOnArray.length; i++) {\r\n\t\t\t\t\tprops.dependsOn.push($.trim(dependsOnArray[i]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Intializes some private variables.\r\n\t\t*************************************************************************/\r\n\t\t_initializeFields: function () {\r\n\t\t\tthis._lastPostData = {};\r\n\t\t\tthis._$tableRows = [];\r\n\t\t\tthis._columnList = [];\r\n\t\t\tthis._fieldList = [];\r\n\t\t\tthis._cache = [];\r\n\t\t},\r\n\r\n\t\t/* Fills _fieldList, _columnList arrays and sets _keyField variable.\r\n\t\t*************************************************************************/\r\n\t\t_createFieldAndColumnList: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t$.each(self.options.fields, function (name, props) {\r\n\r\n\t\t\t\t//Add field to the field list\r\n\t\t\t\tself._fieldList.push(name);\r\n\r\n\t\t\t\t//Check if this field is the key field\r\n\t\t\t\tif (props.key == true) {\r\n\t\t\t\t\tself._keyField = name;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Add field to column list if it is shown in the table\r\n\t\t\t\tif (props.list != false && props.type != 'hidden') {\r\n\t\t\t\t\tself._columnList.push(name);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Creates the main container div.\r\n\t\t*************************************************************************/\r\n\t\t_createMainContainer: function () {\r\n\t\t\tthis._$mainContainer = $('
')\r\n\t\t\t\t.addClass('ewjtable-main-container')\r\n\t\t\t\t.appendTo(this.element);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass(this._$mainContainer, 'ui-widget');\r\n\t\t},\r\n\r\n\t\t/* Creates title of the table if a title supplied in options.\r\n\t\t*************************************************************************/\r\n\t\t_createTableTitle: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tif (!self.options.title) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar $titleDiv = $('
')\r\n\t\t\t\t.addClass('ewjtable-title')\r\n\t\t\t\t.appendTo(self._$mainContainer);\r\n\r\n\t\t\tself._jqueryuiThemeAddClass($titleDiv, 'ui-widget-header');\r\n\r\n\t\t\t$('
')\r\n\t\t\t\t.addClass('ewjtable-title-text')\r\n\t\t\t\t.appendTo($titleDiv)\r\n\t\t\t\t.append(self.options.title);\r\n\r\n\t\t\tif (self.options.showCloseButton) {\r\n\r\n\t\t\t\tvar $textSpan = $('')\r\n\t\t\t\t\t.html(self.options.messages.close);\r\n\r\n\t\t\t\t$('')\r\n\t\t\t\t\t.addClass('ewjtable-command-button ewjtable-close-button')\r\n\t\t\t\t\t.attr('title', self.options.messages.close)\r\n\t\t\t\t\t.append($textSpan)\r\n\t\t\t\t\t.appendTo($titleDiv)\r\n\t\t\t\t\t.click(function (e) {\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\t\tself._onCloseRequested();\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tself._$titleDiv = $titleDiv;\r\n\t\t},\r\n\r\n\t\t/* Creates the table.\r\n\t\t*************************************************************************/\r\n\t\t_createTable: function () {\r\n\t\t\tthis._$table = $('
')\r\n\t\t\t\t.addClass('ewjtable table table-sm')\r\n\t\t\t\t.appendTo(this._$mainContainer);\r\n\r\n\t\t\tif (this.options.tableId) {\r\n\t\t\t\tthis._$table.attr('id', this.options.tableId);\r\n\t\t\t}\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass(this._$table, 'ui-widget-content');\r\n\r\n\t\t\tthis._createTableHead();\r\n\t\t\tthis._createTableBody();\r\n\t\t},\r\n\r\n\t\t/* Creates header (all column headers) of the table.\r\n\t\t*************************************************************************/\r\n\t\t_createTableHead: function () {\r\n\t\t\tvar $thead = $('')\r\n\t\t\t\t.appendTo(this._$table);\r\n\r\n\t\t\tthis._addRowToTableHead($thead);\r\n\t\t},\r\n\r\n\t\t/* Adds tr element to given thead element\r\n\t\t*************************************************************************/\r\n\t\t_addRowToTableHead: function ($thead) {\r\n\t\t\tvar $tr = $('')\r\n\t\t\t\t.appendTo($thead);\r\n\r\n\t\t\tthis._addColumnsToHeaderRow($tr);\r\n\t\t},\r\n\r\n\t\t/* Adds column header cells to given tr element.\r\n\t\t*************************************************************************/\r\n\t\t_addColumnsToHeaderRow: function ($tr) {\r\n\t\t\tfor (var i = 0; i < this._columnList.length; i++) {\r\n\t\t\t\tvar fieldName = this._columnList[i];\r\n\t\t\t\tvar $headerCell = this._createHeaderCellForField(fieldName, this.options.fields[fieldName]);\r\n\t\t\t\t$headerCell.appendTo($tr);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates a header cell for given field.\r\n\t\t* Returns th jQuery object.\r\n\t\t*************************************************************************/\r\n\t\t_createHeaderCellForField: function (fieldName, field) {\r\n\t\t\t//***field.width = field.width || '10%'; //default column width: 10%.\r\n\r\n\t\t\tvar $headerTextSpan = $('')\r\n\t\t\t\t.addClass('ewjtable-column-header-text')\r\n\t\t\t\t.html(field.title);\r\n\r\n\t\t\tvar $headerContainerDiv = $('
')\r\n\t\t\t\t.addClass('ewjtable-column-header-container')\r\n\t\t\t\t.append($headerTextSpan);\r\n\r\n\t\t\tvar $th = $('')\r\n\t\t\t\t.addClass('ewjtable-column-header')\r\n\t\t\t\t.addClass(field.listClass)\r\n\t\t\t\t.css('width', field.width)\r\n\t\t\t\t.data('fieldName', fieldName)\r\n\t\t\t\t.append($headerContainerDiv);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($th, 'ui-state-default');\r\n\r\n\t\t\treturn $th;\r\n\t\t},\r\n\r\n\t\t/* Creates an empty header cell that can be used as command column headers.\r\n\t\t*************************************************************************/\r\n\t\t_createEmptyCommandHeader: function () {\r\n\t\t\tvar $th = $('')\r\n\t\t\t\t.addClass('ewjtable-command-column-header')\r\n\t\t\t\t.css('width', '1%');\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($th, 'ui-state-default');\r\n\r\n\t\t\treturn $th;\r\n\t\t},\r\n\r\n\t\t/* Creates tbody tag and adds to the table.\r\n\t\t*************************************************************************/\r\n\t\t_createTableBody: function () {\r\n\t\t\tthis._$tableBody = $('').appendTo(this._$table);\r\n\t\t},\r\n\r\n\t\t/* Creates a div to block UI while ewjTable is busy.\r\n\t\t*************************************************************************/\r\n\t\t_createBusyPanel: function () {\r\n\t\t\tthis._$busyMessageDiv = $('
').addClass('ewjtable-busy-message').prependTo(this._$mainContainer);\r\n\t\t\tthis._$busyDiv = $('
').addClass('ewjtable-busy-panel-background').prependTo(this._$mainContainer);\r\n\t\t\tthis._jqueryuiThemeAddClass(this._$busyMessageDiv, 'ui-widget-header');\r\n\t\t\tthis._hideBusy();\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PUBLIC METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Loads data using AJAX call, clears table and fills with new data.\r\n\t\t*************************************************************************/\r\n\t\tload: function (postData, completeCallback) {\r\n\t\t\tthis._lastPostData = postData;\r\n\t\t\tthis._reloadTable(completeCallback);\r\n\t\t},\r\n\r\n\t\t/* Refreshes (re-loads) table data with last postData.\r\n\t\t*************************************************************************/\r\n\t\treload: function (completeCallback) {\r\n\t\t\tthis._reloadTable(completeCallback);\r\n\t\t},\r\n\r\n\t\t/* Gets a jQuery row object according to given record key\r\n\t\t*************************************************************************/\r\n\t\tgetRowByKey: function (key) {\r\n\t\t\tfor (var i = 0; i < this._$tableRows.length; i++) {\r\n\t\t\t\tif (key == this._getKeyValueOfRecord(this._$tableRows[i].data('record'))) {\r\n\t\t\t\t\treturn this._$tableRows[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\t\t},\r\n\r\n\t\t/* Completely removes the table from it's container.\r\n\t\t*************************************************************************/\r\n\t\tdestroy: function () {\r\n\t\t\tthis.element.empty();\r\n\t\t\t$.Widget.prototype.destroy.call(this);\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Used to change options dynamically after initialization.\r\n\t\t*************************************************************************/\r\n\t\t_setOption: function (key, value) {\r\n\r\n\t\t},\r\n\r\n\t\t/* LOADING RECORDS *****************************************************/\r\n\r\n\t\t/* Performs an AJAX call to reload data of the table.\r\n\t\t*************************************************************************/\r\n\t\t_reloadTable: function (completeCallback) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tvar completeReload = function(data) {\r\n\t\t\t\tself._hideBusy();\r\n\r\n\t\t\t\t//Show the error message if server returns error\r\n\t\t\t\tif (data.result != 'OK') { //***\r\n\t\t\t\t\tself._showError(data.message); //***\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Re-generate table rows\r\n\t\t\t\tself._removeAllRows('reloading');\r\n\t\t\t\tself._addRecordsToTable(data.records); //***\r\n\r\n\t\t\t\tself._onRecordsLoaded(data);\r\n\r\n\t\t\t\t//Call complete callback\r\n\t\t\t\tif (completeCallback) {\r\n\t\t\t\t\tcompleteCallback(data);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tself._showBusy(self.options.messages.loadingMessage, self.options.loadingAnimationDelay); //Disable table since it's busy\r\n\t\t\tself._onLoadingRecords();\r\n\r\n\t\t\t//listAction may be a function, check if it is\r\n\t\t\tif ($.isFunction(self.options.actions.listAction)) {\r\n\r\n\t\t\t\t//Execute the function\r\n\t\t\t\tvar funcResult = self.options.actions.listAction(self._lastPostData, self._createJtParamsForLoading());\r\n\r\n\t\t\t\t//Check if result is a jQuery Deferred object\r\n\t\t\t\tif (self._isDeferredObject(funcResult)) {\r\n\t\t\t\t\tfuncResult.done(function(data) {\r\n\t\t\t\t\t\tcompleteReload(data);\r\n\t\t\t\t\t}).fail(function() {\r\n\t\t\t\t\t\tself._showError(self.options.messages.serverCommunicationError);\r\n\t\t\t\t\t}).always(function() {\r\n\t\t\t\t\t\tself._hideBusy();\r\n\t\t\t\t\t});\r\n\t\t\t\t} else { //assume it's the data we're loading\r\n\t\t\t\t\tcompleteReload(funcResult);\r\n\t\t\t\t}\r\n\r\n\t\t\t} else { //assume listAction as URL string.\r\n\r\n\t\t\t\t//Generate URL (with query string parameters) to load records\r\n\t\t\t\tvar loadUrl = self._createRecordLoadUrl();\r\n\r\n\t\t\t\t//Load data from server using AJAX\r\n\t\t\t\tself._ajax({\r\n\t\t\t\t\turl: loadUrl,\r\n\t\t\t\t\tdata: self._lastPostData,\r\n\t\t\t\t\tsuccess: function (data) {\r\n\t\t\t\t\t\tcompleteReload(data);\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror: function () {\r\n\t\t\t\t\t\tself._hideBusy();\r\n\t\t\t\t\t\tself._showError(self.options.messages.serverCommunicationError);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates URL to load records.\r\n\t\t*************************************************************************/\r\n\t\t_createRecordLoadUrl: function () {\r\n\t\t\treturn this.options.actions.listAction;\r\n\t\t},\r\n\r\n\t\t_createJtParamsForLoading: function() {\r\n\t\t\treturn {\r\n\t\t\t\t//Empty as default, paging, sorting or other extensions can override this method to add additional params to load request\r\n\t\t\t};\r\n\t\t},\r\n\r\n\t\t/* TABLE MANIPULATION METHODS *******************************************/\r\n\r\n\t\t/* Creates a row from given record\r\n\t\t*************************************************************************/\r\n\t\t_createRowFromRecord: function (record) {\r\n\t\t\tvar $tr = $('')\r\n\t\t\t\t.addClass('ewjtable-data-row')\r\n\t\t\t\t.attr('data-record-key', this._getKeyValueOfRecord(record))\r\n\t\t\t\t.data('record', record);\r\n\r\n\t\t\tthis._addCellsToRowUsingRecord($tr);\r\n\t\t\treturn $tr;\r\n\t\t},\r\n\r\n\t\t/* Adds all cells to given row.\r\n\t\t*************************************************************************/\r\n\t\t_addCellsToRowUsingRecord: function ($row) {\r\n\t\t\tvar record = $row.data('record');\r\n\t\t\tfor (var i = 0; i < this._columnList.length; i++) {\r\n\t\t\t\tthis._createCellForRecordField(record, this._columnList[i])\r\n\t\t\t\t\t.appendTo($row);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Create a cell for given field.\r\n\t\t*************************************************************************/\r\n\t\t_createCellForRecordField: function (record, fieldName) {\r\n\t\t\treturn $('')\r\n\t\t\t\t.addClass(this.options.fields[fieldName].listClass)\r\n\t\t\t\t.append((this._getDisplayTextForRecordField(record, fieldName)));\r\n\t\t},\r\n\r\n\t\t/* Adds a list of records to the table.\r\n\t\t*************************************************************************/\r\n\t\t_addRecordsToTable: function (records) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t$.each(records, function (index, record) {\r\n\t\t\t\tself._addRow(self._createRowFromRecord(record));\r\n\t\t\t});\r\n\r\n\t\t\tself._refreshRowStyles();\r\n\t\t},\r\n\r\n\t\t/* Adds a single row to the table.\r\n\t\t* NOTE: THIS METHOD IS DEPRECATED AND WILL BE REMOVED FROM FEATURE RELEASES.\r\n\t\t* USE _addRow METHOD.\r\n\t\t*************************************************************************/\r\n\t\t_addRowToTable: function ($tableRow, index, isNewRow, animationsEnabled) {\r\n\t\t\tvar options = {\r\n\t\t\t\tindex: this._normalizeNumber(index, 0, this._$tableRows.length, this._$tableRows.length)\r\n\t\t\t};\r\n\r\n\t\t\tif (isNewRow == true) {\r\n\t\t\t\toptions.isNewRow = true;\r\n\t\t\t}\r\n\r\n\t\t\tif (animationsEnabled == false) {\r\n\t\t\t\toptions.animationsEnabled = false;\r\n\t\t\t}\r\n\r\n\t\t\tthis._addRow($tableRow, options);\r\n\t\t},\r\n\r\n\t\t/* Adds a single row to the table.\r\n\t\t*************************************************************************/\r\n\t\t_addRow: function ($row, options) {\r\n\t\t\t//Set defaults\r\n\t\t\toptions = $.extend({\r\n\t\t\t\tindex: this._$tableRows.length,\r\n\t\t\t\tisNewRow: false,\r\n\t\t\t\tanimationsEnabled: true\r\n\t\t\t}, options);\r\n\r\n\t\t\t//Remove 'no data' row if this is first row\r\n\t\t\tif (this._$tableRows.length <= 0) {\r\n\t\t\t\tthis._removeNoDataRow();\r\n\t\t\t}\r\n\r\n\t\t\t//Add new row to the table according to it's index\r\n\t\t\toptions.index = this._normalizeNumber(options.index, 0, this._$tableRows.length, this._$tableRows.length);\r\n\t\t\tif (options.index == this._$tableRows.length) {\r\n\t\t\t\t//add as last row\r\n\t\t\t\tthis._$tableBody.append($row);\r\n\t\t\t\tthis._$tableRows.push($row);\r\n\t\t\t} else if (options.index == 0) {\r\n\t\t\t\t//add as first row\r\n\t\t\t\tthis._$tableBody.prepend($row);\r\n\t\t\t\tthis._$tableRows.unshift($row);\r\n\t\t\t} else {\r\n\t\t\t\t//insert to specified index\r\n\t\t\t\tthis._$tableRows[options.index - 1].after($row);\r\n\t\t\t\tthis._$tableRows.splice(options.index, 0, $row);\r\n\t\t\t}\r\n\r\n\t\t\tthis._onRowInserted($row, options.isNewRow);\r\n\r\n\t\t\t//Show animation if needed\r\n\t\t\tif (options.isNewRow) {\r\n\t\t\t\tthis._refreshRowStyles();\r\n\t\t\t\tif (this.options.animationsEnabled && options.animationsEnabled) {\r\n\t\t\t\t\tthis._showNewRowAnimation($row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Shows created animation for a table row\r\n\t\t* TODO: Make this animation cofigurable and changable\r\n\t\t*************************************************************************/\r\n\t\t_showNewRowAnimation: function ($tableRow) {\r\n\t\t\tvar className = 'ewjtable-row-created';\r\n\t\t\tif (this.options.jqueryuiTheme) {\r\n\t\t\t\tclassName = className + ' ui-state-highlight';\r\n\t\t\t}\r\n\r\n\t\t\t$tableRow.addClass(className, 'slow', '', function () {\r\n\t\t\t\t$tableRow.removeClass(className, 5000);\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Removes a row or rows (jQuery selection) from table.\r\n\t\t*************************************************************************/\r\n\t\t_removeRowsFromTable: function ($rows, reason) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t//Check if any row specified\r\n\t\t\tif ($rows.length <= 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t//remove from DOM\r\n\t\t\t$rows.addClass('ewjtable-row-removed').remove();\r\n\r\n\t\t\t//remove from _$tableRows array\r\n\t\t\t$rows.each(function () {\r\n\t\t\t\tvar index = self._findRowIndex($(this));\r\n\t\t\t\tif (index >= 0) {\r\n\t\t\t\t\tself._$tableRows.splice(index, 1);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tself._onRowsRemoved($rows, reason);\r\n\r\n\t\t\t//Add 'no data' row if all rows removed from table\r\n\t\t\tif (self._$tableRows.length == 0) {\r\n\t\t\t\tself._addNoDataRow();\r\n\t\t\t}\r\n\r\n\t\t\tself._refreshRowStyles();\r\n\t\t},\r\n\r\n\t\t/* Finds index of a row in table.\r\n\t\t*************************************************************************/\r\n\t\t_findRowIndex: function ($row) {\r\n\t\t\treturn this._findIndexInArray($row, this._$tableRows, function ($row1, $row2) {\r\n\t\t\t\treturn $row1.data('record') == $row2.data('record');\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Removes all rows in the table and adds 'no data' row.\r\n\t\t*************************************************************************/\r\n\t\t_removeAllRows: function (reason) {\r\n\t\t\t//If no rows does exists, do nothing\r\n\t\t\tif (this._$tableRows.length <= 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t//Select all rows (to pass it on raising _onRowsRemoved event)\r\n\t\t\tvar $rows = this._$tableBody.find('tr.ewjtable-data-row');\r\n\r\n\t\t\t//Remove all rows from DOM and the _$tableRows array\r\n\t\t\tthis._$tableBody.empty();\r\n\t\t\tthis._$tableRows = [];\r\n\r\n\t\t\tthis._onRowsRemoved($rows, reason);\r\n\r\n\t\t\t//Add 'no data' row since we removed all rows\r\n\t\t\tthis._addNoDataRow();\r\n\t\t},\r\n\r\n\t\t/* Adds \"no data available\" row to the table.\r\n\t\t*************************************************************************/\r\n\t\t_addNoDataRow: function () {\r\n\t\t\tif (this._$tableBody.find('>tr.ewjtable-no-data-row').length > 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar $tr = $('')\r\n\t\t\t\t.addClass('ewjtable-no-data-row')\r\n\t\t\t\t.appendTo(this._$tableBody);\r\n\r\n\t\t\tvar totalColumnCount = this._$table.find('thead th').length;\r\n\t\t\t$('')\r\n\t\t\t\t.attr('colspan', totalColumnCount)\r\n\t\t\t\t.html(this.options.messages.noDataAvailable)\r\n\t\t\t\t.appendTo($tr);\r\n\t\t},\r\n\r\n\t\t/* Removes \"no data available\" row from the table.\r\n\t\t*************************************************************************/\r\n\t\t_removeNoDataRow: function () {\r\n\t\t\tthis._$tableBody.find('.ewjtable-no-data-row').remove();\r\n\t\t},\r\n\r\n\t\t/* Refreshes styles of all rows in the table\r\n\t\t*************************************************************************/\r\n\t\t_refreshRowStyles: function () {\r\n\t\t\tfor (var i = 0; i < this._$tableRows.length; i++) {\r\n\t\t\t\tif (i % 2 == 0) {\r\n\t\t\t\t\tthis._$tableRows[i].addClass('ewjtable-row-even');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._$tableRows[i].removeClass('ewjtable-row-even');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* RENDERING FIELD VALUES ***********************************************/\r\n\r\n\t\t/* Gets text for a field of a record according to it's type.\r\n\t\t*************************************************************************/\r\n\t\t_getDisplayTextForRecordField: function (record, fieldName) {\r\n\t\t\tvar field = this.options.fields[fieldName];\r\n\t\t\tvar fieldValue = record[fieldName];\r\n\r\n\t\t\t//if this is a custom field, call display function\r\n\t\t\tif (field.display) {\r\n\t\t\t\treturn field.display({ record: record });\r\n\t\t\t}\r\n\r\n\t\t\tif (field.type == 'date') {\r\n\t\t\t\treturn this._getDisplayTextForDateRecordField(field, fieldValue);\r\n\t\t\t} else { //other types\r\n\t\t\t\treturn fieldValue;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Gets text for a date field.\r\n\t\t*************************************************************************/\r\n\t\t_getDisplayTextForDateRecordField: function (field, fieldValue) {\r\n\t\t\tif (!fieldValue) {\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\r\n\t\t\tvar displayFormat = field.displayFormat || this.options.defaultDateFormat;\r\n\t\t\treturn ew.formatDate(fieldValue, displayFormat);\r\n\t\t},\r\n\r\n\t\t/* TOOLBAR *************************************************************/\r\n\r\n\t\t/* Creates the toolbar.\r\n\t\t*************************************************************************/\r\n\t\t_createToolBar: function () {\r\n\t\t\tthis._$toolbarDiv = $('
')\r\n\t\t\t.addClass('ewjtable-toolbar')\r\n\t\t\t.appendTo(this._$titleDiv);\r\n\r\n\t\t\tfor (var i = 0; i < this.options.toolbar.items.length; i++) {\r\n\t\t\t\tthis._addToolBarItem(this.options.toolbar.items[i]);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Adds a new item to the toolbar.\r\n\t\t*************************************************************************/\r\n\t\t_addToolBarItem: function (item) {\r\n\r\n\t\t\t//Check if item is valid\r\n\t\t\tif ((item == undefined) || (item.text == undefined && item.icon == undefined)) {\r\n\t\t\t\tthis._logWarn('Can not add tool bar item since it is not valid!');\r\n\t\t\t\tthis._logWarn(item);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tvar $toolBarItem = $('')\r\n\t\t\t\t.addClass('ewjtable-toolbar-item')\r\n\t\t\t\t.appendTo(this._$toolbarDiv);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($toolBarItem, 'ui-widget ui-state-default ui-corner-all', 'ui-state-hover');\r\n\r\n\t\t\t//cssClass property\r\n\t\t\tif (item.cssClass) {\r\n\t\t\t\t$toolBarItem\r\n\t\t\t\t\t.addClass(item.cssClass);\r\n\t\t\t}\r\n\r\n\t\t\t//tooltip property\r\n\t\t\tif (item.tooltip) {\r\n\t\t\t\t$toolBarItem\r\n\t\t\t\t\t.attr('title', item.tooltip);\r\n\t\t\t}\r\n\r\n\t\t\t//icon property\r\n\t\t\tif (item.icon) {\r\n\t\t\t\tvar $icon = $('').appendTo($toolBarItem);\r\n\t\t\t\tif (item.icon === true) {\r\n\t\t\t\t\t//do nothing\r\n\t\t\t\t} else if ($.type(item.icon === 'string')) {\r\n\t\t\t\t\t$icon.css('background', 'url(\"' + item.icon + '\")');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//text property\r\n\t\t\tif (item.text) {\r\n\t\t\t\t$('')\r\n\t\t\t\t\t.html(item.text)\r\n\t\t\t\t\t.addClass('ewjtable-toolbar-item-text').appendTo($toolBarItem);\r\n\t\t\t}\r\n\r\n\t\t\t//click event\r\n\t\t\tif (item.click) {\r\n\t\t\t\t$toolBarItem.click(function () {\r\n\t\t\t\t\titem.click();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t//set hover animation parameters\r\n\t\t\tvar hoverAnimationDuration = undefined;\r\n\t\t\tvar hoverAnimationEasing = undefined;\r\n\t\t\tif (this.options.toolbar.hoverAnimation) {\r\n\t\t\t\thoverAnimationDuration = this.options.toolbar.hoverAnimationDuration;\r\n\t\t\t\thoverAnimationEasing = this.options.toolbar.hoverAnimationEasing;\r\n\t\t\t}\r\n\r\n\t\t\t//change class on hover\r\n\t\t\t$toolBarItem.hover(function () {\r\n\t\t\t\t$toolBarItem.addClass('ewjtable-toolbar-item-hover', hoverAnimationDuration, hoverAnimationEasing);\r\n\t\t\t}, function () {\r\n\t\t\t\t$toolBarItem.removeClass('ewjtable-toolbar-item-hover', hoverAnimationDuration, hoverAnimationEasing);\r\n\t\t\t});\r\n\r\n\t\t\treturn $toolBarItem;\r\n\t\t},\r\n\r\n\t\t/* ERROR DIALOG *********************************************************/\r\n\r\n\t\t/* Shows error message dialog with given message.\r\n\t\t*************************************************************************/\r\n\t\t_showError: function (message) {\r\n\t\t\tew.alert(message);\r\n\t\t},\r\n\r\n\t\t/* BUSY PANEL ***********************************************************/\r\n\r\n\t\t/* Shows busy indicator and blocks table UI.\r\n\t\t* TODO: Make this cofigurable and changable\r\n\t\t*************************************************************************/\r\n\t\t_setBusyTimer: null,\r\n\t\t_showBusy: function (message, delay) {\r\n\t\t\tvar self = this; //\r\n\r\n\t\t\t//Show a transparent overlay to prevent clicking to the table\r\n\t\t\tself._$busyDiv\r\n\t\t\t\t.width(self._$mainContainer.width())\r\n\t\t\t\t.height(self._$mainContainer.height())\r\n\t\t\t\t.addClass('ewjtable-busy-panel-background-invisible')\r\n\t\t\t\t.show();\r\n\r\n\t\t\tvar makeVisible = function () {\r\n\t\t\t\tself._$busyDiv.removeClass('ewjtable-busy-panel-background-invisible');\r\n\t\t\t\tself._$busyMessageDiv.html(message).show();\r\n\t\t\t};\r\n\r\n\t\t\tif (delay) {\r\n\t\t\t\tif (self._setBusyTimer) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tself._setBusyTimer = setTimeout(makeVisible, delay);\r\n\t\t\t} else {\r\n\t\t\t\tmakeVisible();\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Hides busy indicator and unblocks table UI.\r\n\t\t*************************************************************************/\r\n\t\t_hideBusy: function () {\r\n\t\t\tclearTimeout(this._setBusyTimer);\r\n\t\t\tthis._setBusyTimer = null;\r\n\t\t\tthis._$busyDiv.hide();\r\n\t\t\tthis._$busyMessageDiv.html('').hide();\r\n\t\t},\r\n\r\n\t\t/* Returns true if ewjTable is busy.\r\n\t\t*************************************************************************/\r\n\t\t_isBusy: function () {\r\n\t\t\treturn this._$busyMessageDiv.is(':visible');\r\n\t\t},\r\n\r\n\t\t/* Adds jQueryUI class to an item.\r\n\t\t*************************************************************************/\r\n\t\t_jqueryuiThemeAddClass: function ($elm, className, hoverClassName) {\r\n\t\t\tif (!this.options.jqueryuiTheme) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t$elm.addClass(className);\r\n\r\n\t\t\tif (hoverClassName) {\r\n\t\t\t\t$elm.hover(function () {\r\n\t\t\t\t\t$elm.addClass(hoverClassName);\r\n\t\t\t\t}, function () {\r\n\t\t\t\t\t$elm.removeClass(hoverClassName);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* COMMON METHODS *******************************************************/\r\n\r\n\t\t/* Performs an AJAX call to specified URL.\r\n\t\t* THIS METHOD IS DEPRECATED AND WILL BE REMOVED FROM FEATURE RELEASES.\r\n\t\t* USE _ajax METHOD.\r\n\t\t*************************************************************************/\r\n\t\t_performAjaxCall: function (url, postData, async, success, error) {\r\n\t\t\tthis._ajax({\r\n\t\t\t\turl: url,\r\n\t\t\t\tdata: postData,\r\n\t\t\t\tasync: async,\r\n\t\t\t\tsuccess: success,\r\n\t\t\t\terror: error\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t_unAuthorizedRequestHandler: function() {\r\n\t\t\tif (this.options.unAuthorizedRequestRedirectUrl) {\r\n\t\t\t\tlocation.href = this.options.unAuthorizedRequestRedirectUrl;\r\n\t\t\t} else {\r\n\t\t\t\tlocation.reload(true);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* This method is used to perform AJAX calls in ewjTable instead of direct\r\n\t\t* usage of jQuery.ajax method.\r\n\t\t*************************************************************************/\r\n\t\t_ajax: function (options) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t//Handlers for HTTP status codes\r\n\t\t\tvar opts = {\r\n\t\t\t\tstatusCode: {\r\n\t\t\t\t\t401: function () { //Unauthorized\r\n\t\t\t\t\t\tself._unAuthorizedRequestHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\topts = $.extend(opts, this.options.ajaxSettings, options);\r\n\r\n\t\t\t//Override success\r\n\t\t\topts.success = function (data) {\r\n\t\t\t\t//Checking for Authorization error\r\n\t\t\t\tif (data && data.unAuthorizedRequest == true) { //***\r\n\t\t\t\t\tself._unAuthorizedRequestHandler();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (options.success) {\r\n\t\t\t\t\toptions.success(data);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\t//Override error\r\n\t\t\topts.error = function (jqXHR, textStatus, errorThrown) {\r\n\t\t\t\tif (unloadingPage) {\r\n\t\t\t\t\tjqXHR.abort();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (options.error) {\r\n\t\t\t\t\toptions.error(arguments);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\t//Override complete\r\n\t\t\topts.complete = function () {\r\n\t\t\t\tif (options.complete) {\r\n\t\t\t\t\toptions.complete();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\t$.ajax(opts);\r\n\t\t},\r\n\r\n\t\t/* Gets value of key field of a record.\r\n\t\t*************************************************************************/\r\n\t\t_getKeyValueOfRecord: function (record) {\r\n\t\t\treturn record[this._keyField];\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* COOKIE *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Sets a cookie with given key.\r\n\t\t*************************************************************************/\r\n\t\t_setCookie: function (key, value) {\r\n\t\t\tkey = this._cookieKeyPrefix + key;\r\n\r\n\t\t\tvar expireDate = new Date();\r\n\t\t\texpireDate.setDate(expireDate.getDate() + 30);\r\n\t\t\tdocument.cookie = encodeURIComponent(key) + '=' + encodeURIComponent(value) + \"; expires=\" + expireDate.toUTCString();\r\n\t\t},\r\n\r\n\t\t/* Gets a cookie with given key.\r\n\t\t*************************************************************************/\r\n\t\t_getCookie: function (key) {\r\n\t\t\tkey = this._cookieKeyPrefix + key;\r\n\r\n\t\t\tvar equalities = document.cookie.split('; ');\r\n\t\t\tfor (var i = 0; i < equalities.length; i++) {\r\n\t\t\t\tif (!equalities[i]) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar splitted = equalities[i].split('=');\r\n\t\t\t\tif (splitted.length != 2) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (decodeURIComponent(splitted[0]) === key) {\r\n\t\t\t\t\treturn decodeURIComponent(splitted[1] || '');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\t\t},\r\n\r\n\t\t/* Generates a hash key to be prefix for all cookies for this ewjtable instance.\r\n\t\t*************************************************************************/\r\n\t\t_generateCookieKeyPrefix: function () {\r\n\r\n\t\t\tvar simpleHash = function (value) {\r\n\t\t\t\tvar hash = 0;\r\n\t\t\t\tif (value.length == 0) {\r\n\t\t\t\t\treturn hash;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (var i = 0; i < value.length; i++) {\r\n\t\t\t\t\tvar ch = value.charCodeAt(i);\r\n\t\t\t\t\thash = ((hash << 5) - hash) + ch;\r\n\t\t\t\t\thash = hash & hash;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn hash;\r\n\t\t\t};\r\n\r\n\t\t\tvar strToHash = '';\r\n\t\t\tif (this.options.tableId) {\r\n\t\t\t\tstrToHash = strToHash + this.options.tableId + '#';\r\n\t\t\t}\r\n\r\n\t\t\tstrToHash = strToHash + this._columnList.join('$') + '#c' + this._$table.find('thead th').length;\r\n\t\t\treturn 'ewjtable#' + simpleHash(strToHash);\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* EVENT RAISING METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_onLoadingRecords: function () {\r\n\t\t\tthis._trigger(\"loadingRecords\", null, {});\r\n\t\t},\r\n\r\n\t\t_onRecordsLoaded: function (data) {\r\n\t\t\tthis._trigger(\"recordsLoaded\", null, { records: data.records, serverResponse: data }); //***\r\n\t\t},\r\n\r\n\t\t_onRowInserted: function ($row, isNewRow) {\r\n\t\t\tthis._trigger(\"rowInserted\", null, { row: $row, record: $row.data('record'), isNewRow: isNewRow });\r\n\t\t},\r\n\r\n\t\t_onRowsRemoved: function ($rows, reason) {\r\n\t\t\tthis._trigger(\"rowsRemoved\", null, { rows: $rows, reason: reason });\r\n\t\t},\r\n\r\n\t\t_onCloseRequested: function () {\r\n\t\t\tthis._trigger(\"closeRequested\", null, {});\r\n\t\t}\r\n\r\n\t});\r\n\r\n}(jQuery));\r\n\r\n\r\n/************************************************************************\r\n* Some UTULITY methods used by ewjTable *\r\n*************************************************************************/\r\n(function ($) {\r\n\r\n\t$.extend(true, $.ew.ewjtable.prototype, {\r\n\r\n\t\t/* Gets property value of an object recursively.\r\n\t\t*************************************************************************/\r\n\t\t_getPropertyOfObject: function (obj, propName) {\r\n\t\t\tif (propName.indexOf('.') < 0) {\r\n\t\t\t\treturn obj[propName];\r\n\t\t\t} else {\r\n\t\t\t\tvar preDot = propName.substring(0, propName.indexOf('.'));\r\n\t\t\t\tvar postDot = propName.substring(propName.indexOf('.') + 1);\r\n\t\t\t\treturn this._getPropertyOfObject(obj[preDot], postDot);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Sets property value of an object recursively.\r\n\t\t*************************************************************************/\r\n\t\t_setPropertyOfObject: function (obj, propName, value) {\r\n\t\t\tif (propName.indexOf('.') < 0) {\r\n\t\t\t\tobj[propName] = value;\r\n\t\t\t} else {\r\n\t\t\t\tvar preDot = propName.substring(0, propName.indexOf('.'));\r\n\t\t\t\tvar postDot = propName.substring(propName.indexOf('.') + 1);\r\n\t\t\t\tthis._setPropertyOfObject(obj[preDot], postDot, value);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Inserts a value to an array if it does not exists in the array.\r\n\t\t*************************************************************************/\r\n\t\t_insertToArrayIfDoesNotExists: function (array, value) {\r\n\t\t\tif ($.inArray(value, array) < 0) {\r\n\t\t\t\tarray.push(value);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Finds index of an element in an array according to given comparision function\r\n\t\t*************************************************************************/\r\n\t\t_findIndexInArray: function (value, array, compareFunc) {\r\n\r\n\t\t\t//If not defined, use default comparision\r\n\t\t\tif (!compareFunc) {\r\n\t\t\t\tcompareFunc = function (a, b) {\r\n\t\t\t\t\treturn a == b;\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i = 0; i < array.length; i++) {\r\n\t\t\t\tif (compareFunc(value, array[i])) {\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn -1;\r\n\t\t},\r\n\r\n\t\t/* Normalizes a number between given bounds or sets to a defaultValue\r\n\t\t* if it is undefined\r\n\t\t*************************************************************************/\r\n\t\t_normalizeNumber: function (number, min, max, defaultValue) {\r\n\t\t\tif (number == undefined || number == null || isNaN(number)) {\r\n\t\t\t\treturn defaultValue;\r\n\t\t\t}\r\n\r\n\t\t\tif (number < min) {\r\n\t\t\t\treturn min;\r\n\t\t\t}\r\n\r\n\t\t\tif (number > max) {\r\n\t\t\t\treturn max;\r\n\t\t\t}\r\n\r\n\t\t\treturn number;\r\n\t\t},\r\n\r\n\t\t/* Formats a string just like string.format in c#.\r\n\t\t* Example:\r\n\t\t* _formatString('Hello {0}','Halil') = 'Hello Halil'\r\n\t\t*************************************************************************/\r\n\t\t_formatString: function () {\r\n\t\t\tif (arguments.length == 0) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\r\n\t\t\tvar str = arguments[0];\r\n\t\t\tfor (var i = 1; i < arguments.length; i++) {\r\n\t\t\t\tvar placeHolder = '{' + (i - 1) + '}';\r\n\t\t\t\tstr = str.replace(placeHolder, arguments[i]);\r\n\t\t\t}\r\n\r\n\t\t\treturn str;\r\n\t\t},\r\n\r\n\t\t/* Checks if given object is a jQuery Deferred object.\r\n\t\t */\r\n\t\t_isDeferredObject: function (obj) {\r\n\t\t\treturn obj.then && obj.done && obj.fail;\r\n\t\t},\r\n\r\n\t\t//Logging methods ////////////////////////////////////////////////////////\r\n\r\n\t\t_logDebug: function (text) {\r\n\t\t\tif (!window.console) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log('ewjTable DEBUG: ' + text);\r\n\t\t},\r\n\r\n\t\t_logInfo: function (text) {\r\n\t\t\tif (!window.console) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log('ewjTable INFO: ' + text);\r\n\t\t},\r\n\r\n\t\t_logWarn: function (text) {\r\n\t\t\tif (!window.console) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log('ewjTable WARNING: ' + text);\r\n\t\t},\r\n\r\n\t\t_logError: function (text) {\r\n\t\t\tif (!window.console) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log('ewjTable ERROR: ' + text);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\t/* Fix for array.indexOf method in IE7.\r\n\t * This code is taken from http://www.tutorialspoint.com/javascript/array_indexof.htm */\r\n\tif (!Array.prototype.indexOf) {\r\n\t\tArray.prototype.indexOf = function (elt) {\r\n\t\t\tvar len = this.length;\r\n\t\t\tvar from = Number(arguments[1]) || 0;\r\n\t\t\tfrom = (from < 0)\r\n\t\t\t\t ? Math.ceil(from)\r\n\t\t\t\t : Math.floor(from);\r\n\t\t\tif (from < 0)\r\n\t\t\t\tfrom += len;\r\n\t\t\tfor (; from < len; from++) {\r\n\t\t\t\tif (from in this &&\r\n\t\t\t\t\tthis[from] === elt)\r\n\t\t\t\t\treturn from;\r\n\t\t\t}\r\n\t\t\treturn -1;\r\n\t\t};\r\n\t}\r\n\r\n})(jQuery);\r\n\r\n/************************************************************************\r\n* SELECTING extension for ewjTable *\r\n*************************************************************************/\r\n(function ($) {\r\n\r\n\t//Reference to base object members\r\n\tvar base = {\r\n\t\t_create: $.ew.ewjtable.prototype._create,\r\n\t\t_addColumnsToHeaderRow: $.ew.ewjtable.prototype._addColumnsToHeaderRow,\r\n\t\t_addCellsToRowUsingRecord: $.ew.ewjtable.prototype._addCellsToRowUsingRecord,\r\n\t\t_onLoadingRecords: $.ew.ewjtable.prototype._onLoadingRecords,\r\n\t\t_onRecordsLoaded: $.ew.ewjtable.prototype._onRecordsLoaded,\r\n\t\t_onRowsRemoved: $.ew.ewjtable.prototype._onRowsRemoved\r\n\t};\r\n\r\n\t//extension members\r\n\t$.extend(true, $.ew.ewjtable.prototype, {\r\n\r\n\t\t/************************************************************************\r\n\t\t* DEFAULT OPTIONS / EVENTS *\r\n\t\t*************************************************************************/\r\n\t\toptions: {\r\n\r\n\t\t\t//Options\r\n\t\t\tselecting: false,\r\n\t\t\tmultiselect: false,\r\n\t\t\tselectingCheckboxes: false,\r\n\t\t\tselectOnRowClick: true,\r\n\r\n\t\t\t//Events\r\n\t\t\tselectionChanged: function (event, data) { }\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE FIELDS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_selectedRecordIdsBeforeLoad: null, //This array is used to store selected row Id's to restore them after a page refresh (string array).\r\n\t\t_$selectAllCheckbox: null, //Reference to the 'select/deselect all' checkbox (jQuery object)\r\n\t\t_shiftKeyDown: false, //True, if shift key is currently down.\r\n\r\n\t\t/************************************************************************\r\n\t\t* CONSTRUCTOR *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Overrides base method to do selecting-specific constructions.\r\n\t\t*************************************************************************/\r\n\t\t_create: function () {\r\n\t\t\tif (this.options.selecting && this.options.selectingCheckboxes) {\r\n\t\t\t\t++this._firstDataColumnOffset;\r\n\t\t\t\tthis._bindKeyboardEvents();\r\n\t\t\t}\r\n\r\n\t\t\t//Call base method\r\n\t\t\tbase._create.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Registers to keyboard events those are needed for selection\r\n\t\t*************************************************************************/\r\n\t\t_bindKeyboardEvents: function () {\r\n\t\t\tvar self = this;\r\n\t\t\t//Register to events to set _shiftKeyDown value\r\n\t\t\t$(document)\r\n\t\t\t\t.keydown(function (event) {\r\n\t\t\t\t\tswitch (event.which) {\r\n\t\t\t\t\t\tcase 16:\r\n\t\t\t\t\t\t\tself._shiftKeyDown = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.keyup(function (event) {\r\n\t\t\t\t\tswitch (event.which) {\r\n\t\t\t\t\t\tcase 16:\r\n\t\t\t\t\t\t\tself._shiftKeyDown = false;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PUBLIC METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Gets jQuery selection for currently selected rows.\r\n\t\t*************************************************************************/\r\n\t\tselectedRows: function () {\r\n\t\t\treturn this._getSelectedRows();\r\n\t\t},\r\n\r\n\t\t/* Makes row/rows 'selected'.\r\n\t\t*************************************************************************/\r\n\t\tselectRows: function ($rows) {\r\n\t\t\tthis._selectRows($rows);\r\n\r\n\t\t\tthis._onSelectionChanged($.Event(\"selectRows\")); //TODO: trigger only if selected rows changes?\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* OVERRIDED METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Overrides base method to add a 'select column' to header row.\r\n\t\t*************************************************************************/\r\n\t\t_addColumnsToHeaderRow: function ($tr) {\r\n\t\t\tif (this.options.selecting && this.options.selectingCheckboxes) {\r\n\t\t\t\tif (this.options.multiselect) {\r\n\t\t\t\t\t$tr.append(this._createSelectAllHeader());\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$tr.append(this._createEmptyCommandHeader());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tbase._addColumnsToHeaderRow.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides base method to add a 'delete command cell' to a row.\r\n\t\t*************************************************************************/\r\n\t\t_addCellsToRowUsingRecord: function ($row) {\r\n\t\t\tif (this.options.selecting) {\r\n\t\t\t\tthis._makeRowSelectable($row);\r\n\t\t\t}\r\n\r\n\t\t\tbase._addCellsToRowUsingRecord.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides base event to store selection list\r\n\t\t*************************************************************************/\r\n\t\t_onLoadingRecords: function () {\r\n\t\t\tif (this.options.selecting) {\r\n\t\t\t\tthis._storeSelectionList();\r\n\t\t\t}\r\n\r\n\t\t\tbase._onLoadingRecords.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides base event to restore selection list\r\n\t\t*************************************************************************/\r\n\t\t_onRecordsLoaded: function () {\r\n\t\t\tif (this.options.selecting) {\r\n\t\t\t\tthis._restoreSelectionList();\r\n\t\t\t}\r\n\r\n\t\t\tbase._onRecordsLoaded.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides base event to check is any selected row is being removed.\r\n\t\t*************************************************************************/\r\n\t\t_onRowsRemoved: function ($rows, reason) {\r\n\t\t\tif (this.options.selecting && (reason != 'reloading') && ($rows.filter('.ewjtable-row-selected').length > 0)) {\r\n\t\t\t\tthis._onSelectionChanged($.Event(\"rowsRemoved\"));\r\n\t\t\t}\r\n\r\n\t\t\tbase._onRowsRemoved.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Creates a header column to select/deselect all rows.\r\n\t\t*************************************************************************/\r\n\t\t_createSelectAllHeader: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tvar $columnHeader = $('')\r\n\t\t\t\t.addClass('ewjtable-command-column-header ewjtable-column-header-selecting');\r\n\t\t\tthis._jqueryuiThemeAddClass($columnHeader, 'ui-state-default');\r\n\r\n\t\t\tvar $headerContainer = $('
')\r\n\t\t\t\t.addClass('ewjtable-column-header-container')\r\n\t\t\t\t.appendTo($columnHeader);\r\n\r\n\t\t\tself._$selectAllCheckbox = $('') //***\r\n\t\t\t\t.click(function () {\r\n\t\t\t\t\tif (self._$tableRows.length <= 0) {\r\n\t\t\t\t\t\tself._$selectAllCheckbox.prop('checked', false);\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar allRows = self._$tableBody.find('>tr.ewjtable-data-row');\r\n\t\t\t\t\tif (self._$selectAllCheckbox.is(':checked')) {\r\n\t\t\t\t\t\tself._selectRows(allRows);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tself._deselectRows(allRows);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tself._onSelectionChanged($.Event(\"selectAll\", { \"rows\": allRows }));\r\n\t\t\t\t});\r\n\r\n\t\t\t$('
')\r\n\t\t\t\t.append(self._$selectAllCheckbox)\r\n\t\t\t\t.append('')\r\n\t\t\t\t.appendTo($headerContainer); //***\r\n\r\n\t\t\treturn $columnHeader;\r\n\t\t},\r\n\r\n\t\t/* Stores Id's of currently selected records to _selectedRecordIdsBeforeLoad.\r\n\t\t*************************************************************************/\r\n\t\t_storeSelectionList: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tif (!self.options.selecting) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tself._selectedRecordIdsBeforeLoad = [];\r\n\t\t\tself._getSelectedRows().each(function () {\r\n\t\t\t\tself._selectedRecordIdsBeforeLoad.push(self._getKeyValueOfRecord($(this).data('record')));\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Selects rows whose Id is in _selectedRecordIdsBeforeLoad;\r\n\t\t*************************************************************************/\r\n\t\t_restoreSelectionList: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tif (!self.options.selecting) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar selectedRowCount = 0;\r\n\t\t\tfor (var i = 0; i < self._$tableRows.length; ++i) {\r\n\t\t\t\tvar recordId = self._getKeyValueOfRecord(self._$tableRows[i].data('record'));\r\n\t\t\t\tif ($.inArray(recordId, self._selectedRecordIdsBeforeLoad) > -1) {\r\n\t\t\t\t\tself._selectRows(self._$tableRows[i]);\r\n\t\t\t\t\t++selectedRowCount;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (self._selectedRecordIdsBeforeLoad.length > 0 && self._selectedRecordIdsBeforeLoad.length != selectedRowCount) {\r\n\t\t\t\tself._onSelectionChanged($.Event(\"restoreSelectionList\"));\r\n\t\t\t}\r\n\r\n\t\t\tself._selectedRecordIdsBeforeLoad = [];\r\n\t\t\tself._refreshSelectAllCheckboxState();\r\n\t\t},\r\n\r\n\t\t/* Gets all selected rows.\r\n\t\t*************************************************************************/\r\n\t\t_getSelectedRows: function () {\r\n\t\t\treturn this._$tableBody\r\n\t\t\t\t.find('>tr.ewjtable-row-selected');\r\n\t\t},\r\n\r\n\t\t/* Adds selectable feature to a row.\r\n\t\t*************************************************************************/\r\n\t\t_makeRowSelectable: function ($row) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t//Select/deselect on row click\r\n\t\t\tif (self.options.selectOnRowClick) {\r\n\t\t\t\t$row.click(function (e) {\r\n\t\t\t\t\tif ($(e.target).is(\".custom-control-label\")) //***\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\tself._invertRowSelection($row);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t//'select/deselect' checkbox column\r\n\t\t\tif (self.options.selectingCheckboxes) {\r\n\t\t\t\tvar $cell = $('').addClass('ewjtable-selecting-column');\r\n\t\t\t\tvar type = (self.options.multiselect) ? \"checkbox\" : \"radio\"; //***\r\n\t\t\t\tvar id = \"modal_\" + type + \"_\" + ew.random(); //***\r\n\t\t\t\tvar $selectCheckbox = $('
').appendTo($cell); //***\r\n\t\t\t\tif (!self.options.selectOnRowClick) {\r\n\t\t\t\t\t$selectCheckbox.find(\"input\").click(function (e) {\r\n\t\t\t\t\t\tself._invertRowSelection($row);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$row.append($cell);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Inverts selection state of a single row.\r\n\t\t*************************************************************************/\r\n\t\t_invertRowSelection: function ($row) {\r\n\t\t\tif ($row.hasClass('ewjtable-row-selected')) {\r\n\t\t\t\tthis._deselectRows($row);\r\n\t\t\t} else {\r\n\t\t\t\t//Shift key?\r\n\t\t\t\tif (this._shiftKeyDown) {\r\n\t\t\t\t\tvar rowIndex = this._findRowIndex($row);\r\n\t\t\t\t\t//try to select row and above rows until first selected row\r\n\t\t\t\t\tvar beforeIndex = this._findFirstSelectedRowIndexBeforeIndex(rowIndex) + 1;\r\n\t\t\t\t\tif (beforeIndex > 0 && beforeIndex < rowIndex) {\r\n\t\t\t\t\t\tthis._selectRows(this._$tableBody.find('tr').slice(beforeIndex, rowIndex + 1));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//try to select row and below rows until first selected row\r\n\t\t\t\t\t\tvar afterIndex = this._findFirstSelectedRowIndexAfterIndex(rowIndex) - 1;\r\n\t\t\t\t\t\tif (afterIndex > rowIndex) {\r\n\t\t\t\t\t\t\tthis._selectRows(this._$tableBody.find('tr').slice(rowIndex, afterIndex + 1));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t//just select this row\r\n\t\t\t\t\t\t\tthis._selectRows($row);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis._selectRows($row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis._onSelectionChanged($.Event(\"invertRowSelection\", { \"rows\": $row }));\r\n\t\t},\r\n\r\n\t\t/* Search for a selected row (that is before given row index) to up and returns it's index\r\n\t\t*************************************************************************/\r\n\t\t_findFirstSelectedRowIndexBeforeIndex: function (rowIndex) {\r\n\t\t\tfor (var i = rowIndex - 1; i >= 0; --i) {\r\n\t\t\t\tif (this._$tableRows[i].hasClass('ewjtable-row-selected')) {\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn -1;\r\n\t\t},\r\n\r\n\t\t/* Search for a selected row (that is after given row index) to down and returns it's index\r\n\t\t*************************************************************************/\r\n\t\t_findFirstSelectedRowIndexAfterIndex: function (rowIndex) {\r\n\t\t\tfor (var i = rowIndex + 1; i < this._$tableRows.length; ++i) {\r\n\t\t\t\tif (this._$tableRows[i].hasClass('ewjtable-row-selected')) {\r\n\t\t\t\t\treturn i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn -1;\r\n\t\t},\r\n\r\n\t\t/* Makes row/rows 'selected'.\r\n\t\t*************************************************************************/\r\n\t\t_selectRows: function ($rows) {\r\n\t\t\tif (!this.options.multiselect) {\r\n\t\t\t\tthis._deselectRows(this._getSelectedRows());\r\n\t\t\t}\r\n\r\n\t\t\t$rows.addClass('ewjtable-row-selected');\r\n\t\t\tthis._jqueryuiThemeAddClass($rows, 'ui-state-highlight');\r\n\r\n\t\t\tif (this.options.selectingCheckboxes) {\r\n\t\t\t\t$rows.find('>td.ewjtable-selecting-column input').prop('checked', true); //***\r\n\t\t\t}\r\n\r\n\t\t\tthis._refreshSelectAllCheckboxState();\r\n\t\t},\r\n\r\n\t\t/* Makes row/rows 'non selected'.\r\n\t\t*************************************************************************/\r\n\t\t_deselectRows: function ($rows) {\r\n\t\t\t$rows.removeClass('ewjtable-row-selected ui-state-highlight');\r\n\t\t\tif (this.options.selectingCheckboxes) {\r\n\t\t\t\t$rows.find('>td.ewjtable-selecting-column input').prop('checked', false); //***\r\n\t\t\t}\r\n\r\n\t\t\tthis._refreshSelectAllCheckboxState();\r\n\t\t},\r\n\r\n\t\t/* Updates state of the 'select/deselect' all checkbox according to count of selected rows.\r\n\t\t*************************************************************************/\r\n\t\t_refreshSelectAllCheckboxState: function () {\r\n\t\t\tif (!this.options.selectingCheckboxes || !this.options.multiselect) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar totalRowCount = this._$tableRows.length;\r\n\t\t\tvar selectedRowCount = this._getSelectedRows().length;\r\n\r\n\t\t\tif (selectedRowCount == 0) {\r\n\t\t\t\tthis._$selectAllCheckbox.prop('indeterminate', false);\r\n\t\t\t\tthis._$selectAllCheckbox.prop('checked', false);\r\n\t\t\t} else if (selectedRowCount == totalRowCount) {\r\n\t\t\t\tthis._$selectAllCheckbox.prop('indeterminate', false);\r\n\t\t\t\tthis._$selectAllCheckbox.prop('checked', true);\r\n\t\t\t} else {\r\n\t\t\t\tthis._$selectAllCheckbox.prop('checked', false);\r\n\t\t\t\tthis._$selectAllCheckbox.prop('indeterminate', true);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* EVENT RAISING METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_onSelectionChanged: function (e) {\r\n\t\t\tthis._trigger(\"selectionChanged\", null, e || {});\r\n\t\t}\r\n\r\n\t});\r\n\r\n})(jQuery);\r\n\r\n\r\n/************************************************************************\r\n* PAGING extension for ewjTable *\r\n*************************************************************************/\r\n(function ($) {\r\n\r\n\t//Reference to base object members\r\n\tvar base = {\r\n\t\tload: $.ew.ewjtable.prototype.load,\r\n\t\t_create: $.ew.ewjtable.prototype._create,\r\n\t\t_setOption: $.ew.ewjtable.prototype._setOption,\r\n\t\t_createRecordLoadUrl: $.ew.ewjtable.prototype._createRecordLoadUrl,\r\n\t\t_createJtParamsForLoading: $.ew.ewjtable.prototype._createJtParamsForLoading,\r\n\t\t_addRowToTable: $.ew.ewjtable.prototype._addRowToTable,\r\n\t\t_addRow: $.ew.ewjtable.prototype._addRow,\r\n\t\t_removeRowsFromTable: $.ew.ewjtable.prototype._removeRowsFromTable,\r\n\t\t_onRecordsLoaded: $.ew.ewjtable.prototype._onRecordsLoaded\r\n\t};\r\n\r\n\t//extension members\r\n\t$.extend(true, $.ew.ewjtable.prototype, {\r\n\r\n\t\t/************************************************************************\r\n\t\t* DEFAULT OPTIONS / EVENTS *\r\n\t\t*************************************************************************/\r\n\t\toptions: {\r\n\t\t\tpaging: true,\r\n\t\t\tpageList: 'minimal', //possible values: 'minimal', 'normal'\r\n\t\t\tpageSize: 10,\r\n\t\t\tpageSizes: [10, 20, 30],\r\n\t\t\tpageSizeChangeArea: false,\r\n\t\t\tgotoPageArea: 'combobox', //possible values: 'textbox', 'combobox', 'none'\r\n\r\n\t\t\tmessages: {\r\n\t\t\t\tpagingInfo: 'Showing {0}-{1} of {2}',\r\n\t\t\t\tpageSizeChangeLabel: 'Row count',\r\n\t\t\t\tgotoPageLabel: 'Go to page'\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE FIELDS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_$bottomPanel: null, //Reference to the panel at the bottom of the table (jQuery object)\r\n\t\t_$pagingListArea: null, //Reference to the page list area in to bottom panel (jQuery object)\r\n\t\t_$pageSizeChangeArea: null, //Reference to the page size change area in to bottom panel (jQuery object)\r\n\t\t_$pageInfoSpan: null, //Reference to the paging info area in to bottom panel (jQuery object)\r\n\t\t_$gotoPageArea: null, //Reference to 'Go to page' input area in to bottom panel (jQuery object)\r\n\t\t_$gotoPageInput: null, //Reference to 'Go to page' input in to bottom panel (jQuery object)\r\n\t\t_totalRecordCount: 0, //Total count of records on all pages\r\n\t\t_currentPageNo: 1, //Current page number\r\n\r\n\t\t/************************************************************************\r\n\t\t* CONSTRUCTOR AND INITIALIZING METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Overrides base method to do paging-specific constructions.\r\n\t\t*************************************************************************/\r\n\t\t_create: function() {\r\n\t\t\tbase._create.apply(this, arguments);\r\n\t\t\tif (this.options.paging) {\r\n\t\t\t\tthis._loadPagingSettings();\r\n\t\t\t\tthis._createBottomPanel();\r\n\t\t\t\tthis._createPageListArea();\r\n\t\t\t\tthis._createGotoPageInput();\r\n\t\t\t\tthis._createPageSizeSelection();\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Loads user preferences for paging.\r\n\t\t*************************************************************************/\r\n\t\t_loadPagingSettings: function() {\r\n\t\t\tif (!this.options.saveUserPreferences) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar pageSize = this._getCookie('page-size');\r\n\t\t\tif (pageSize) {\r\n\t\t\t\tthis.options.pageSize = this._normalizeNumber(pageSize, 1, 1000000, this.options.pageSize);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates bottom panel and adds to the page.\r\n\t\t*************************************************************************/\r\n\t\t_createBottomPanel: function() {\r\n\t\t\tthis._$bottomPanel = $('
')\r\n\t\t\t\t.addClass('ewjtable-bottom-panel clearfix') //***\r\n\t\t\t\t.insertAfter(this._$table);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass(this._$bottomPanel, 'ui-state-default');\r\n\r\n\t\t\t$('
').addClass('ewjtable-left-area float-left').appendTo(this._$bottomPanel); //***\r\n\t\t\t$('
').addClass('ewjtable-right-area float-right').appendTo(this._$bottomPanel); //***\r\n\t\t},\r\n\r\n\t\t/* Creates page list area.\r\n\t\t*************************************************************************/\r\n\t\t_createPageListArea: function() {\r\n\t\t\tthis._$pagingListArea = $('')\r\n\t\t\t\t.addClass('ewjtable-page-list')\r\n\t\t\t\t.appendTo(this._$bottomPanel.find('.ewjtable-left-area'));\r\n\r\n\t\t\tthis._$pageInfoSpan = $('')\r\n\t\t\t\t.addClass('ewjtable-page-info')\r\n\t\t\t\t.appendTo(this._$bottomPanel.find('.ewjtable-right-area'));\r\n\t\t},\r\n\r\n\t\t/* Creates page list change area.\r\n\t\t*************************************************************************/\r\n\t\t_createPageSizeSelection: function() {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tif (!self.options.pageSizeChangeArea) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t//Add current page size to page sizes list if not contains it\r\n\t\t\tif (self._findIndexInArray(self.options.pageSize, self.options.pageSizes) < 0) {\r\n\t\t\t\tself.options.pageSizes.push(parseInt(self.options.pageSize));\r\n\t\t\t\tself.options.pageSizes.sort(function(a, b) { return a - b; });\r\n\t\t\t}\r\n\r\n\t\t\t//Add a span to contain page size change items\r\n\t\t\tself._$pageSizeChangeArea = $('')\r\n\t\t\t\t.addClass('ewjtable-page-size-change')\r\n\t\t\t\t.appendTo(self._$bottomPanel.find('.ewjtable-left-area'));\r\n\r\n\t\t\t//Page size label\r\n\t\t\tself._$pageSizeChangeArea.append('' + self.options.messages.pageSizeChangeLabel + ': ');\r\n\r\n\t\t\t//Page size change combobox\r\n\t\t\tvar $pageSizeChangeCombobox = $('').appendTo(self._$pageSizeChangeArea);\r\n\r\n\t\t\t//Add page sizes to the combobox\r\n\t\t\tfor (var i = 0; i < self.options.pageSizes.length; i++) {\r\n\t\t\t\t$pageSizeChangeCombobox.append('');\r\n\t\t\t}\r\n\r\n\t\t\t//Select current page size\r\n\t\t\t$pageSizeChangeCombobox.val(self.options.pageSize);\r\n\r\n\t\t\t//Change page size on combobox change\r\n\t\t\t$pageSizeChangeCombobox.change(function() {\r\n\t\t\t\tself._changePageSize(parseInt($(this).val()));\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Creates go to page area.\r\n\t\t*************************************************************************/\r\n\t\t_createGotoPageInput: function() {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tif (!self.options.gotoPageArea || self.options.gotoPageArea == 'none') {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t//Add a span to contain goto page items\r\n\t\t\tthis._$gotoPageArea = $('')\r\n\t\t\t\t.addClass('ewjtable-goto-page')\r\n\t\t\t\t.appendTo(self._$bottomPanel.find('.ewjtable-left-area'));\r\n\r\n\t\t\t//Goto page label\r\n\t\t\tthis._$gotoPageArea.append('' + self.options.messages.gotoPageLabel + ''); //***\r\n\r\n\t\t\t//Goto page input\r\n\t\t\tif (self.options.gotoPageArea == 'combobox') {\r\n\r\n\t\t\t\tself._$gotoPageInput = $('')\r\n\t\t\t\t\t.addClass(\"custom-select custom-select-sm\")\r\n\t\t\t\t\t.appendTo(this._$gotoPageArea)\r\n\t\t\t\t\t.data('pageCount', 1)\r\n\t\t\t\t\t.change(function() {\r\n\t\t\t\t\t\tself._changePage(parseInt($(this).val()));\r\n\t\t\t\t\t});\r\n\t\t\t\tself._$gotoPageInput.append('');\r\n\r\n\t\t\t} else { //textbox\r\n\r\n\t\t\t\tself._$gotoPageInput = $('')\r\n\t\t\t\t\t.addClass(\"form-control form-control-sm\")\r\n\t\t\t\t\t.appendTo(this._$gotoPageArea)\r\n\t\t\t\t\t.keypress(function(event) {\r\n\t\t\t\t\t\tif (event.which == 13) { //enter\r\n\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\tself._changePage(parseInt(self._$gotoPageInput.val()));\r\n\t\t\t\t\t\t} else if (event.which == 43) { // +\r\n\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\tself._changePage(parseInt(self._$gotoPageInput.val()) + 1);\r\n\t\t\t\t\t\t} else if (event.which == 45) { // -\r\n\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\tself._changePage(parseInt(self._$gotoPageInput.val()) - 1);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t//Allow only digits\r\n\t\t\t\t\t\t\tvar isValid = (\r\n\t\t\t\t\t\t\t\t(47 < event.keyCode && event.keyCode < 58 && event.shiftKey == false && event.altKey == false)\r\n\t\t\t\t\t\t\t\t\t|| (event.keyCode == 8)\r\n\t\t\t\t\t\t\t\t\t|| (event.keyCode == 9)\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\tif (!isValid) {\r\n\t\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Refreshes the 'go to page' input.\r\n\t\t*************************************************************************/\r\n\t\t_refreshGotoPageInput: function() {\r\n\t\t\tif (!this.options.gotoPageArea || this.options.gotoPageArea == 'none') {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif (this._totalRecordCount <= 0 || this.options.pageSize > this._totalRecordCount) { //***\r\n\t\t\t\tthis._$gotoPageArea.hide();\r\n\t\t\t} else {\r\n\t\t\t\tthis._$gotoPageArea.show();\r\n\t\t\t}\r\n\r\n\t\t\tif (this.options.gotoPageArea == 'combobox') {\r\n\t\t\t\tvar oldPageCount = this._$gotoPageInput.data('pageCount');\r\n\t\t\t\tvar currentPageCount = this._calculatePageCount();\r\n\t\t\t\tif (oldPageCount != currentPageCount) {\r\n\t\t\t\t\tthis._$gotoPageInput.empty();\r\n\r\n\t\t\t\t\t//Skip some pages is there are too many pages\r\n\t\t\t\t\tvar pageStep = 1;\r\n\t\t\t\t\tif (currentPageCount > 10000) {\r\n\t\t\t\t\t\tpageStep = 100;\r\n\t\t\t\t\t} else if (currentPageCount > 5000) {\r\n\t\t\t\t\t\tpageStep = 10;\r\n\t\t\t\t\t} else if (currentPageCount > 2000) {\r\n\t\t\t\t\t\tpageStep = 5;\r\n\t\t\t\t\t} else if (currentPageCount > 1000) {\r\n\t\t\t\t\t\tpageStep = 2;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor (var i = pageStep; i <= currentPageCount; i += pageStep) {\r\n\t\t\t\t\t\tthis._$gotoPageInput.append('');\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis._$gotoPageInput.data('pageCount', currentPageCount);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//same for 'textbox' and 'combobox'\r\n\t\t\tthis._$gotoPageInput.val(this._currentPageNo);\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* OVERRIDED METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Overrides load method to set current page to 1.\r\n\t\t*************************************************************************/\r\n\t\tload: function() {\r\n\t\t\tthis._currentPageNo = 1;\r\n\r\n\t\t\tbase.load.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Used to change options dynamically after initialization.\r\n\t\t*************************************************************************/\r\n\t\t_setOption: function(key, value) {\r\n\t\t\tbase._setOption.apply(this, arguments);\r\n\r\n\t\t\tif (key == 'pageSize') {\r\n\t\t\t\tthis._changePageSize(parseInt(value));\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Changes current page size with given value.\r\n\t\t*************************************************************************/\r\n\t\t_changePageSize: function(pageSize) {\r\n\t\t\tif (pageSize == this.options.pageSize) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis.options.pageSize = pageSize;\r\n\r\n\t\t\t//Normalize current page\r\n\t\t\tvar pageCount = this._calculatePageCount();\r\n\t\t\tif (this._currentPageNo > pageCount) {\r\n\t\t\t\tthis._currentPageNo = pageCount;\r\n\t\t\t}\r\n\t\t\tif (this._currentPageNo <= 0) {\r\n\t\t\t\tthis._currentPageNo = 1;\r\n\t\t\t}\r\n\r\n\t\t\t//if user sets one of the options on the combobox, then select it.\r\n\t\t\tvar $pageSizeChangeCombobox = this._$bottomPanel.find('.ewjtable-page-size-change select');\r\n\t\t\tif ($pageSizeChangeCombobox.length > 0) {\r\n\t\t\t\tif (parseInt($pageSizeChangeCombobox.val()) != pageSize) {\r\n\t\t\t\t\tvar selectedOption = $pageSizeChangeCombobox.find('option[value=' + pageSize + ']');\r\n\t\t\t\t\tif (selectedOption.length > 0) {\r\n\t\t\t\t\t\t$pageSizeChangeCombobox.val(pageSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis._savePagingSettings();\r\n\t\t\tthis._reloadTable();\r\n\t\t},\r\n\r\n\t\t/* Saves user preferences for paging\r\n\t\t*************************************************************************/\r\n\t\t_savePagingSettings: function() {\r\n\t\t\tif (!this.options.saveUserPreferences) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis._setCookie('page-size', this.options.pageSize);\r\n\t\t},\r\n\r\n\t\t/* Overrides _createRecordLoadUrl method to add paging info to URL.\r\n\t\t*************************************************************************/\r\n\t\t_createRecordLoadUrl: function() {\r\n\t\t\tvar loadUrl = base._createRecordLoadUrl.apply(this, arguments);\r\n\t\t\tloadUrl = this._addPagingInfoToUrl(loadUrl, this._currentPageNo);\r\n\t\t\treturn loadUrl;\r\n\t\t},\r\n\r\n\t\t/* Overrides _createJtParamsForLoading method to add paging parameters to jtParams object.\r\n\t\t*************************************************************************/\r\n\t\t_createJtParamsForLoading: function () {\r\n\t\t\tvar jtParams = base._createJtParamsForLoading.apply(this, arguments);\r\n\r\n\t\t\tif (this.options.paging) {\r\n\t\t\t\tjtParams.start = (this._currentPageNo - 1) * this.options.pageSize;\r\n\t\t\t\tjtParams.recperpage = this.options.pageSize;\r\n\t\t\t}\r\n\r\n\t\t\treturn jtParams;\r\n\t\t},\r\n\r\n\t\t/* Overrides _addRowToTable method to re-load table when a new row is created.\r\n\t\t* NOTE: THIS METHOD IS DEPRECATED AND WILL BE REMOVED FROM FEATURE RELEASES.\r\n\t\t* USE _addRow METHOD.\r\n\t\t*************************************************************************/\r\n\t\t_addRowToTable: function ($tableRow, index, isNewRow) {\r\n\t\t\tif (isNewRow && this.options.paging) {\r\n\t\t\t\tthis._reloadTable();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tbase._addRowToTable.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides _addRow method to re-load table when a new row is created.\r\n\t\t*************************************************************************/\r\n\t\t_addRow: function ($row, options) {\r\n\t\t\tif (options && options.isNewRow && this.options.paging) {\r\n\t\t\t\tthis._reloadTable();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tbase._addRow.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/* Overrides _removeRowsFromTable method to re-load table when a row is removed from table.\r\n\t\t*************************************************************************/\r\n\t\t_removeRowsFromTable: function ($rows, reason) {\r\n\t\t\tbase._removeRowsFromTable.apply(this, arguments);\r\n\r\n\t\t\tif (this.options.paging) {\r\n\t\t\t\tif (this._$tableRows.length <= 0 && this._currentPageNo > 1) {\r\n\t\t\t\t\t--this._currentPageNo;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._reloadTable();\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Overrides _onRecordsLoaded method to to do paging specific tasks.\r\n\t\t*************************************************************************/\r\n\t\t_onRecordsLoaded: function (data) {\r\n\t\t\tif (this.options.paging) {\r\n\t\t\t\tthis._totalRecordCount = data.totalRecordCount; //***\r\n\t\t\t\tthis._createPagingList();\r\n\t\t\t\tthis._createPagingInfo();\r\n\t\t\t\tthis._refreshGotoPageInput();\r\n\t\t\t}\r\n\r\n\t\t\tbase._onRecordsLoaded.apply(this, arguments);\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Adds StartIndex and PageSize parameters to a URL as query string.\r\n\t\t*************************************************************************/\r\n\t\t_addPagingInfoToUrl: function (url, pageNumber) {\r\n\t\t\tif (!this.options.paging) {\r\n\t\t\t\treturn url;\r\n\t\t\t}\r\n\r\n\t\t\tvar startIndex = (pageNumber - 1) * this.options.pageSize;\r\n\t\t\tvar pageSize = this.options.pageSize;\r\n\r\n\t\t\treturn (url + (url.indexOf('?') < 0 ? '?' : '&') + 'start=' + startIndex + '&recperpage=' + pageSize);\r\n\t\t},\r\n\r\n\t\t/* Creates and shows the page list.\r\n\t\t*************************************************************************/\r\n\t\t_createPagingList: function () {\r\n\t\t\tif (this.options.pageSize <= 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis._$pagingListArea.empty();\r\n\t\t\tif (this._totalRecordCount <= 0 || this.options.pageSize > this._totalRecordCount) { //***\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar pageCount = this._calculatePageCount();\r\n\r\n\t\t\tthis._createFirstAndPreviousPageButtons();\r\n\t\t\tif (this.options.pageList == 'normal') {\r\n\t\t\t\tthis._createPageNumberButtons(this._calculatePageNumbers(pageCount));\r\n\t\t\t} else {\r\n\r\n\t\t\t}\r\n\t\t\tthis._createLastAndNextPageButtons(pageCount);\r\n\t\t\tthis._bindClickEventsToPageNumberButtons();\r\n\r\n\t\t\tthis._$pagingListArea.wrapInner('
');\r\n\t\t},\r\n\r\n\t\t/* Creates and shows previous and first page links.\r\n\t\t*************************************************************************/\r\n\t\t_createFirstAndPreviousPageButtons: function () {\r\n\t\t\tvar $first = $('')\r\n\t\t\t\t.addClass('ewjtable-page-number-first btn btn-default')\r\n\t\t\t\t.html('')\r\n\t\t\t\t.data('pageNumber', 1)\r\n\t\t\t\t.appendTo(this._$pagingListArea);\r\n\r\n\t\t\tvar $previous = $('')\r\n\t\t\t\t.addClass('ewjtable-page-number-previous btn btn-default')\r\n\t\t\t\t.html('')\r\n\t\t\t\t.data('pageNumber', this._currentPageNo - 1)\r\n\t\t\t\t.appendTo(this._$pagingListArea);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($first, 'ui-button ui-state-default', 'ui-state-hover');\r\n\t\t\tthis._jqueryuiThemeAddClass($previous, 'ui-button ui-state-default', 'ui-state-hover');\r\n\r\n\t\t\tif (this._currentPageNo <= 1) {\r\n\t\t\t\t$first.addClass('ewjtable-page-number-disabled disabled');\r\n\t\t\t\t$previous.addClass('ewjtable-page-number-disabled disabled');\r\n\t\t\t\tthis._jqueryuiThemeAddClass($first, 'ui-state-disabled');\r\n\t\t\t\tthis._jqueryuiThemeAddClass($previous, 'ui-state-disabled');\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates and shows next and last page links.\r\n\t\t*************************************************************************/\r\n\t\t_createLastAndNextPageButtons: function (pageCount) {\r\n\t\t\tvar $next = $('')\r\n\t\t\t\t.addClass('ewjtable-page-number-next btn btn-default')\r\n\t\t\t\t.html('')\r\n\t\t\t\t.data('pageNumber', this._currentPageNo + 1)\r\n\t\t\t\t.appendTo(this._$pagingListArea);\r\n\t\t\tvar $last = $('')\r\n\t\t\t\t.addClass('ewjtable-page-number-last btn btn-default')\r\n\t\t\t\t.html('')\r\n\t\t\t\t.data('pageNumber', pageCount)\r\n\t\t\t\t.appendTo(this._$pagingListArea);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($next, 'ui-button ui-state-default', 'ui-state-hover');\r\n\t\t\tthis._jqueryuiThemeAddClass($last, 'ui-button ui-state-default', 'ui-state-hover');\r\n\r\n\t\t\tif (this._currentPageNo >= pageCount) {\r\n\t\t\t\t$next.addClass('ewjtable-page-number-disabled disabled');\r\n\t\t\t\t$last.addClass('ewjtable-page-number-disabled disabled');\r\n\t\t\t\tthis._jqueryuiThemeAddClass($next, 'ui-state-disabled');\r\n\t\t\t\tthis._jqueryuiThemeAddClass($last, 'ui-state-disabled');\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates and shows page number links for given number array.\r\n\t\t*************************************************************************/\r\n\t\t_createPageNumberButtons: function (pageNumbers) {\r\n\t\t\tvar previousNumber = 0;\r\n\t\t\tfor (var i = 0; i < pageNumbers.length; i++) {\r\n\t\t\t\t//Create \"...\" between page numbers if needed\r\n\t\t\t\tif ((pageNumbers[i] - previousNumber) > 1) {\r\n\t\t\t\t\t$('')\r\n\t\t\t\t\t\t.addClass('ewjtable-page-number-space btn btn-default')\r\n\t\t\t\t\t\t.html('')\r\n\t\t\t\t\t\t.appendTo(this._$pagingListArea);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis._createPageNumberButton(pageNumbers[i]);\r\n\t\t\t\tpreviousNumber = pageNumbers[i];\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates a page number link and adds to paging area.\r\n\t\t*************************************************************************/\r\n\t\t_createPageNumberButton: function (pageNumber) {\r\n\t\t\tvar $pageNumber = $('')\r\n\t\t\t\t.addClass('ewjtable-page-number btn btn-default')\r\n\t\t\t\t.html(pageNumber)\r\n\t\t\t\t.data('pageNumber', pageNumber)\r\n\t\t\t\t.appendTo(this._$pagingListArea);\r\n\r\n\t\t\tthis._jqueryuiThemeAddClass($pageNumber, 'ui-button ui-state-default', 'ui-state-hover');\r\n\r\n\t\t\tif (this._currentPageNo == pageNumber) {\r\n\t\t\t\t$pageNumber.addClass('ewjtable-page-number-active ewjtable-page-number-disabled');\r\n\t\t\t\tthis._jqueryuiThemeAddClass($pageNumber, 'ui-state-active');\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Calculates total page count according to page size and total record count.\r\n\t\t*************************************************************************/\r\n\t\t_calculatePageCount: function () {\r\n\t\t\tvar pageCount = Math.floor(this._totalRecordCount / this.options.pageSize);\r\n\t\t\tif (this._totalRecordCount % this.options.pageSize != 0) {\r\n\t\t\t\t++pageCount;\r\n\t\t\t}\r\n\r\n\t\t\treturn pageCount;\r\n\t\t},\r\n\r\n\t\t/* Calculates page numbers and returns an array of these numbers.\r\n\t\t*************************************************************************/\r\n\t\t_calculatePageNumbers: function (pageCount) {\r\n\t\t\tif (pageCount <= 4) {\r\n\t\t\t\t//Show all pages\r\n\t\t\t\tvar pageNumbers = [];\r\n\t\t\t\tfor (var i = 1; i <= pageCount; ++i) {\r\n\t\t\t\t\tpageNumbers.push(i);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn pageNumbers;\r\n\t\t\t} else {\r\n\t\t\t\t//show first three, last three, current, previous and next page numbers\r\n\t\t\t\tvar shownPageNumbers = [1, 2, pageCount - 1, pageCount];\r\n\t\t\t\tvar previousPageNo = this._normalizeNumber(this._currentPageNo - 1, 1, pageCount, 1);\r\n\t\t\t\tvar nextPageNo = this._normalizeNumber(this._currentPageNo + 1, 1, pageCount, 1);\r\n\r\n\t\t\t\tthis._insertToArrayIfDoesNotExists(shownPageNumbers, previousPageNo);\r\n\t\t\t\tthis._insertToArrayIfDoesNotExists(shownPageNumbers, this._currentPageNo);\r\n\t\t\t\tthis._insertToArrayIfDoesNotExists(shownPageNumbers, nextPageNo);\r\n\r\n\t\t\t\tshownPageNumbers.sort(function (a, b) { return a - b; });\r\n\t\t\t\treturn shownPageNumbers;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Creates and shows paging informations.\r\n\t\t*************************************************************************/\r\n\t\t_createPagingInfo: function () {\r\n\t\t\tif (this._totalRecordCount <= 0 || this.options.pageSize > this._totalRecordCount) { //***\r\n\t\t\t\tthis._$pageInfoSpan.empty();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar startNo = (this._currentPageNo - 1) * this.options.pageSize + 1;\r\n\t\t\tvar endNo = this._currentPageNo * this.options.pageSize;\r\n\t\t\tendNo = this._normalizeNumber(endNo, startNo, this._totalRecordCount, 0);\r\n\r\n\t\t\tif (endNo >= startNo) {\r\n\t\t\t\tvar pagingInfoMessage = this._formatString(this.options.messages.pagingInfo, startNo, endNo, this._totalRecordCount);\r\n\t\t\t\tthis._$pageInfoSpan.html(pagingInfoMessage);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Binds click events of all page links to change the page.\r\n\t\t*************************************************************************/\r\n\t\t_bindClickEventsToPageNumberButtons: function () {\r\n\t\t\tvar self = this;\r\n\t\t\tself._$pagingListArea\r\n\t\t\t\t.find('.ewjtable-page-number,.ewjtable-page-number-previous,.ewjtable-page-number-next,.ewjtable-page-number-first,.ewjtable-page-number-last')\r\n\t\t\t\t.not('.ewjtable-page-number-disabled')\r\n\t\t\t\t.click(function (e) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\tself._changePage($(this).data('pageNumber'));\r\n\t\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Changes current page to given value.\r\n\t\t*************************************************************************/\r\n\t\t_changePage: function (pageNo) {\r\n\t\t\tpageNo = this._normalizeNumber(pageNo, 1, this._calculatePageCount(), 1);\r\n\t\t\tif (pageNo == this._currentPageNo) {\r\n\t\t\t\tthis._refreshGotoPageInput();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis._currentPageNo = pageNo;\r\n\t\t\tthis._reloadTable();\r\n\t\t}\r\n\r\n\t});\r\n\r\n})(jQuery);\r\n\r\n\r\n/************************************************************************\r\n* SORTING extension for jTable *\r\n*************************************************************************/\r\n(function ($) {\r\n\r\n\t//Reference to base object members\r\n\tvar base = {\r\n\t\t_initializeFields: $.ew.ewjtable.prototype._initializeFields,\r\n\t\t_normalizeFieldOptions: $.ew.ewjtable.prototype._normalizeFieldOptions,\r\n\t\t_createHeaderCellForField: $.ew.ewjtable.prototype._createHeaderCellForField,\r\n\t\t_createRecordLoadUrl: $.ew.ewjtable.prototype._createRecordLoadUrl,\r\n\t\t_createJtParamsForLoading: $.ew.ewjtable.prototype._createJtParamsForLoading\r\n\t};\r\n\r\n\t//extension members\r\n\t$.extend(true, $.ew.ewjtable.prototype, {\r\n\r\n\t\t/************************************************************************\r\n\t\t* DEFAULT OPTIONS / EVENTS *\r\n\t\t*************************************************************************/\r\n\t\toptions: {\r\n\t\t\tsorting: false,\r\n\t\t\tmultiSorting: false,\r\n\t\t\tdefaultSorting: ''\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE FIELDS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t_lastSorting: null, //Last sorting of the table\r\n\r\n\t\t/************************************************************************\r\n\t\t* OVERRIDED METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Overrides base method to create sorting array.\r\n\t\t*************************************************************************/\r\n\t\t_initializeFields: function () {\r\n\t\t\tbase._initializeFields.apply(this, arguments);\r\n\r\n\t\t\tthis._lastSorting = [];\r\n\t\t\tif (this.options.sorting) {\r\n\t\t\t\tthis._buildDefaultSortingArray();\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/* Overrides _normalizeFieldOptions method to normalize sorting option for fields.\r\n\t\t*************************************************************************/\r\n\t\t_normalizeFieldOptions: function (fieldName, props) {\r\n\t\t\tbase._normalizeFieldOptions.apply(this, arguments);\r\n\t\t\tprops.sorting = (props.sorting != false);\r\n\t\t},\r\n\r\n\t\t/* Overrides _createHeaderCellForField to make columns sortable.\r\n\t\t*************************************************************************/\r\n\t\t_createHeaderCellForField: function (fieldName, field) {\r\n\t\t\tvar $headerCell = base._createHeaderCellForField.apply(this, arguments);\r\n\t\t\tif (this.options.sorting && field.sorting) {\r\n\t\t\t\tthis._makeColumnSortable($headerCell, fieldName);\r\n\t\t\t}\r\n\r\n\t\t\treturn $headerCell;\r\n\t\t},\r\n\r\n\t\t/* Overrides _createRecordLoadUrl to add sorting specific info to URL.\r\n\t\t*************************************************************************/\r\n\t\t_createRecordLoadUrl: function () {\r\n\t\t\tvar loadUrl = base._createRecordLoadUrl.apply(this, arguments);\r\n\t\t\tloadUrl = this._addSortingInfoToUrl(loadUrl);\r\n\t\t\treturn loadUrl;\r\n\t\t},\r\n\r\n\t\t/************************************************************************\r\n\t\t* PRIVATE METHODS *\r\n\t\t*************************************************************************/\r\n\r\n\t\t/* Builds the sorting array according to defaultSorting string\r\n\t\t*************************************************************************/\r\n\t\t_buildDefaultSortingArray: function () {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t$.each(self.options.defaultSorting.split(\",\"), function (orderIndex, orderValue) {\r\n\t\t\t\t$.each(self.options.fields, function (fieldName, fieldProps) {\r\n\t\t\t\t\tif (fieldProps.sorting) {\r\n\t\t\t\t\t\tvar colOffset = orderValue.indexOf(fieldName);\r\n\t\t\t\t\t\tif (colOffset > -1) {\r\n\t\t\t\t\t\t\tif (orderValue.toUpperCase().indexOf(' DESC', colOffset) > -1) {\r\n\t\t\t\t\t\t\t\tself._lastSorting.push({\r\n\t\t\t\t\t\t\t\t\tfieldName: fieldName,\r\n\t\t\t\t\t\t\t\t\tsortOrder: 'DESC'\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tself._lastSorting.push({\r\n\t\t\t\t\t\t\t\t\tfieldName: fieldName,\r\n\t\t\t\t\t\t\t\t\tsortOrder: 'ASC'\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Makes a column sortable.\r\n\t\t*************************************************************************/\r\n\t\t_makeColumnSortable: function ($columnHeader, fieldName) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\t$columnHeader\r\n\t\t\t\t.addClass('ewjtable-column-header-sortable')\r\n\t\t\t\t.click(function (e) {\r\n\t\t\t\t\te.preventDefault();\r\n\r\n\t\t\t\t\tif (!self.options.multiSorting || !e.ctrlKey) {\r\n\t\t\t\t\t\tself._lastSorting = []; //clear previous sorting\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tself._sortTableByColumn($columnHeader);\r\n\t\t\t\t});\r\n\r\n\t\t\t//Set default sorting\r\n\t\t\t$.each(this._lastSorting, function (sortIndex, sortField) {\r\n\t\t\t\tif (sortField.fieldName == fieldName) {\r\n\t\t\t\t\tif (sortField.sortOrder == 'DESC') {\r\n\t\t\t\t\t\t$columnHeader.addClass('ewjtable-column-header-sorted-desc');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$columnHeader.addClass('ewjtable-column-header-sorted-asc');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Sorts table according to a column header.\r\n\t\t*************************************************************************/\r\n\t\t_sortTableByColumn: function ($columnHeader) {\r\n\t\t\t//Remove sorting styles from all columns except this one\r\n\t\t\tif (this._lastSorting.length == 0) {\r\n\t\t\t\t$columnHeader.siblings().removeClass('ewjtable-column-header-sorted-asc jtable-column-header-sorted-desc');\r\n\t\t\t}\r\n\r\n\t\t\t//If current sorting list includes this column, remove it from the list\r\n\t\t\tfor (var i = 0; i < this._lastSorting.length; i++) {\r\n\t\t\t\tif (this._lastSorting[i].fieldName == $columnHeader.data('fieldName')) {\r\n\t\t\t\t\tthis._lastSorting.splice(i--, 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//Sort ASC or DESC according to current sorting state\r\n\t\t\tif ($columnHeader.hasClass('ewjtable-column-header-sorted-asc')) {\r\n\t\t\t\t$columnHeader.removeClass('ewjtable-column-header-sorted-asc').addClass('ewjtable-column-header-sorted-desc');\r\n\t\t\t\tthis._lastSorting.push({\r\n\t\t\t\t\t'fieldName': $columnHeader.data('fieldName'),\r\n\t\t\t\t\tsortOrder: 'DESC'\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\t$columnHeader.removeClass('ewjtable-column-header-sorted-desc').addClass('ewjtable-column-header-sorted-asc');\r\n\t\t\t\tthis._lastSorting.push({\r\n\t\t\t\t\t'fieldName': $columnHeader.data('fieldName'),\r\n\t\t\t\t\tsortOrder: 'ASC'\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t//Load current page again\r\n\t\t\tthis._reloadTable();\r\n\t\t},\r\n\r\n\t\t/* Adds jtSorting parameter to a URL as query string.\r\n\t\t*************************************************************************/\r\n\t\t_addSortingInfoToUrl: function (url) {\r\n\t\t\tif (!this.options.sorting || this._lastSorting.length == 0) {\r\n\t\t\t\treturn url;\r\n\t\t\t}\r\n\r\n\t\t\tvar sorting = [];\r\n\t\t\t$.each(this._lastSorting, function (idx, value) {\r\n\t\t\t\tsorting.push(value.fieldName + ' ' + value.sortOrder);\r\n\t\t\t});\r\n\r\n\t\t\treturn (url + (url.indexOf('?') < 0 ? '?' : '&') + 'sorting=' + sorting.join(\",\"));\r\n\t\t},\r\n\r\n\t\t/* Overrides _createJtParamsForLoading method to add sorging parameters to jtParams object.\r\n\t\t*************************************************************************/\r\n\t\t_createJtParamsForLoading: function () {\r\n\t\t\tvar jtParams = base._createJtParamsForLoading.apply(this, arguments);\r\n\r\n\t\t\tif (this.options.sorting && this._lastSorting.length) {\r\n\t\t\t\tvar sorting = [];\r\n\t\t\t\t$.each(this._lastSorting, function (idx, value) {\r\n\t\t\t\t\tsorting.push(value.fieldName + ' ' + value.sortOrder);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tjtParams.sorting = sorting.join(\",\");\r\n\t\t\t}\r\n\r\n\t\t\treturn jtParams;\r\n\t\t}\r\n\r\n\t});\r\n\r\n})(jQuery);"]}