Click here to Skip to main content
13,354,132 members (58,093 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads

Tagged as

Stats

217.1K views
10.1K downloads
239 bookmarked
Posted 17 Jan 2012

Real time, Asynchronous Web Pages using jTable, SignalR and ASP.NET MVC

, 17 Jan 2012
Real time, asynchronous web pages using jTable, SignalR and ASP.NET MVC
jTableWithSignalR
jTableSampleDatabaseLayer
bin
Release
EntityFramework.dll
jTableSampleDatabaseLayer.dll
jTableSampleDatabaseLayer.pdb
Models
Properties
Repositories
Memory
Sessions
jTableWithSignalR
jTableWithSignalR.suo
bin
SignalR.dll
Content
themes
base
images
ui-bg_flat_0_aaaaaa_40x100.png
ui-bg_flat_75_ffffff_40x100.png
ui-bg_glass_55_fbf9ee_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_dadada_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_95_fef1ec_1x400.png
ui-bg_highlight-soft_75_cccccc_1x100.png
ui-icons_222222_256x240.png
ui-icons_2e83ff_256x240.png
ui-icons_454545_256x240.png
ui-icons_888888_256x240.png
ui-icons_cd0a0a_256x240.png
minified
images
ui-bg_flat_0_aaaaaa_40x100.png
ui-bg_flat_75_ffffff_40x100.png
ui-bg_glass_55_fbf9ee_1x400.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_dadada_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_95_fef1ec_1x400.png
ui-bg_highlight-soft_75_cccccc_1x100.png
ui-icons_222222_256x240.png
ui-icons_2e83ff_256x240.png
ui-icons_454545_256x240.png
ui-icons_888888_256x240.png
ui-icons_cd0a0a_256x240.png
redmond
images
ui-bg_flat_0_aaaaaa_40x100.png
ui-bg_flat_55_fbec88_40x100.png
ui-bg_glass_75_d0e5f5_1x400.png
ui-bg_glass_85_dfeffc_1x400.png
ui-bg_glass_95_fef1ec_1x400.png
ui-bg_gloss-wave_55_5c9ccc_500x100.png
ui-bg_inset-hard_100_f5f8f9_1x100.png
ui-bg_inset-hard_100_fcfdfd_1x100.png
ui-icons_217bc0_256x240.png
ui-icons_2e83ff_256x240.png
ui-icons_469bdd_256x240.png
ui-icons_6da8d5_256x240.png
ui-icons_cd0a0a_256x240.png
ui-icons_d8e7f3_256x240.png
ui-icons_f9bd01_256x240.png
Controllers
Global.asax
jTableWithSignalR.csproj.user
Models
Properties
Scripts
jtable
extensions
external
themes
empty
standard
blue
header-bg.gif
loading.gif
title-bg.png
close.png
column-asc.png
column-desc.png
column-sortable.png
delete.png
edit.png
green
header-bg.gif
loading.gif
title-bg.png
purple
loading.gif
red
header-bg.gif
loading.gif
title-bg.png
Views
Home
Shared
/* 
jTable 1.5.1
http://www.jtable.org
---------------------------------------------------------------------------
Copyright (C) 2011-2012 by Halil �brahim Kalkan (http://www.halilibrahimkalkan.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
(function(d){d.widget("hik.jtable",{options:{actions:{},fields:{},animationsEnabled:!0,defaultDateFormat:"yy-mm-dd",dialogShowEffect:"fade",dialogHideEffect:"fade",showCloseButton:!1,closeRequested:function(){},formCreated:function(){},formSubmitting:function(){},formClosed:function(){},loadingRecords:function(){},recordsLoaded:function(){},rowInserted:function(){},rowsRemoved:function(){},messages:{serverCommunicationError:"An error occured while communicating to the server.",loadingMessage:"Loading records...",
noDataAvailable:"No data available!",areYouSure:"Are you sure?",save:"Save",saving:"Saving",cancel:"Cancel",error:"Error",close:"Close",cannotLoadOptionsFor:"Can not load options for field {0}"}},_$mainContainer:null,_$table:null,_$tableBody:null,_$tableRows:null,_$bottomPanel:null,_$busyDiv:null,_$busyMessageDiv:null,_$errorDialogDiv:null,_columnList:null,_fieldList:null,_keyField:null,_firstDataColumnOffset:0,_lastPostData:null,_cache:null,_create:function(){this._normalizeFieldsOptions();this._initializeFields();
this._createFieldAndColumnList();this._createMainContainer();this._createTableTitle();this._createTable();this._createBottomPanel();this._createBusyPanel();this._createErrorDialogDiv();this._addNoDataRow()},_normalizeFieldsOptions:function(){var b=this;d.each(b.options.fields,function(a,c){b._normalizeFieldOptions(a,c)})},_normalizeFieldOptions:function(b,a){a.listClass=a.listClass||"";a.inputClass=a.inputClass||""},_initializeFields:function(){this._lastPostData={};this._$tableRows=[];this._columnList=
[];this._fieldList=[];this._cache=[]},_createFieldAndColumnList:function(){var b=this;d.each(b.options.fields,function(a,c){b._fieldList.push(a);if(!0==c.key)b._keyField=a;!1!=c.list&&"hidden"!=c.type&&b._columnList.push(a)})},_createMainContainer:function(){this._$mainContainer=d('<div class="jtable-main-container"></div>').appendTo(this.element)},_createTableTitle:function(){var b=this;if(b.options.title){var a=d('<div class="jtable-title"><div class="jtable-title-text">'+b.options.title+"</div></div>").appendTo(b._$mainContainer);
b.options.showCloseButton&&d('<button class="jtable-command-button jtable-close-button" title="'+b.options.messages.close+'"><span>'+b.options.messages.close+"</span></button>").appendTo(a).click(function(a){a.preventDefault();a.stopPropagation();b._onCloseRequested()})}},_createTable:function(){this._$table=d('<table class="jtable"></table>').appendTo(this._$mainContainer);this._createTableHead();this._createTableBody()},_createTableHead:function(){this._addRowToTableHead(d("<thead></thead>").appendTo(this._$table))},
_addRowToTableHead:function(b){this._addColumnsToHeaderRow(d("<tr></tr>").appendTo(b))},_addColumnsToHeaderRow:function(b){for(var a=0;a<this._columnList.length;a++){var c=this._columnList[a];this._createHeaderCellForField(c,this.options.fields[c]).data("fieldName",c).appendTo(b)}},_createHeaderCellForField:function(b,a){return d('<th class="jtable-column-header"'+(void 0!=a.width?' style="width:'+(a.width||"10%"):"")+'"><div class="jtable-column-header-container"><span class="jtable-column-header-text">'+
a.title+"</span></div></th>").data("fieldName",b)},_createEmptyCommandHeader:function(){return d('<th class="jtable-command-column-header"></th>')},_createTableBody:function(){this._$tableBody=d("<tbody></tbody>").appendTo(this._$table)},_createBottomPanel:function(){this._$bottomPanel=d('<div class="jtable-bottom-panel"></div>').appendTo(this._$mainContainer)},_createBusyPanel:function(){this._$busyMessageDiv=d('<div class="jtable-busy-message"></div>').prependTo(this._$mainContainer);this._$busyDiv=
d('<div class="jtable-busy-panel-background"></div>').prependTo(this._$mainContainer);this._hideBusy()},_createErrorDialogDiv:function(){var b=this;b._$errorDialogDiv=d("<div></div>").appendTo(b._$mainContainer);b._$errorDialogDiv.dialog({autoOpen:!1,show:b.options.dialogShowEffect,hide:b.options.dialogHideEffect,modal:!0,title:b.options.messages.error,buttons:[{text:b.options.messages.close,click:function(){b._$errorDialogDiv.dialog("close")}}]})},load:function(b,a){this._lastPostData=b;this._reloadTable(a)},
reload:function(b){this._reloadTable(b)},destroy:function(){this.element.empty();d.Widget.prototype.destroy.call(this)},_reloadTable:function(b){var a=this;a._showBusy(a.options.messages.loadingMessage);var c=a._createRecordLoadUrl();a._onLoadingRecords();a._performAjaxCall(c,a._lastPostData,!0,function(e){a._hideBusy();"OK"!=e.Result?a._showError(e.Message):(a._removeAllRows("reloading"),a._addRecordsToTable(e.Records),a._onRecordsLoaded(e),b&&b())},function(){a._hideBusy();a._showError(a.options.messages.serverCommunicationError)})},
_createRecordLoadUrl:function(){return this.options.actions.listAction},_createRowFromRecord:function(b){b=d("<tr></tr>").data("record",b);this._addCellsToRowUsingRecord(b);return b},_addCellsToRowUsingRecord:function(b){for(var a=b.data("record"),c=0;c<this._columnList.length;c++)d('<td class="'+this.options.fields[this._columnList[c]].listClass+'"></td>').appendTo(b).append(this._getDisplayTextForRecordField(a,this._columnList[c])||"")},_addRecordsToTable:function(b){var a=this;d.each(b,function(b,
e){a._addRowToTable(a._createRowFromRecord(e))});a._refreshRowStyles()},_addRowToTable:function(b,a,c,e){!0!=c&&(c=!1);!1!=e&&(e=!0);0>=this._$tableRows.length&&this._removeNoDataRow();a=this._normalizeNumber(a,0,this._$tableRows.length,this._$tableRows.length);a==this._$tableRows.length?(this._$tableBody.append(b),this._$tableRows.push(b)):0==a?(this._$tableBody.prepend(b),this._$tableRows.unshift(b)):(this._$tableRows[a-1].after(b),this._$tableRows.splice(a,0,b));this._onRowInserted(b,c);!0==c&&
(this._refreshRowStyles(),this.options.animationsEnabled&&e&&this._showNewRowAnimation(b))},_showNewRowAnimation:function(b){b.addClass("jtable-row-created","slow","",function(){b.removeClass("jtable-row-created",5E3)})},_removeRowsFromTable:function(b,a){var c=this;0>=b.length||(b.remove(),b.each(function(){c._$tableRows.splice(c._findRowIndex(d(this)),1)}),c._onRowsRemoved(b,a),0==c._$tableRows.length&&c._addNoDataRow(),c._refreshRowStyles())},_findRowIndex:function(b){return this._findIndexInArray(b,
this._$tableRows,function(a,b){return a.data("record")==b.data("record")})},_removeAllRows:function(b){if(!(0>=this._$tableRows.length)){var a=this._$tableBody.find("tr");this._$tableBody.empty();this._$tableRows=[];this._onRowsRemoved(a,b);this._addNoDataRow()}},_addNoDataRow:function(){var b=this._$table.find("thead th").length;d('<tr class="jtable-no-data-row"></tr>').append('<td colspan="'+b+'">'+this.options.messages.noDataAvailable+"</td>").appendTo(this._$tableBody)},_removeNoDataRow:function(){this._$tableBody.find(".jtable-no-data-row").remove()},
_refreshRowStyles:function(){for(var b=0;b<this._$tableRows.length;b++)0==b%2?this._$tableRows[b].addClass("jtable-row-even"):this._$tableRows[b].removeClass("jtable-row-even")},_getDisplayTextForRecordField:function(b,a){var c=this.options.fields[a],e=b[a];return c.display?c.display({record:b}):"date"==c.type?this._getDisplayTextForDateRecordField(c,e):"checkbox"==c.type?this._getCheckBoxTextForFieldByValue(a,e):c.options?this._getOptionsWithCaching(a)[e]:e},_getDisplayTextForDateRecordField:function(b,
a){if(!a)return"";var c=b.displayFormat||this.options.defaultDateFormat,e=this._parseDate(a);return d.datepicker.formatDate(c,e)},_parseDate:function(b){if(0<=b.indexOf("Date"))return new Date(parseInt(b.substr(6)));if(10==b.length)return new Date(parseInt(b.substr(0,4)),parseInt(b.substr(5,2))-1,parseInt(b.substr(8,2)));if(19==b.length)return new Date(parseInt(b.substr(0,4)),parseInt(b.substr(5,2))-1,parseInt(b.substr(8,2)),parseInt(b.substr(11,2)),parseInt(b.substr(14,2)),parseInt(b.substr(17,2)));
this._logWarn("Given date is no properly formatted: "+b);return new Date},_showError:function(b){this._$errorDialogDiv.html(b).dialog("open")},_showBusy:function(b){this._$busyMessageDiv.is(":visible")||(this._$busyDiv.width(this._$mainContainer.width()),this._$busyDiv.height(this._$mainContainer.height()),this._$busyDiv.show(),this._$busyMessageDiv.show());this._$busyMessageDiv.html(b)},_hideBusy:function(){this._$busyDiv.hide();this._$busyMessageDiv.html("").hide()},_isBusy:function(){return this._$busyMessageDiv.is(":visible")},
_performAjaxCall:function(b,a,c,e,g){d.ajax({url:b,type:"POST",dataType:"json",data:a,async:c,success:function(a){e(a)},error:function(){g()}})},getRowByKey:function(b){for(var a=0;a<this._$tableRows.length;a++)if(b==this._$tableRows[a].data("record")[this._keyField])return this._$tableRows[a];return null},_onLoadingRecords:function(){this._trigger("loadingRecords",null,{})},_onRecordsLoaded:function(b){this._trigger("recordsLoaded",null,{records:b.Records,serverResponse:b})},_onRowInserted:function(b,
a){this._trigger("rowInserted",null,{row:b,record:b.data("record"),isNewRow:a})},_onRowsRemoved:function(b,a){this._trigger("rowsRemoved",null,{rows:b,reason:a})},_onCloseRequested:function(){this._trigger("closeRequested",null,{})}})})(jQuery);
(function(d){d.extend(!0,d.hik.jtable.prototype,{_getPropertyOfObject:function(b,a){if(0>a.indexOf("."))return b[a];var c=a.substring(0,a.indexOf(".")),e=a.substring(a.indexOf(".")+1);return this._getPropertyOfObject(b[c],e)},_setPropertyOfObject:function(b,a,c){if(0>a.indexOf("."))b[a]=c;else{var e=a.substring(0,a.indexOf(".")),a=a.substring(a.indexOf(".")+1);this._setPropertyOfObject(b[e],a,c)}},_insertToArrayIfDoesNotExists:function(b,a){0>d.inArray(a,b)&&b.push(a)},_findIndexInArray:function(b,
a,c){c||(c=function(a,e){return a==e});for(var e=0;e<a.length;e++)if(c(b,a[e]))return e;return-1},_normalizeNumber:function(b,a,c,e){return void 0==b||null==b?e:b<a?a:b>c?c:b},_formatString:function(){if(0==arguments.length)return null;for(var b=arguments[0],a=1;a<arguments.length;a++)b=b.replace("{"+(a-1)+"}",arguments[a]);return b},_logDebug:function(b){console&&console.log("jTable DEBUG: "+b)},_logInfo:function(b){console&&console.log("jTable INFO: "+b)},_logWarn:function(b){console&&console.log("jTable WARNING: "+
b)},_logError:function(b){console&&console.log("jTable ERROR: "+b)}})})(jQuery);
(function(d){d.extend(!0,d.hik.jtable.prototype,{_submitFormUsingAjax:function(b,a,c,e){this._performAjaxCall(b,a,!0,c,e)},_createInputLabelForRecordField:function(b){return d('<div class="jtable-input-label">'+this.options.fields[b].title+"</div>")},_createInputForRecordField:function(b,a,c){var e=this.options.fields[b];if(void 0==a)a=e.defaultValue;return e.input?(a=d(e.input({value:a,record:c})),a.attr("id")||a.attr("id","Edit-"+b),a):"date"==e.type?this._createDateInputForField(e,b,a):"textarea"==
e.type?this._createTextAreaForField(e,b,a):"password"==e.type?this._createPasswordInputForField(e,b,a):"checkbox"==e.type?this._createCheckboxForField(e,b,a):e.options?"radiobutton"==e.type?this._createRadioButtonListForField(e,b,a):this._createDropDownListForField(e,b,a):this._createTextInputForField(e,b,a)},_createInputForHidden:function(b,a){if(void 0==a||null==a)a="";return d('<input type="hidden" value="'+a+'" name="'+b+'" id="Edit-'+b+'"></input>')},_createDateInputForField:function(b,a,c){a=
d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="text"'+(void 0!=c?'value="'+c+'"':"")+' name="'+a+'"></input>');a.datepicker({dateFormat:b.displayFormat||this.options.defaultDateFormat});return d('<div class="jtable-input jtable-date-input"></div>').append(a)},_createTextAreaForField:function(b,a,c){return d('<div class="jtable-input jtable-textarea-input"><textarea class="'+b.inputClass+'" id="Edit-'+a+'" name="'+a+'">'+(c||"")+"</textarea></div>")},_createTextInputForField:function(b,a,
c){return d('<div class="jtable-input jtable-text-input"><input class="'+b.inputClass+'" id="Edit-'+a+'" type="text"'+(void 0!=c?'value="'+c+'"':"")+' name="'+a+'"></input></div>')},_createPasswordInputForField:function(b,a,c){return d('<div class="jtable-input jtable-password-input"><input class="'+b.inputClass+'" id="Edit-'+a+'" type="password"'+(void 0!=c?'value="'+c+'"':"")+' name="'+a+'"></input></div>')},_createCheckboxForField:function(b,a,c){var e=this;void 0==c&&(c=c||e._getCheckBoxPropertiesForFieldByState(a,
!1).Value);var g=d('<div class="jtable-input jtable-checkbox-input"></div>'),h=d('<input class="'+b.inputClass+'" id="Edit-'+a+'" type="checkbox" name="'+a+'" value="'+c+'" />').appendTo(g),f=d("<span>"+(b.formText||e._getCheckBoxTextForFieldByValue(a,c))+"</span>").appendTo(g);e._getIsCheckBoxSelectedForFieldByValue(a,c)&&h.attr("checked","checked");var j=function(){var c=e._getCheckBoxPropertiesForFieldByState(a,h.is(":checked"));h.attr("value",c.Value);f.html(b.formText||c.DisplayText)};h.click(function(){j()});
!1!=b.setOnTextClick&&(f.addClass("jtable-option-text-clickable"),f.click(function(){h.is(":checked")?h.attr("checked",!1):h.attr("checked",!0);j()}));return g},_createDropDownListForField:function(b,a,c){var e=d('<div class="jtable-input jtable-dropdown-input"></div>'),g=d('<select class="'+b.inputClass+'" id="Edit-'+a+'" name='+a+"></select>").appendTo(e),b=this._getOptionsWithCaching(a);d.each(b,function(a,e){g.append('<option value="'+a+'"'+(a==c?' selected="selected"':"")+">"+e+"</option>")});
return e},_createRadioButtonListForField:function(b,a,c){var e=d('<div class="jtable-input jtable-radiobuttonlist-input"></div>'),g=this._getOptionsWithCaching(a),h=0;d.each(g,function(f,g){var i=d('<div class="jtable-radio-input"></div>').appendTo(e),k=d('<input type="radio" id="Edit-'+a+h++ +'" class="'+b.inputClass+'" name="'+a+'" value="'+f+'"'+(f==c?' checked="true"':"")+" />").appendTo(i),i=d("<span>"+g+"</span>").appendTo(i);!1!=b.setOnTextClick&&(i.addClass("jtable-option-text-clickable"),
i.click(function(){k.is(":checked")||k.attr("checked",!0)}))});return e},_getCheckBoxTextForFieldByValue:function(b,a){return this.options.fields[b].values[a]},_getIsCheckBoxSelectedForFieldByValue:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[1].Value.toString()==a.toString()},_getCheckBoxPropertiesForFieldByState:function(b,a){return this._createCheckBoxStateArrayForFieldWithCaching(b)[a?1:0]},_createCheckBoxStateArrayForFieldWithCaching:function(b){var a="checkbox_"+
b;this._cache[a]||(this._cache[a]=this._createCheckBoxStateArrayForField(b));return this._cache[a]},_createCheckBoxStateArrayForField:function(b){var a=[],c=0;d.each(this.options.fields[b].values,function(e,b){2>c++&&a.push({Value:e,DisplayText:b})});return a},_getOptionsWithCaching:function(b){var a="options_"+b;if(!this._cache[a]){var c=this.options.fields[b].options;this._cache[a]="string"==typeof c?this._downloadOptions(b,c):jQuery.isArray(c)?this._buildOptionsFromArray(c):c}return this._cache[a]},
_downloadOptions:function(b,a){var c=this,e={};c._performAjaxCall(a,void 0,!1,function(a){if("OK"!=a.Result)c._showError(a.Message);else for(var b=0;b<a.Options.length;b++)e[a.Options[b].Value]=a.Options[b].DisplayText},function(){var a=c._formatString(c.options.messages.cannotLoadOptionsFor,b);c._showError(a)});return e},_buildOptionsFromArray:function(b){for(var a={},c=0;c<b.length;c++)a[b[c]]=b[c];return a},_setEnabledOfDialogButton:function(b,a,c){b&&(!1!=a?b.removeAttr("disabled").removeClass("ui-state-disabled"):
b.attr("disabled","disabled").addClass("ui-state-disabled"),c&&b.find("span").text(c))}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._create;d.extend(!0,d.hik.jtable.prototype,{options:{recordAdded:function(){},messages:{addNewRecord:"+ Add new record"}},_$addRecordDiv:null,_create:function(){b.apply(this,arguments);this._createAddRecordDialogDiv()},_createAddRecordDialogDiv:function(){var a=this;if(a.options.actions.createAction){a._$addRecordDiv=d("<div></div>").appendTo(a._$mainContainer);a._$addRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,
width:"auto",minWidth:"300",modal:!0,title:a.options.messages.addNewRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$addRecordDiv.dialog("close")}},{id:"AddRecordDialogSaveButton",text:a.options.messages.save,click:function(){var b=d("#AddRecordDialogSaveButton"),e=a._$addRecordDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:e,formType:"create"})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveAddRecordForm(e,b))}}],close:function(){var b=a._$addRecordDiv.find("form").first(),
e=d("#AddRecordDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"create"});a._setEnabledOfDialogButton(e,!0,a.options.messages.save);b.remove()}});if(!a.options.addRecordButton)a.options.addRecordButton=a._createAddRecordButton();a.options.addRecordButton.click(function(b){b.preventDefault();a._showAddRecordForm()})}},_createAddRecordButton:function(){return d('<span class="jtable-add-record"><a href="#">'+this.options.messages.addNewRecord+"</a></span>").appendTo(this._$bottomPanel)},
showCreateForm:function(){this._showAddRecordForm()},addRecord:function(a){var b=this,a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.createAction,success:function(){},error:function(){}},a);a.record?a.clientOnly?(b._addRowToTable(b._createRowFromRecord(a.record),null,!0,a.animationsEnabled),a.success(),console.log("clieneeeeeee")):b._submitFormUsingAjax(a.url,d.param(a.record),function(e){"OK"!=e.Result?(b._showError(e.Message),a.error(e)):(b._onRecordAdded(e),
b._addRowToTable(b._createRowFromRecord(e.Record),null,!0,a.animationsEnabled),a.success(e))},function(){b._showError(b.options.messages.serverCommunicationError);a.error()}):b._logWarn("options parameter in addRecord method must contain a record property.")},_showAddRecordForm:function(){for(var a=d('<form id="jtable-create-form" class="jtable-dialog-form jtable-create-form" action="'+this.options.actions.createAction+'" method="POST"></form>'),b=0;b<this._fieldList.length;b++)if(!1!=this.options.fields[this._fieldList[b]].create)if("hidden"==
this.options.fields[this._fieldList[b]].type)a.append(this._createInputForHidden(this._fieldList[b],this.options.fields[this._fieldList[b]].defaultValue));else{var e=d('<div class="jtable-input-field-container"></div>').appendTo(a);e.append(this._createInputLabelForRecordField(this._fieldList[b]));e.append(this._createInputForRecordField(this._fieldList[b]))}this._$addRecordDiv.append(a).dialog("open");this._trigger("formCreated",null,{form:a,formType:"create"})},_saveAddRecordForm:function(a,b){var e=
this;a.data("submitting",!0);e._submitFormUsingAjax(a.attr("action"),a.serialize(),function(a){"OK"!=a.Result?(e._showError(a.Message),e._setEnabledOfDialogButton(b,!0,e.options.messages.save)):(e._onRecordAdded(a),e._addRowToTable(e._createRowFromRecord(a.Record),null,!0),e._$addRecordDiv.dialog("close"))},function(){e._showError(e.options.messages.serverCommunicationError);e._setEnabledOfDialogButton(b,!0,e.options.messages.save)})},_onRecordAdded:function(a){this._trigger("recordAdded",null,{record:a.Record,
serverResponse:a})}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord;d.extend(!0,d.hik.jtable.prototype,{options:{recordUpdated:function(){},rowUpdated:function(){},messages:{editRecord:"Edit Record"}},_$editDiv:null,_$editingRow:null,_create:function(){b.apply(this,arguments);this._createEditDialogDiv()},_createEditDialogDiv:function(){var a=this;a._$editDiv=d("<div></div>").appendTo(a._$mainContainer);a._$editDiv.dialog({autoOpen:!1,
show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,width:"auto",minWidth:"300",modal:!0,title:a.options.messages.editRecord,buttons:[{text:a.options.messages.cancel,click:function(){a._$editDiv.dialog("close")}},{id:"EditDialogSaveButton",text:a.options.messages.save,click:function(){var b=a._$editDiv.find("#EditDialogSaveButton"),d=a._$editDiv.find("form");!1!=a._trigger("formSubmitting",null,{form:d,formType:"edit"})&&(a._setEnabledOfDialogButton(b,!1,a.options.messages.saving),a._saveEditForm(d,
b))}}],close:function(){var b=a._$editDiv.find("form:first"),c=d("#EditDialogSaveButton");a._trigger("formClosed",null,{form:b,formType:"edit"});a._setEnabledOfDialogButton(c,!0,a.options.messages.save);b.remove()}})},updateRecord:function(a){var b=this,a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.updateAction,success:function(){},error:function(){}},a),c=a.record[b._keyField];if(!a.record||!c)b._logWarn("options parameter in updateRecord method must contain a record that contains the key field property.");
else{var f=b.getRowByKey(c);null==f?b._logWarn("Can not found any row by key: "+c):a.clientOnly?(d.extend(f.data("record"),a.record),b._updateRowTexts(f),b._onRecordUpdated(f,null),a.animationsEnabled&&b._showUpdateAnimationForRow(f),a.success()):b._submitFormUsingAjax(a.url,d.param(a.record),function(c){"OK"!=c.Result?(b._showError(c.Message),a.error(c)):(d.extend(f.data("record"),a.record),b._updateRowTexts(f),b._onRecordUpdated(f,c),a.animationsEnabled&&b._showUpdateAnimationForRow(f),a.success(c))},
function(){b._showError(b.options.messages.serverCommunicationError);a.error()})}},_addColumnsToHeaderRow:function(b){a.apply(this,arguments);void 0!=this.options.actions.updateAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){var b=this;c.apply(this,arguments);if(void 0!=b.options.actions.updateAction){var h=d('<td class="jtable-command-column"></td>').appendTo(a);d('<button class="jtable-command-button jtable-edit-command-button" title="'+b.options.messages.editRecord+
'"><span>'+b.options.messages.editRecord+"</span></button>").appendTo(h).click(function(f){f.preventDefault();f.stopPropagation();b._showEditForm(a)})}},_showEditForm:function(a){for(var b=a.data("record"),c=d('<form id="jtable-edit-form" class="jtable-dialog-form jtable-edit-form" action="'+this.options.actions.updateAction+'" method="POST"></form>'),f=0;f<this._fieldList.length;f++)if(!0==this.options.fields[this._fieldList[f]].key)c.append(this._createInputForHidden(this._fieldList[f],b[this._fieldList[f]]));
else if(!1!=this.options.fields[this._fieldList[f]].edit)if("hidden"==this.options.fields[this._fieldList[f]].type)c.append(this._createInputForHidden(this._fieldList[f],b[this._fieldList[f]]));else{var j=d('<div class="jtable-input-field-container"></div>').appendTo(c);j.append(this._createInputLabelForRecordField(this._fieldList[f]));var i=this._getValueForRecordField(b,this._fieldList[f]);j.append(this._createInputForRecordField(this._fieldList[f],i,b))}this._$editingRow=a;this._$editDiv.append(c).dialog("open");
this._trigger("formCreated",null,{form:c,formType:"edit",record:b})},_saveEditForm:function(a,b){var d=this;d._submitFormUsingAjax(a.attr("action"),a.serialize(),function(f){if("OK"!=f.Result)d._showError(f.Message),d._setEnabledOfDialogButton(b,!0,d.options.messages.save);else{var c=d._$editingRow;d._updateRecordValuesFromEditForm(c.data("record"),a);d._updateRowTexts(c);d._onRecordUpdated(c,f);d.options.animationsEnabled&&d._showUpdateAnimationForRow(c);d._$editDiv.dialog("close")}},function(){d._showError(d.options.messages.serverCommunicationError);
d._setEnabledOfDialogButton(b,!0,d.options.messages.save)})},_updateRecordValuesFromEditForm:function(a,b){for(var c=0;c<this._fieldList.length;c++){var f=this._fieldList[c],j=this.options.fields[f];if(!1!=j.edit){var i=b.find('[name="'+f+'"]');if("date"==j.type){j=j.displayFormat||this.options.defaultDateFormat;try{var k=d.datepicker.parseDate(j,i.val());a[f]="/Date("+k.getTime()+")/"}catch(l){a[f]="/Date("+(new Date).getTime()+")/"}}else j.options&&"radiobutton"==j.type?(i=i.filter('[checked="true"]'),
a[f]=i.length?i.val():void 0):a[f]=i.val()}}},_getValueForRecordField:function(a,b){var d=this.options.fields[b],f=a[b];return"date"==d.type?this._getDisplayTextForDateRecordField(d,f):f},_updateRowTexts:function(a){for(var b=a.data("record"),d=a.find("td"),f=0;f<this._columnList.length;f++){var c=this._getDisplayTextForRecordField(b,this._columnList[f]);d.eq(this._firstDataColumnOffset+f).html(c||"")}this._onRowUpdated(a)},_showUpdateAnimationForRow:function(a){a.stop(!0,!0).addClass("jtable-row-updated",
"slow","",function(){a.removeClass("jtable-row-updated",5E3)})},_onRowUpdated:function(a){this._trigger("rowUpdated",null,{row:a,record:a.data("record")})},_onRecordUpdated:function(a,b){this._trigger("recordUpdated",null,{record:a.data("record"),row:a,serverResponse:b})}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord;d.extend(!0,d.hik.jtable.prototype,{options:{deleteConfirmation:!0,recordDeleted:function(){},messages:{deleteConfirmation:"This record will be deleted. Are you sure?",deleteText:"Delete",deleting:"Deleting",canNotDeletedRecords:"Can not deleted {0} of {1} records!",deleteProggress:"Deleted {0} of {1} records, processing..."}},_$deleteRecordDiv:null,
_$deletingRow:null,_create:function(){b.apply(this,arguments);this._createDeleteDialogDiv()},_createDeleteDialogDiv:function(){var a=this;a._$deleteRecordDiv=d('<div><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span class="jtable-delete-confirm-message"></span></p></div>').appendTo(a._$mainContainer);a._$deleteRecordDiv.dialog({autoOpen:!1,show:a.options.dialogShowEffect,hide:a.options.dialogHideEffect,modal:!0,title:a.options.messages.areYouSure,buttons:[{text:a.options.messages.cancel,
click:function(){a._$deleteRecordDiv.dialog("close")}},{id:"DeleteDialogButton",text:a.options.messages.deleteText,click:function(){var b=d("#DeleteDialogButton");a._setEnabledOfDialogButton(b,!1,a.options.messages.deleting);a._deleteRecordFromServer(a._$deletingRow,function(){a._removeRowsFromTableWithAnimation(a._$deletingRow);a._$deleteRecordDiv.dialog("close")},function(d){a._showError(d);a._setEnabledOfDialogButton(b,!0,a.options.messages.deleteText)})}}],close:function(){var b=d("#DeleteDialogButton");
a._setEnabledOfDialogButton(b,!0,a.options.messages.deleteText)}})},deleteRows:function(a){var b=this;if(!(0>=a.length||b._isBusy()))if(1==a.length)b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)});else{b._showBusy(b._formatString(b.options.messages.deleteProggress,0,a.length));var c=0,f=function(){var f=a.filter(".jtable-row-ready-to-remove");f.length<a.length&&b._showError(b._formatString(b.options.messages.canNotDeletedRecords,a.length-
f.length,a.length));0<f.length&&b._removeRowsFromTableWithAnimation(f);b._hideBusy()},j=0;a.each(function(){var i=d(this);b._deleteRecordFromServer(i,function(){++j;++c;i.addClass("jtable-row-ready-to-remove");b._showBusy(b._formatString(b.options.messages.deleteProggress,j,a.length));c>=a.length&&f()},function(){++c;c>=a.length&&f()})})}},deleteRecord:function(a){var b=this,a=d.extend({clientOnly:!1,animationsEnabled:b.options.animationsEnabled,url:b.options.actions.deleteAction,success:function(){},
error:function(){}},a);if(a.key){var c=b.getRowByKey(a.key);null==c?b._logWarn("Can not found any row by key: "+a.key):a.clientOnly?(b._removeRowsFromTableWithAnimation(c,a.animationsEnabled),a.success()):b._deleteRecordFromServer(c,function(f){b._removeRowsFromTableWithAnimation(c,a.animationsEnabled);a.success(f)},function(f){b._showError(f);a.error(f)})}else b._logWarn("options parameter in deleteRecord method must contain a record key.")},_addColumnsToHeaderRow:function(b){a.apply(this,arguments);
void 0!=this.options.actions.deleteAction&&b.append(this._createEmptyCommandHeader())},_addCellsToRowUsingRecord:function(a){c.apply(this,arguments);var b=this;if(void 0!=b.options.actions.deleteAction){var h=d('<td class="jtable-command-column"></td>').appendTo(a);d('<button class="jtable-command-button jtable-delete-command-button" title="'+b.options.messages.deleteText+'"><span>'+b.options.messages.deleteText+"</span></button>").appendTo(h).click(function(f){f.preventDefault();f.stopPropagation();
b._deleteButtonClickedForRow(a)})}},_deleteButtonClickedForRow:function(a){var b=this,c,f=b.options.messages.deleteConfirmation;if(d.isFunction(b.options.deleteConfirmation)){c={row:a,record:a.data("record"),deleteConfirm:!0,deleteConfirmMessage:f,cancel:!1,cancelMessage:null};b.options.deleteConfirmation(c);if(c.cancel){c.cancelMessage&&b._showError(c.cancelMessage);return}f=c.deleteConfirmMessage;c=c.deleteConfirm}else c=b.options.deleteConfirmation;!1!=c?(b._$deleteRecordDiv.find(".jtable-delete-confirm-message").html(f),
b._showDeleteDialog(a)):b._deleteRecordFromServer(a,function(){b._removeRowsFromTableWithAnimation(a)},function(a){b._showError(a)})},_showDeleteDialog:function(a){this._$deletingRow=a;this._$deleteRecordDiv.dialog("open")},_deleteRecordFromServer:function(a,b,c){var f=this;if(!0!=a.data("deleting")){a.data("deleting",!0);var d={};d[f._keyField]=a.data("record")[f._keyField];f._performAjaxCall(f.options.actions.deleteAction,d,!0,function(d){"OK"!=d.Result?(a.data("deleting",!1),c&&c(d.Message)):(f._trigger("recordDeleted",
null,{record:a.data("record"),row:a,serverResponse:d}),b&&b(d))},function(){a.data("deleting",!1);c&&c(f.options.messages.serverCommunicationError)})}},_removeRowsFromTableWithAnimation:function(a,b){var c=this;if(void 0==b)b=c.options.animationsEnabled;b?a.stop(!0,!0).addClass("jtable-row-deleting","slow","").promise().done(function(){c._removeRowsFromTable(a,"deleted")}):c._removeRowsFromTable(a,"deleted")}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._create,a=d.hik.jtable.prototype._addColumnsToHeaderRow,c=d.hik.jtable.prototype._addCellsToRowUsingRecord,e=d.hik.jtable.prototype._onLoadingRecords,g=d.hik.jtable.prototype._onRecordsLoaded,h=d.hik.jtable.prototype._onRowsRemoved;d.extend(!0,d.hik.jtable.prototype,{options:{selecting:!1,multiselect:!1,selectingCheckboxes:!1,selectOnRowClick:!0,selectionChanged:function(){}},_selectedRecordIdsBeforeLoad:null,_$selectAllCheckbox:null,_shiftKeyDown:!1,_create:function(){this.options.selecting&&
this.options.selectingCheckboxes&&++this._firstDataColumnOffset;this._bindKeyboardEvents();b.apply(this,arguments)},_bindKeyboardEvents:function(){var a=this;d(document).keydown(function(b){switch(b.which){case 16:a._shiftKeyDown=!0}}).keyup(function(b){switch(b.which){case 16:a._shiftKeyDown=!1}})},selectedRows:function(){return this._getSelectedRows()},_addColumnsToHeaderRow:function(b){this.options.selecting&&this.options.selectingCheckboxes&&(this.options.multiselect?b.append(this._createSelectAllHeader()):
b.append(this._createEmptyCommandHeader()));a.apply(this,arguments)},_addCellsToRowUsingRecord:function(a){this.options.selecting&&this._makeRowSelectable(a);c.apply(this,arguments)},_onLoadingRecords:function(){this._storeSelectionList();e.apply(this,arguments)},_onRecordsLoaded:function(){this._restoreSelectionList();g.apply(this,arguments)},_onRowsRemoved:function(a,b){"reloading"!=b&&this.options.selecting&&0<a.filter(".jtable-row-selected").length&&this._onSelectionChanged();h.apply(this,arguments)},
_createSelectAllHeader:function(){var a=this,b=d('<th class="jtable-column-header jtable-column-header-selecting"></th>'),c=d('<div class="jtable-column-header-container"></div>').appendTo(b);a._$selectAllCheckbox=d('<input type="checkbox" />').appendTo(c);a._$selectAllCheckbox.click(function(){if(0>=a._$tableRows.length)a._$selectAllCheckbox.attr("checked",!1);else{var b=a._$tableBody.find("tr");a._$selectAllCheckbox.is(":checked")?a._selectRows(b):a._deselectRows(b);a._onSelectionChanged()}});return b},
_storeSelectionList:function(){var a=this;if(a.options.selecting)a._selectedRecordIdsBeforeLoad=[],a._getSelectedRows().each(function(){a._selectedRecordIdsBeforeLoad.push(d(this).data("record")[a._keyField])})},_restoreSelectionList:function(){if(this.options.selecting){for(var a=0,b=0;b<this._$tableRows.length;++b)-1<d.inArray(this._$tableRows[b].data("record")[this._keyField],this._selectedRecordIdsBeforeLoad)&&(this._selectRows(this._$tableRows[b]),++a);0<this._selectedRecordIdsBeforeLoad.length&&
this._selectedRecordIdsBeforeLoad.length!=a&&this._onSelectionChanged();this._selectedRecordIdsBeforeLoad=[];this._refreshSelectAllCheckboxState()}},_getSelectedRows:function(){return this._$tableBody.find(".jtable-row-selected")},_makeRowSelectable:function(a){var b=this;b.options.selectOnRowClick&&a.click(function(){b._invertRowSelection(a)});if(b.options.selectingCheckboxes){var c=d('<td class="jtable-selecting-column"></td>'),e=d('<input type="checkbox" />').appendTo(c);b.options.selectOnRowClick||
e.click(function(){b._invertRowSelection(a)});a.append(c)}},_invertRowSelection:function(a){if(a.hasClass("jtable-row-selected"))this._deselectRows(a);else if(this._shiftKeyDown){var b=this._findRowIndex(a),c=this._findFirstSelectedRowIndexBeforeIndex(b)+1;0<c&&c<b?this._selectRows(this._$tableBody.find("tr").slice(c,b+1)):(c=this._findFirstSelectedRowIndexAfterIndex(b)-1,c>b?this._selectRows(this._$tableBody.find("tr").slice(b,c+1)):this._selectRows(a))}else this._selectRows(a);this._onSelectionChanged()},
_findFirstSelectedRowIndexBeforeIndex:function(a){for(a-=1;0<=a;--a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_findFirstSelectedRowIndexAfterIndex:function(a){for(a+=1;a<this._$tableRows.length;++a)if(this._$tableRows[a].hasClass("jtable-row-selected"))return a;return-1},_selectRows:function(a){this.options.multiselect||this._deselectRows(this._getSelectedRows());a.addClass("jtable-row-selected");this.options.selectingCheckboxes&&a.find("td.jtable-selecting-column input").attr("checked",
!0);this._refreshSelectAllCheckboxState()},_deselectRows:function(a){a.removeClass("jtable-row-selected");this.options.selectingCheckboxes&&a.find("td.jtable-selecting-column input").removeAttr("checked");this._refreshSelectAllCheckboxState()},_refreshSelectAllCheckboxState:function(){if(this.options.selectingCheckboxes&&this.options.multiselect){var a=this._$tableRows.length,b=this._getSelectedRows().length;0==b?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",
!1)):b==a?(this._$selectAllCheckbox.prop("indeterminate",!1),this._$selectAllCheckbox.attr("checked",!0)):(this._$selectAllCheckbox.attr("checked",!1),this._$selectAllCheckbox.prop("indeterminate",!0))}},_onSelectionChanged:function(){this._trigger("selectionChanged",null,{})}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype.load,a=d.hik.jtable.prototype._create,c=d.hik.jtable.prototype._createRecordLoadUrl,e=d.hik.jtable.prototype._addRowToTable,g=d.hik.jtable.prototype._removeRowsFromTable,h=d.hik.jtable.prototype._onRecordsLoaded;d.extend(!0,d.hik.jtable.prototype,{options:{paging:!1,pageSize:10,messages:{pagingInfo:"Showing {0} to {1} of {2} records"}},_$pagingListArea:null,_totalRecordCount:0,_currentPageNo:1,_create:function(){a.apply(this,arguments);this._createPageListArea()},
_createPageListArea:function(){if(this.options.paging)this._$pagingListArea=d('<span class="jtable-page-list"></span>').appendTo(this._$bottomPanel)},load:function(){this._currentPageNo=1;b.apply(this,arguments)},_createRecordLoadUrl:function(){var a=c.apply(this,arguments);return a=this._addPagingInfoToUrl(a,this._currentPageNo)},_addRowToTable:function(a,b,c){c&&this.options.paging?this._reloadTable():e.apply(this,arguments)},_removeRowsFromTable:function(a,b){g.apply(this,arguments);this.options.paging&&
(0>=this._$tableRows.length&&1<this._currentPageNo&&--this._currentPageNo,this._reloadTable())},_onRecordsLoaded:function(a){this._totalRecordCount=a.TotalRecordCount;this._createPagingList();h.apply(this,arguments)},_addPagingInfoToUrl:function(a,b){if(!this.options.paging)return a;var c=(b-1)*this.options.pageSize,d=this.options.pageSize;return a+(0>a.indexOf("?")?"?":"&")+"jtStartIndex="+c+"&jtPageSize="+d},_createPagingList:function(){if(this.options.paging&&!(0>=this.options.pageSize)){this._$pagingListArea.empty();
var a=this._calculatePageCount();this._createFirstAndPreviousPageButtons();this._createPageNumberButtons(this._calculatePageNumbers(a));this._createLastAndNextPageButtons(a);this._createPagingInfo();this._bindClickEventsToPageNumberButtons()}},_createFirstAndPreviousPageButtons:function(){1<this._currentPageNo&&(d('<span class="jtable-page-number-first">|&lt</span>').data("pageNumber",1).appendTo(this._$pagingListArea),d('<span class="jtable-page-number-previous">&lt</span>').data("pageNumber",this._currentPageNo-
1).appendTo(this._$pagingListArea))},_createLastAndNextPageButtons:function(a){this._currentPageNo<a&&(d('<span class="jtable-page-number-next">&gt</span>').data("pageNumber",this._currentPageNo+1).appendTo(this._$pagingListArea),d('<span class="jtable-page-number-last">&gt|</span>').data("pageNumber",a).appendTo(this._$pagingListArea))},_createPageNumberButtons:function(a){for(var b=0,c=0;c<a.length;c++)1<a[c]-b&&d('<span class="jtable-page-number-space">...</span>').appendTo(this._$pagingListArea),
this._createPageNumberButton(a[c]),b=a[c]},_createPageNumberButton:function(a){d('<span class="'+(this._currentPageNo==a?"jtable-page-number-active":"jtable-page-number")+'">'+a+"</span>").data("pageNumber",a).appendTo(this._$pagingListArea)},_calculatePageCount:function(){var a=Math.floor(this._totalRecordCount/this.options.pageSize);0!=this._totalRecordCount%this.options.pageSize&&++a;return a},_calculatePageNumbers:function(a){if(6>=a){for(var b=[],c=1;c<=a;++c)b.push(c);return b}b=[1,2,3,a-2,
a-1,a];c=this._normalizeNumber(this._currentPageNo-1,1,a,1);a=this._normalizeNumber(this._currentPageNo+1,1,a,1);this._insertToArrayIfDoesNotExists(b,c);this._insertToArrayIfDoesNotExists(b,this._currentPageNo);this._insertToArrayIfDoesNotExists(b,a);b.sort(function(a,b){return a-b});return b},_createPagingInfo:function(){var a=(this._currentPageNo-1)*this.options.pageSize+1,b=this._currentPageNo*this.options.pageSize,b=this._normalizeNumber(b,a,this._totalRecordCount,0);b>=a&&(a=this._formatString(this.options.messages.pagingInfo,
a,b,this._totalRecordCount),d('<span class="jtable-page-info">'+a+"</span>").appendTo(this._$pagingListArea))},_bindClickEventsToPageNumberButtons:function(){var a=this;a._$pagingListArea.find(".jtable-page-number,.jtable-page-number-previous,.jtable-page-number-next,.jtable-page-number-first,.jtable-page-number-last").click(function(b){b.preventDefault();b=d(this);a._currentPageNo=b.data("pageNumber");a._reloadTable()})}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._normalizeFieldOptions,a=d.hik.jtable.prototype._createHeaderCellForField,c=d.hik.jtable.prototype._createRecordLoadUrl;d.extend(!0,d.hik.jtable.prototype,{options:{sorting:!1,defaultSorting:""},_lastSorting:"",_normalizeFieldOptions:function(a,c){b.apply(this,arguments);c.sorting=!1!=c.sorting},_createHeaderCellForField:function(b,c){var d=a.apply(this,arguments);this.options.sorting&&c.sorting&&this._makeColumnSortable(d,b);return d},_createRecordLoadUrl:function(){var a=
c.apply(this,arguments);return a=this._addSortingInfoToUrl(a)},_makeColumnSortable:function(a,b){var c=this;a.addClass("jtable-column-header-sortable").click(function(b){b.preventDefault();c._sortTableByColumn(a)});if(-1<c.options.defaultSorting.indexOf(b))-1<c.options.defaultSorting.indexOf("DESC")?(a.addClass("jtable-column-header-sorted-desc"),c._lastSorting=b+" DESC"):(a.addClass("jtable-column-header-sorted-asc"),c._lastSorting=b+" ASC")},_sortTableByColumn:function(a){a.siblings().removeClass("jtable-column-header-sorted-asc jtable-column-header-sorted-desc");
a.hasClass("jtable-column-header-sorted-asc")?(a.removeClass("jtable-column-header-sorted-asc").addClass("jtable-column-header-sorted-desc"),this._lastSorting=a.data("fieldName")+" DESC"):(a.removeClass("jtable-column-header-sorted-desc").addClass("jtable-column-header-sorted-asc"),this._lastSorting=a.data("fieldName")+" ASC");this._reloadTable()},_addSortingInfoToUrl:function(a){return!this.options.sorting||""==this._lastSorting?a:a+(0>a.indexOf("?")?"?":"&")+"jtSorting="+this._lastSorting}})})(jQuery);
(function(d){var b=d.hik.jtable.prototype._removeRowsFromTable;d.extend(!0,d.hik.jtable.prototype,{options:{openChildAsAccordion:!1},openChildTable:function(a,b,e){var g=this;if(void 0==b.showCloseButton)b.showCloseButton=!0;if(b.showCloseButton&&!b.closeRequested)b.closeRequested=function(){g.closeChildTable(a)};g.options.openChildAsAccordion&&a.siblings().each(function(){g.closeChildTable(d(this))});g.closeChildTable(a,function(){var h=g.getChildRow(a).find("td").empty(),f=d('<div class="jtable-child-table-container"></div>').appendTo(h);
h.data("childTable",f);f.jtable(b);g.openChildRow(a);f.hide().slideDown("fast",function(){e&&e({childTable:f})})})},closeChildTable:function(a,b){var d=this,g=this.getChildRow(a).find("td"),h=g.data("childTable");h?(g.data("childTable",null),h.slideUp("fast",function(){h.jtable("destroy");h.remove();d.closeChildRow(a);b&&b()})):b&&b()},isChildRowOpen:function(a){return this.getChildRow(a).is(":visible")},getChildRow:function(a){return a.data("childRow")||this._createChildRow(a)},openChildRow:function(a){a=
this.getChildRow(a);a.is(":visible")||a.show();return a},closeChildRow:function(a){a=this.getChildRow(a);a.is(":visible")&&a.hide()},_removeRowsFromTable:function(a,c){var e=this;"deleted"==c&&a.each(function(){var a=d(this),b=a.data("childRow");b&&(e.closeChildTable(a),b.remove())});b.apply(this,arguments)},_createChildRow:function(a){var b=this._findRowIndex(a),e=this._$table.find("thead th").length,e=d('<tr class="jtable-child-row"></tr>').append('<td colspan="'+e+'"></td>');this._addRowToTable(e,
b+1);a.data("childRow",e);e.hide();return e}})})(jQuery);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Halil ibrahim Kalkan
Founder Volosoft
Turkey Turkey
I have started programming at 14 years old using Pascal as hobby. Then I interested in web development (HTML, JavaScript, ASP...) before university.

I graduated from Sakarya University Computer Engineering. At university, I learned C++, Visual Basic.NET, C#, ASP.NET and Java. I partly implemented ARP, IP and TCP protocols in Java as my final term project.

Now, I am working on Windows and web based software development mostly using Microsoft technologies in my own company.

My open source projects:

* ASP.NET Boilerplate: http://aspnetboilerplate.com
* jTable: http://jtable.org
* Others: https://github.com/hikalkan

My personal web site:

http://www.halilibrahimkalkan.com

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 17 Jan 2012
Article Copyright 2012 by Halil ibrahim Kalkan
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid