summaryrefslogtreecommitdiffstats
path: root/lib/extensions
diff options
context:
space:
mode:
authorHalil İbrahim Kalkan <hikalkan@gmail.com>2013-01-04 19:48:10 +0200
committerHalil İbrahim Kalkan <hikalkan@gmail.com>2013-01-04 21:19:26 +0200
commita08e406f31de23ff7fd8cb766fdd9f7f62fbd82d (patch)
tree2e3bb70aa42d7f04e03782a697de2a4e60e279ae /lib/extensions
parentf9415fbce9632f034219e84dcd362ae550e88726 (diff)
downloadjtable-a08e406f31de23ff7fd8cb766fdd9f7f62fbd82d.zip
jtable-a08e406f31de23ff7fd8cb766fdd9f7f62fbd82d.tar.gz
jtable-a08e406f31de23ff7fd8cb766fdd9f7f62fbd82d.tar.bz2
src folder moved to lib
There will be two folder, one of them for jTable library files those are needed to use jTable. This folder is "lib". Other one is for development, it's name is "dev".
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/jquery.jtable.aspnetpagemethods.js125
-rw-r--r--lib/extensions/jquery.jtable.aspnetpagemethods.min.js27
2 files changed, 152 insertions, 0 deletions
diff --git a/lib/extensions/jquery.jtable.aspnetpagemethods.js b/lib/extensions/jquery.jtable.aspnetpagemethods.js
new file mode 100644
index 0000000..307381d
--- /dev/null
+++ b/lib/extensions/jquery.jtable.aspnetpagemethods.js
@@ -0,0 +1,125 @@
+/*
+
+ASP.NET WEB FORMS PAGE METHODS EXTENSION FOR JTABLE
+http://www.jtable.org
+
+---------------------------------------------------------------------------
+
+Copyright (C) 2011 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 ($) {
+
+ //extension members
+ $.extend(true, $.hik.jtable.prototype, {
+
+ /* OVERRIDES BASE METHOD */
+ _performAjaxCall: function (url, postData, async, success, error) {
+ var self = this;
+
+ if (postData == null || postData == undefined) {
+ postData = {};
+ } else if (typeof postData == 'string') {
+ postData = self._convertQueryStringToObject(postData);
+ }
+
+ var qmIndex = url.indexOf('?');
+ if (qmIndex > -1) {
+ $.extend(postData, self._convertQueryStringToObject(url.substring(qmIndex + 1)));
+ }
+
+ postData = JSON.stringify(postData);
+
+ $.ajax({
+ url: url,
+ type: 'POST',
+ dataType: 'json',
+ contentType: "application/json; charset=utf-8",
+ data: postData,
+ async: async,
+ success: function (data) {
+ data = self._normalizeJSONReturnData(data);
+ success(data);
+ },
+ error: function () {
+ error();
+ }
+ });
+ },
+
+ /* OVERRIDES BASE METHOD */
+ _submitFormUsingAjax: function (url, formData, success, error) {
+ var self = this;
+
+ formData = {
+ record: self._convertQueryStringToObject(formData)
+ };
+
+ var qmIndex = url.indexOf('?');
+ if (qmIndex > -1) {
+ $.extend(formData, self._convertQueryStringToObject(url.substring(qmIndex + 1)));
+ }
+
+ var postData = JSON.stringify(formData);
+
+ $.ajax({
+ url: url,
+ type: 'POST',
+ dataType: 'json',
+ contentType: "application/json; charset=utf-8",
+ data: postData,
+ success: function (data) {
+ data = self._normalizeJSONReturnData(data);
+ success(data);
+ },
+ error: function () {
+ error();
+ }
+ });
+ },
+
+ _convertQueryStringToObject: function (queryString) {
+ var jsonObj = {};
+ var e,
+ a = /\+/g,
+ r = /([^&=]+)=?([^&]*)/g,
+ d = function (s) { return decodeURIComponent(s.replace(a, " ")); };
+
+ while (e = r.exec(queryString)) {
+ jsonObj[d(e[1])] = d(e[2]);
+ }
+
+ return jsonObj;
+ },
+
+ /* Normalizes JSON data that is returned from server.
+ *************************************************************************/
+ _normalizeJSONReturnData: function (data) {
+ //JSON Normalization for ASP.NET
+ if (data.hasOwnProperty('d')) {
+ return data.d;
+ }
+
+ return data;
+ }
+ });
+
+})(jQuery); \ No newline at end of file
diff --git a/lib/extensions/jquery.jtable.aspnetpagemethods.min.js b/lib/extensions/jquery.jtable.aspnetpagemethods.min.js
new file mode 100644
index 0000000..974253e
--- /dev/null
+++ b/lib/extensions/jquery.jtable.aspnetpagemethods.min.js
@@ -0,0 +1,27 @@
+/*
+ASP.NET WEB FORMS PAGE METHODS EXTENSION FOR JTABLE
+http://www.jtable.org
+---------------------------------------------------------------------------
+Copyright (C) 2011 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(c){c.extend(!0,c.hik.jtable.prototype,{_performAjaxCall:function(b,a,d,g,e){var f=this;null==a||void 0==a?a={}:"string"==typeof a&&(a=f._convertQueryStringToObject(a));var h=b.indexOf("?");-1<h&&c.extend(a,f._convertQueryStringToObject(b.substring(h+1)));a=JSON.stringify(a);c.ajax({url:b,type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:a,async:d,success:function(a){a=f._normalizeJSONReturnData(a);g(a)},error:function(){e()}})},_submitFormUsingAjax:function(b,
+a,d,g){var e=this,a={record:e._convertQueryStringToObject(a)},f=b.indexOf("?");-1<f&&c.extend(a,e._convertQueryStringToObject(b.substring(f+1)));a=JSON.stringify(a);c.ajax({url:b,type:"POST",dataType:"json",contentType:"application/json; charset=utf-8",data:a,success:function(a){a=e._normalizeJSONReturnData(a);d(a)},error:function(){g()}})},_convertQueryStringToObject:function(b){for(var a={},d,c=/\+/g,e=/([^&=]+)=?([^&]*)/g;d=e.exec(b);)a[decodeURIComponent(d[1].replace(c," "))]=decodeURIComponent(d[2].replace(c,
+" "));return a},_normalizeJSONReturnData:function(b){return b.hasOwnProperty("d")?b.d:b}})})(jQuery); \ No newline at end of file