{"comment":{"url":"https://api.github.com/repos/SingChandan/Chandansingh/comments/17817311","html_url":"https://github.com/SingChandan/Chandansingh/commit/2ac4fc6b12679f1267dad774f332fb1a64076ce9#commitcomment-17817311","id":17817311,"user":{"login":"SingChandan","id":8522645,"avatar_url":"https://avatars.githubusercontent.com/u/8522645?v=3","gravatar_id":"","url":"https://api.github.com/users/SingChandan","html_url":"https://github.com/SingChandan","followers_url":"https://api.github.com/users/SingChandan/followers","following_url":"https://api.github.com/users/SingChandan/following{/other_user}","gists_url":"https://api.github.com/users/SingChandan/gists{/gist_id}","starred_url":"https://api.github.com/users/SingChandan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SingChandan/subscriptions","organizations_url":"https://api.github.com/users/SingChandan/orgs","repos_url":"https://api.github.com/users/SingChandan/repos","events_url":"https://api.github.com/users/SingChandan/events{/privacy}","received_events_url":"https://api.github.com/users/SingChandan/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":null,"commit_id":"2ac4fc6b12679f1267dad774f332fb1a64076ce9","created_at":"2016-06-10T06:31:12Z","updated_at":"2016-06-10T06:31:12Z","body":"﻿//Jquery Plugin Developed by Chandan singh Sisodia\r\n\r\n\r\n\r\nvar dataorder;\r\nvar pre = false;\r\nvar nex = true;\r\n(function ($) {\r\n$.fn.jsongrid = function (options) {\r\n\r\n    // Extend our default options with those provided.\r\n    // Note that the first argument to extend is an empty\r\n    // object – this is to keep from overriding our \"defaults\" object.\r\n    var ele = $(this);\r\n    var rowid = $(this).attr(\"id\");\r\n    opts = $.extend({}, $.fn.jsongrid.defaults, options);\r\n\r\n    // Our plugin implementation code goes here.\r\n\r\n    \r\n\r\n   var Golbaldata = {}\r\n    Golbaldata.grid = ele;\r\n    Golbaldata.Head = opts.Rowheader;\r\n    Golbaldata.doc = opts.document;\r\n    Golbaldata.dcel = opts.cellelement;\r\n    Golbaldata.psize = opts.pagesize;\r\n    Golbaldata.Conti = opts.Control;\r\n    Golbaldata.icon = opts.Gicon;\r\n    Golbaldata.extraheader = opts.Rowheadmain;\r\n    Golbaldata.hide = opts.Dnone;\r\n    Golbaldata.filter = opts.Filter;\r\n    Golbaldata.Cwidth = opts.cellwidth;\r\n    Golbaldata.CheckAll = opts.Sall;\r\n    Golbaldata.dis = opts.disable;\r\n    Golbaldata.AdF = opts.AdvanceF;\r\n    Golbaldata.Chover = opts.cellhover;\r\n    Golbaldata.hicon = opts.Headicon;\r\n    Golbaldata.special = opts.specialuse;\r\n    Golbaldata.calall = opts.Calender;\r\n    Golbaldata.cellSum = opts.SumCell;\r\n    Golbaldata.Calcudata =opts.Calculation;\r\n    Golbaldata.DattimVar =opts.DatePick;\r\n\r\n\r\n   \r\n\r\n    var HeaderData = Golbaldata.Head;\r\n    var Grid = Golbaldata.grid;\r\n\r\n    var _calValue=Golbaldata.Calcudata;\r\n\r\n   // for(var _p=0;_p<_calValue.length;_p++){\r\n    if(_calValue.length!=\"\"){\r\n    var _ReturnData = window[_calValue](Golbaldata.doc);\r\n    Golbaldata.doc=_ReturnData;\r\n    }\r\n    //}\r\n\r\n    \r\n   \r\n    var document = Golbaldata.doc;\r\n    \r\n    var pagesize = Golbaldata.psize;\r\n    \r\n  \r\n    var Rowheadmain = Golbaldata.extraheader;\r\n    var Hide = Golbaldata.hide;\r\n    var search = Golbaldata.filter;\r\n    var colwidth = Golbaldata.Cwidth;\r\n    var Chekall = Golbaldata.CheckAll;\r\n   \r\n    var AdvFilter = Golbaldata.AdF;\r\n\r\n    var Hcon = Golbaldata.Headicon;\r\n\r\n    var Hcalender = Golbaldata.calall;\r\n\r\n    var rowid = Grid.attr(\"id\");\r\n    \r\n    var duplicateobj=JSON.parse(JSON.stringify(Golbaldata));\r\n\r\n    Grid.append(\"<thead><tr id='\" + rowid + \"d'></tr></thead>\");\r\n\r\n    for (var j = 0; j < Rowheadmain.length; j++) {\r\n        if ((Rowheadmain[j][1]) != \"\") {\r\n            $(\"#\" + rowid + \"d\").append(\"<th rowspan='\" + Rowheadmain[j][1] + \"'>\" + Rowheadmain[j][0] + \"</th>\");\r\n        }\r\n        if ((Rowheadmain[j][2]) != \"\") {\r\n            $(\"#\" + rowid + \"d\").append(\"<th colspan='\" + Rowheadmain[j][2] + \"'>\" + Rowheadmain[j][0] + \"</th>\");\r\n        }\r\n\r\n    }\r\n\r\n    Grid.append(\"<thead><tr id='\" + rowid + \"i'></tr></thead>\");\r\n    for (var j = 0; j < HeaderData.length; j++) {\r\n        $(\"#\" + rowid + \"i\").append(\"<th style='text-align:left'><span>\" + HeaderData[j] + \"</span></th>\");\r\n    }\r\n\r\n\r\n    \r\n    for (var w = 0; w < colwidth.length; w++) {\r\n\r\n        $(\"#\" + rowid + \"i\").children().eq(colwidth[w][0]).css(\"width\", colwidth[w][1]);\r\n    }\r\n\r\n    //    for (var p = 0; p < Hcon.length; p++) {\r\n\r\n    //        $(\"#\" + rowid + \"i\").children().eq(Hcon[p][0]).css(\"width\", colwidth[w][1]);\r\n    //    }\r\n\r\n    for (var c = 0; c < Chekall.length; c++) {\r\n        $(\"#\" + rowid + \"i\").children().eq(Chekall[c]).css(\"text-align\", \"center\")\r\n        $(\"#\" + rowid + \"i\").children().eq(Chekall[c]).prepend(\"<input type='checkbox' onclick='checkall($(this))'/>\")\r\n    }\r\n\r\n    for (var s = 0; s < search.length; s++) {\r\n    \r\n        $(\"#\" + rowid + \"i\").children().eq(search[s][0]).append(\"<a href='#'  onclick='Searchwindow($(this))' class='awesome' style='float:right'>&#xF0B0;</a><div id='divS\" + rowid + \"\" + search[s][0] + \"' class='Filtertab' style='margin-top:20px'><table><tr><td style='text-align:center'><input type='text' id='txt\" + search[s][0] + \"' sdata=\" + search[s][1] + \" style='width:70px'/><br><br><a href='#' sdata=\" + search[s][1] + \" class='lbotton' id='btns\" + search[s][0] + \"'>search</a><a href='#' class='lbotton' style='margin-left:10px' id='remove\" + search[s][0] + \"'>Remove</a></td></tr></table></div>\");\r\n        $(\"#\" + rowid + \"i\").children().eq(search[s][0]).children().eq(0).attr(\"sdata\", search[s][1]);\r\n          \r\n         $(\"#\" + rowid + \"i\").children().eq(search[s][0]).css(\"cursor\",\"pointer\");\r\n        ($(\"#\" + rowid + \"i\").children().eq(search[s][0]).children().eq(0)).click(function () { AscSorting(Golbaldata, ($(this).attr(\"sdata\"))) });\r\n\r\n\r\n\r\n        //        if (sear != \"\") {\r\n        //            $(\"#txt\" + search[s][0]).val(sear);\r\n        //            $(\"#txt\" + search[s][0]).next().after(\"\");\r\n        //           }\r\n        ($(\"#txt\" + search[s][0])).keydown(function (t) { var code = t.keyCode || t.which;\r\n           \r\n           if(code==13){\r\n           \r\n        Searchdata(Golbaldata, ($(this).attr(\"sdata\")), $(this).val()); paging(Golbaldata); $(this).parent().parent().parent().parent().parent().toggle();\r\n        return false;\r\n        } });\r\n        ($(\"#btns\" + search[s][0])).click(function () { Searchdata(Golbaldata, ($(this).attr(\"sdata\")), $(this).prev().prev().prev().val()); paging(Golbaldata); $(this).parent().parent().parent().parent().parent().toggle(); });\r\n        ($(\"#remove\" + search[s][0])).click(function () { pagegrid(duplicateobj, 1, \"\");});\r\n\r\n    }\r\n\r\n    \r\n    for (var y = 0; y < AdvFilter.length; y++) {\r\n    \r\n        $(\"#\" + rowid + \"i\").children().eq(AdvFilter[y][0]).append(\"<a href='#' onclick='AdvFilterWindow($(this))' class='awesome' style='margin-left:4px;margin-right:0px;float:right'>&#xF0B0;</a><div id='divAvF\" + rowid + \"\" + AdvFilter[y][0] + \"' class='Filtertab' style='margin-top:20'><ul style='list-style:none;'  AfData='\"+AdvFilter[y][1]+\"' class='AffilterUL' id='ListAvF\" + rowid + \"\" + AdvFilter[y][0] + \"'></ul></div>\");\r\n\r\n        \r\n         $(\"#\" + rowid + \"i\").children().eq(AdvFilter[y][0]).css(\"cursor\",\"pointer\");\r\n        var r = docuni(document, AdvFilter[y][1]);\r\n       // $(\"#ListAvF\" + rowid + \"\" + AdvFilter[y][0]).append(\"<li><input type='checkbox'/><span>Select All<span></li>\");\r\n        for (var c = 0; c < r.length; c++) {\r\n            $(\"#ListAvF\" + rowid + \"\" + AdvFilter[y][0]).append(\"<li><input type='checkbox' class='Filtercheck'/><span>\" + r[c] + \"</span></li>\");\r\n        }\r\n\r\n        $(\"#ListAvF\" + rowid + \"\" + AdvFilter[y][0]).append(\"<li style='margin-top:5px'><a href='#' sdata=\" + AdvFilter[y][1] + \" class='lbotton' id='btns_AF_\" + AdvFilter[y][0]+\"_\"+Grid.attr(\"id\")+\"'>search</a><a href='#' class='lbotton' style='margin-left:10px' id='btnRemove_AF_\" + AdvFilter[y][0]+\"_\"+Grid.attr(\"id\")+\"'>Remove</a></li>\");\r\n\r\n        ($(\"#btns_AF_\" + AdvFilter[y][0]+\"_\"+Grid.attr(\"id\"))).click(function () {\r\n            \r\n            \r\n            \r\n            var PerTable=$(this).parent().closest('#'+Grid.attr(\"id\"));\r\n            \r\n            var sendData= jQuery.extend(true, {}, Golbaldata);\r\n\r\n            var FiterData=AfgetData(sendData,PerTable);\r\n//            var ul = $(this).parent().parent().children();\r\n//            var check = new Array();\r\n//            for (var ch = 0; ch < ul.length - 1; ch++) {\r\n//                if ((ul.eq(ch).children().first()).is(':checked')) {\r\n//                    check.push((ul.eq(ch).children().last()).text());\r\n//                }\r\n//                else {\r\n//                    continue;\r\n//                }\r\n//            }\r\n//            \r\n//          \r\n//            AdvFilterdata(Golbaldata, ($(this).attr(\"sdata\")), check);\r\n            \r\n              pagegrid(FiterData, 1, \"\");\r\n            paging(FiterData);\r\n            $(this).parent().parent().parent().toggle();\r\n        });\r\n        ($(\"#btnRemove_AF_\" + AdvFilter[y][0]+\"_\"+Grid.attr(\"id\"))).click(function () {\r\n\r\n        var checall=$(this).parent().parent().find(\".Filtercheck\");\r\n        \r\n        \r\n        checall.each(function(){\r\n        $(this).prop(\"checked\",false);\r\n        });\r\n        \r\n        var PerTable=$(this).parent().closest('#'+Grid.attr(\"id\"));\r\n            \r\n            var sendData= jQuery.extend(true, {}, Golbaldata);\r\n\r\n            var FiterData=AfgetData(sendData,PerTable);\r\n              pagegrid(FiterData, 1, \"\");\r\n            paging(FiterData);\r\n            $(this).parent().parent().parent().toggle();\r\n       });\r\n    }\r\n\r\n    for (var p = 0; p < Hcalender.length; p++) {\r\n        \r\n        $(\"#\" + rowid + \"i\").children().eq(Hcalender[p]).append(\"<a href='#'  onclick='Calmethod($(this))' class='awesome' style='float:right;font-size:12px'>&#xF073;</a><div id='divCalend\" + rowid + \"\" + Hcalender[p] + \"' class='Filtertab'><table class='tabcoll'><tr><td style='text-align:center'><input type='text' onchange=datechange($(this)) id='txtcal\" + Hcalender[p] + \"' style='width:70px'/></td></tr></table></div>\");\r\n        $(\"#txtcal\" + Hcalender[p]).datepicker({ dateFormat: 'dd/M/yy' });\r\n    }\r\n\r\n    \r\n    for (var r = 0; r < Hide.length; r++) {\r\n\r\n        $(\"#\" + rowid + \"i\").children().eq(Hide[r]).css(\"display\", \"none\");\r\n    }\r\n    \r\n    Grid.append(\"<tfoot><tr><td colspan='\" + (HeaderData.length + 2) + \"'><table class='pgrtable'><tr id='\" + rowid + \"pgr'></tr>\"+\r\n    \"<tr><td style='color:red'>\"+Golbaldata.length+\"<td></tr>\"+\r\n    \"</table></td></tr></tfoot>\");\r\n    \r\n    paging(Golbaldata);\r\n\r\n\r\n    if (opts.pagesize > 0) {\r\n        page = opts.pagesize;\r\n        pagegrid(Golbaldata, 1, \"\");\r\n    }\r\n    else {\r\n\r\n        ele.append(\"<tr id='\" + rowid + \"i'></tr>\");\r\n        for (var j = 0; j < opts.Rowheader.length; j++) {\r\n            $(\"#\" + rowid + \"i\").append(\"<th>\" + opts.Rowheader[j] + \"</th>\");\r\n        }\r\n\r\n        for (var j = 0; j < opts.document.length; j++) {\r\n\r\n            ele.append(\"<tr id='\" + rowid + \"\" + j + \"'></tr>\");\r\n\r\n            i = 0;\r\n            //for (key in opts.document[j]) {\r\n            for (var i = 0; i < opts.cellelement.length; i++) {\r\n                // if (opts.document[j].hasOwnProperty(key)) {\r\n                var value = opts.document[j][opts.cellelement[i]];\r\n                //do something with value;\r\n                $(\"#\" + rowid + \"\" + j).append(\"<td>\" + value + \"</td>\");\r\n            }\r\n\r\n            //            for(var c = 0; c < opts.Control.length; c++){\r\n            //            \r\n            //            }\r\n        }\r\n\r\n\r\n\r\n\r\n\r\n\r\n    }\r\n\r\n};})(jQuery);\r\n\r\n// Plugin defaults – added as a property on our plugin function.\r\n$.fn.jsongrid.defaults = {\r\n    Control: \"\",\r\n    Rowheader: \"\",\r\n    cellelement: \"\",\r\n    document: \"\",\r\n    pagesize: 0,\r\n    Gicon:\"\",\r\n    Rowheadmain:\"\",\r\n    Dnone:\"\",\r\n    Filter:\"\",\r\n    cellwidth:\"\",\r\n    Sall:\"\",\r\n    disable:\"\",\r\n    AdvanceF: \"\",\r\n    cellhover: \"\",\r\n    Headicon:\"\",\r\n    specialuse:\"\",\r\n    Calender:\"\",\r\n    SumCell:\"\",\r\n    Calculation:\"\",\r\n    DatePick:false\r\n};\r\n\r\nfunction paging(gridjsondata) {\r\n    \r\n    var rowid = (gridjsondata.grid).attr(\"id\");\r\n    var document = gridjsondata.doc;\r\n    var pagesize = gridjsondata.psize;\r\n    var noPage = Math.ceil(document.length / pagesize);\r\n    var pagi = Math.ceil(document.length / pagesize);\r\n\r\n    if (noPage > 5) {\r\n        noPage = 5;\r\n    }\r\n    $(\"#\" + rowid + \"pgr\").html(\"\");\r\n    for (var p = 1; p <= noPage; p++) {\r\n        $(\"#\" + rowid + \"pgr\").append(\"<td><input class='pageclass' type='button' id='\" + rowid + \"pgr\" + p + \"' value='\" + p + \"'/></td>\");\r\n\r\n\r\n        $(\"#\" + rowid + \"pgr\" + 1).addClass(\"pageselect\");\r\n\r\n        $(\"#\" + rowid + \"pgr\" + p).click(function () {\r\n\r\n            $(\".pageclass\").removeClass(\"pageselect\");\r\n            $(this).addClass(\"pageselect\");\r\n\r\n            pagegrid(gridjsondata, this.value, \"\")\r\n        });\r\n    }\r\n\r\n\r\n    if (pagi > 5) {\r\n\r\n        $(\"#\" + rowid + \"pgr\").append(\"<td><input type='button' id='\" + rowid + \"next' value='>'/></td>\");\r\n\r\n\r\n        $(\"#\" + rowid + \"pgr\").prepend(\"<td style='display:none'><input type='button' id='\" + rowid + \"prev' value='<'/></td>\");\r\n\r\n\r\n\r\n        $(\"#\" + rowid + \"next\").click(function () {\r\n\r\n            if ($(this).parent().parent().children().eq(1).children().val() == \"1\") {\r\n\r\n                ($(\"#\" + rowid + \"prev\").parent()).css(\"display\", \"block\");\r\n\r\n            }\r\n\r\n\r\n            for (var q = 1; q <= noPage; q++) {\r\n\r\n                $(this).parent().parent().children().eq(q).children().val(Number($(this).parent().parent().children().eq(q).children().val()) + 1);\r\n                \r\n                pagegrid(gridjsondata, Number($(\".pageselect\").val()), \"\");\r\n                if ($(this).parent().parent().children().eq(q).children().val() >= pagi) {\r\n                    ($(this).parent()).css(\"display\", \"none\");\r\n                }\r\n            }\r\n\r\n\r\n\r\n        });\r\n\r\n        $(\"#\" + rowid + \"prev\").click(function () {\r\n\r\n\r\n            for (var q = 1; q <= noPage; q++) {\r\n\r\n                $(this).parent().parent().children().eq(q).children().val(Number($(this).parent().parent().children().eq(q).children().val()) - 1);\r\n                pagegrid(gridjsondata, Number($(\".pageselect\").val()), \"\");\r\n                if ($(this).parent().parent().children().eq(q).children().val() == 1) {\r\n                    ($(this).parent()).css(\"display\", \"none\");\r\n                }\r\n            }\r\n\r\n            if ($(this).parent().parent().children().last().prev().children().val() != pagi) {\r\n                ($(\"#\" + rowid + \"next\").parent()).css(\"display\", \"block\");\r\n\r\n            }\r\n\r\n        });\r\n    }\r\n}\r\n\r\nfunction pagegrid(obj, currentpage, sear) {\r\n\r\n\r\n    var Grid = obj.grid;\r\n    var HeaderData = obj.Head;\r\n    var document = obj.doc;\r\n    var datacell = obj.dcel;\r\n    var pagesize = obj.psize;\r\n    var GControl = obj.Conti;\r\n    var Gimcon = obj.icon;\r\n    var Rowheadmain = obj.extraheader;\r\n    var Hide = obj.hide;\r\n    var search = obj.filter;\r\n    var colwidth = obj.Cwidth;\r\n    var Chekall = obj.CheckAll;\r\n    var disab = obj.dis;\r\n    var AdvFilter = obj.AdF;\r\n    var Colhover = obj.Chover;\r\n    var Hcon = obj.Headicon;\r\n    var spe = obj.special;\r\n    var Hcalender = obj.calall;\r\n    var cellTotal = obj.cellSum;\r\n    var intial = (currentpage - 1) * pagesize;\r\n    var CalCol=obj.Calcudata;\r\n    var DateTimepic=obj.DattimVar;\r\n\r\n\r\n\r\n\r\n    var end = intial + pagesize;\r\n\r\n\r\n    var rowid = Grid.attr(\"id\");\r\n    var first = Grid.find(\"#\" + rowid + \"body\");\r\n    first.remove();\r\n    \r\n    Grid.append(\"<tbody id='\" + rowid + \"body'></tbody>\");\r\n    var body = Grid.find(\"#\" + rowid + \"body\");\r\n    body.html(\"\");\r\n\r\n    for (var j = intial; j < end; j++) {\r\n\r\n        if (j == document.length) { break; }\r\n        body.append(\"<tr id='\" + rowid + \"\" + j + \"'></tr>\");\r\n\r\n\r\n\r\n        i = 0;\r\n        //for (key in opts.document[j]) {\r\n        for (var i = 0; i < datacell.length; i++) {\r\n            var ty = typeof document[j][datacell[i]];\r\n\r\n            // if (opts.document[j].hasOwnProperty(key)) {\r\n            var value = document[j][datacell[i]];\r\n            //do something with value;\r\n\r\n            \r\n\r\n//            for (var _i = 0; _i < CalCol.length; _i++) {\r\n//                if (i == CalCol[_i][0]) {\r\n//                    value = window[CalCol[_i][1]](j, CalCol[_i][0], currentpage, pagesize);\r\n//                }\r\n//            }\r\n\r\n                $(\"#\" + rowid + \"\" + j).append(\"<td>\" + value + \"</td>\");\r\n        }\r\n\r\n\r\n        for (var c = 0; c < GControl.length; c++) {\r\n            if (GControl[c][1] == \"checkbox\") {\r\n                if (GControl[c][0] == \"0\") { $(\"#\" + rowid + \"\" + j).prepend(\"<td style='text-align:center'><input type='checkbox'/></td>\"); }\r\n                else { $(\"#\" + rowid + \"\" + j).children().eq(Number(GControl[c][0]) - 1).after(\"<td><input onclick='\" + GControl[c][2] + \"($(this))' class='checkclass\" + GControl[c][0] + \"' type='checkbox'/></td>\"); }\r\n            }\r\n\r\n            else if (GControl[c][1] == \"select\") {\r\n            \r\n                if ((typeof (GControl[c][5])) != \"undefined\") {\r\n                    $(\"#\" + rowid + \"\" + j).children().eq(Number(GControl[c][0]) - 1).after(\"<td><select onchange=\" + GControl[c][5] + \"($(this),\" + j + \") style='font-size:11px;width:\" + GControl[c][4] + \"' id='Drowid\" + j + \"\" + GControl[c][0] + \"'></select></td>\");\r\n                }\r\n\r\n                else {\r\n                    $(\"#\" + rowid + \"\" + j).children().eq(Number(GControl[c][0]) - 1).after(\"<td><select style='font-size:11px;width:\" + GControl[c][4] + \"' id='Drowid\" + j + \"\" + GControl[c][0] + \"'></select></td>\");\r\n                }\r\n                \r\n                if ((typeof (GControl[c][2])) != \"undefined\") {\r\n                    if ((typeof (GControl[c][3])) != \"undefined\") {\r\n                        if (GControl[c][3] != \"\") {\r\n                            \r\n                            var q = $(\"#\" + rowid + \"\" + j).children().eq(GControl[c][3]).html();\r\n                            var m = dropfilter(GControl[c][2], GControl[c][3], q);\r\n                        }\r\n                        else { var m = GControl[c][2]; }\r\n                    }\r\n                    else { var m = GControl[c][2]; }\r\n                    if (($(\"#\" + rowid + \"\" + j).children().last().html()) != \"True\" || GControl[c][3] == \"\") {\r\n                        $(\"#Drowid\" + j + \"\" + GControl[c][0]).append(\"<option value='-1'>--Select---</option>\");\r\n                    }\r\n                    for (var i = 0; i < m.length; i++)\r\n                    { $(\"#Drowid\" + j + \"\" + GControl[c][0]).append(\"<option value='\" + m[i].value + \"'>\" + m[i].text + \"</option>\"); }\r\n                }\r\n                if ((typeof (GControl[c][6])) != \"undefined\" && GControl[c][6]!=\"\") {\r\n                   \r\n                    $(\"#Drowid\" + j + \"\" + GControl[c][0]).val(($(\"#\" + rowid + \"\" + j).children().eq(GControl[c][6])).html());\r\n                }\r\n                \r\n                if ((typeof (GControl[c][7])) != \"undefined\") {\r\n                    \r\n                    $(\"#Drowid\" + j + \"\" + GControl[c][0]).children().first().remove();\r\n                    if (($(\"#\" + rowid + \"\" + j).children().last().html()) == \"True\") {\r\n                        $(\"#Drowid\" + j + \"\" + GControl[c][0]).val(\"Yes\");\r\n                    }\r\n                    else { $(\"#Drowid\" + j + \"\" + GControl[c][0]).val(\"No\"); }\r\n                }\r\n            }\r\n            else if (GControl[c][1] == \"textbox\") {\r\n\r\n                $(\"#\" + rowid + \"\" + j).children().eq(Number(GControl[c][0]) - 1).after(\"<td><input id='txt\" + j + \"\" + GControl[c][0] + \"' type='text' style='width:\" + GControl[c][2] + \"px'/></td>\");\r\n\r\n                if (GControl[c][3] == \"datepicker\") {\r\n\r\n                    var p = $(\"#txt\" + j + \"\" + GControl[c][0]);\r\n                    p.keydown(function (e) { e.preventDefault() });\r\n                    $(\"#txt\" + j + \"\" + GControl[c][0]).addClass(\"calfill\");\r\n                    $(\"#txt\" + j + \"\" + GControl[c][0]).datepicker({ dateFormat: 'dd/M/yy' });\r\n                }\r\n\r\n                if (GControl[c][4] == \"Validate(Number)\") {\r\n                    $(\"#txt\" + j + \"\" + GControl[c][0]).change(function () { specialchange($(this)) });\r\n                    $(\"#txt\" + j + \"\" + GControl[c][0]).Validate(\"Number\");\r\n                }\r\n                if (typeof (GControl[c][5] != \"undefined\")) {\r\n                    $(\"#txt\" + j + \"\" + GControl[c][0]).val($(\"#\" + rowid + \"\" + j).children().eq(GControl[c][5]).text());\r\n                }\r\n            }\r\n\r\n           \r\n\r\n        }\r\n\r\n         \r\n            for (var r = 0; r < Hide.length; r++) {\r\n\r\n                $(\"#\" + rowid + \"\" + j).children().eq(Hide[r]).css(\"display\", \"none\");\r\n            }\r\n\r\n            //        for (var e = 0; e < Colhover.length; e++) {\r\n\r\n            //            ($(\"#\" + rowid + \"\" + j).children().eq(Colhover[e][0])).mouseover(function () {\r\n            //                \r\n            //                $(this).after(\"<div style='position:absolute' class='divselect'>hello</div>\")\r\n\r\n            //            });\r\n            //            ($(\"#\" + rowid + \"\" + j).children().eq(Colhover[e][0])).mouseout(function () {\r\n            //                \r\n            //                $(this).after().remove();\r\n            //            });\r\n            //        }\r\n\r\n\r\n            for (var d = 0; d < disab.length; d++) {\r\n                ($(\"#\" + rowid + \"\" + j).children().eq(disab[d]).children().eq(0)).prop(\"disabled\", true);\r\n            }\r\n\r\n        for (var c = 0; c < Gimcon.length; c++) {\r\n\r\n            if ((typeof (Gimcon[c][4])) != \"undefined\" && Gimcon[c][4] != \"\" && (typeof (Gimcon[c][3])) != \"undefined\" && Gimcon[c][3] != \"\") {\r\n                $(\"#\" + rowid + \"\" + j).children().eq(Number(Gimcon[c][0])).append(\"<a href='#' class='\" + Gimcon[c][4] + \"' onclick='\" + Gimcon[c][2] + \"($(this),\" + j + \")' style='float:right'><img src='\" + Gimcon[c][1] + \"' width='\" + Gimcon[c][3] + \"'/></a>\");\r\n            }\r\n\r\n            else if ((typeof (Gimcon[c][3])) != \"undefined\" && Gimcon[c][3] != \"\") {\r\n                $(\"#\" + rowid + \"\" + j).children().eq(Number(Gimcon[c][0])).append(\"<a href='#' onclick='\" + Gimcon[c][2] + \"($(this),\" + j + \")' style='float:right'><img src='\" + Gimcon[c][1] + \"' width='\" + Gimcon[c][3] + \"'/></a>\");\r\n            }\r\n           \r\n            else {\r\n                $(\"#\" + rowid + \"\" + j).children().eq(Number(Gimcon[c][0])).append(\"<a href='#' onclick='\" + Gimcon[c][2] + \"($(this),\" + j + \")' style='float:right'><img src='\" + Gimcon[c][1] + \"' width='15px'/></a>\");\r\n            }\r\n        }\r\n        if (spe == \"Yes\") {\r\n            \r\n            //datash(($(\"#\" + rowid + \"\" + j).children().eq(11).children().last()), j);\r\n            //Rating(($(\"#\" + rowid + \"\" + j).children().eq(13).children().last()), j);\r\n        }\r\n\r\n    }\r\n\r\n    \r\nif(cellTotal!=\"\"){\r\nbody.append(\"<tr id='\"+rowid+\"sumrow'>\");\r\nfor(var m=0 ;m<HeaderData.length;m++){\r\n(body.find(\"#\"+rowid+\"sumrow\")).append(\"<td></td>\")\r\n}}\r\nfor (var t = 0; t < cellTotal.length; t++) {\r\n           var Sumcell=0;\r\n           for(var y=0;y<document.length;y++){\r\n           \r\n           Sumcell+=document[y][cellTotal[t][1]];\r\n           } \r\n           $(\"#\"+rowid+\"sumrow\").children().eq(cellTotal[t][0]).html((Sumcell).toFixed(2));\r\n           }\r\n\r\n\r\nif(DateTimepic==true){\r\n\r\n                 $(\".Datatimepic\").each(function () {\r\n        \r\n        $(this).datetimepicker({ format: 'dd/MMM/yyyy hh:mm',\r\n         pick12HourFormat: true\r\n         });\r\n    });\r\n    }\r\n    //Grid.append(\"<tr><td colspan='\" + (HeaderData.length + 2) + \"'><table class='pgrtable'><tr id='\" + rowid + \"pgr'></tr></table></td>\");\r\n\r\n\r\n    var cli = {}\r\n    cli.grid = Grid;\r\n    cli.Head = HeaderData;\r\n    cli.doc = document;\r\n    cli.dcel = datacell;\r\n    cli.psize = pagesize;\r\n    cli.Conti = GControl;\r\n    cli.icon = Gimcon;\r\n    cli.extraheader = Rowheadmain;\r\n    cli.hide = Hide;\r\n    cli.filter = search;\r\n    cli.Cwidth = colwidth;\r\n    cli.CheckAll = Chekall;\r\n    cli.dis = disab;\r\n    cli.AdF = AdvFilter;\r\n    cli.Headicon = Hcon;\r\n    cli.calall = Hcalender;\r\n    cli.cellSum=cellTotal;\r\n\r\n}\r\n\r\nfunction AfgetData(Alldata,FilterTable){\r\n\r\nvar AfArray=new Array();\r\nvar AfUlelement=FilterTable.find(\".AffilterUL\");\r\nAfUlelement.each(function(){\r\n\r\nvar AfObject={};\r\nAfObject.SearchData=$(this).attr(\"afdata\");\r\nAfObject.Searchstring=[];\r\n\r\nvar checkelement=$(this).find(\".Filtercheck\");\r\n\r\ncheckelement.each(function(){\r\nif($(this).is(\":checked\")==true){\r\nAfObject.Searchstring.push($(this).next().text());\r\n}\r\n});\r\nif(AfObject.Searchstring.length>0){\r\nAfArray.push(AfObject);\r\n}\r\n\r\n\r\n});\r\n\r\n\r\nvar Sortdata = Alldata.doc;\r\n    var Serchedata = new Array();\r\n    if (AfArray.length > 0) {\r\n        for (var y = 0; y < Sortdata.length; y++) {\r\n\r\n            var sta = true;\r\n\r\n            for (var f = 0; f < AfArray.length; f++) {\r\n                if (sta) {\r\n\r\n                    for (var _p = 0; _p < AfArray[f].Searchstring.length; _p++) {\r\n\r\n                        \r\n                        sta = Boolean(Sortdata[y][AfArray[f].SearchData] == AfArray[f].Searchstring[_p]);\r\n                        if (sta) {\r\n                            break;\r\n                        }\r\n                        else {\r\n                            if (_p == AfArray[f].Searchstring.length - 1) { sta = false; }\r\n                        }\r\n                        //                        if ((Sortdata[y][AfArray[f].SearchData]) == AfArray[f].Searchstring[_p]) {\r\n                        //                            Serchedata.push(Sortdata[y]);\r\n                        //                            break;\r\n                        //                        }\r\n                    }\r\n                }\r\n                else {break;}\r\n            }\r\n            if (sta) {\r\n                Serchedata.push(Sortdata[y]);\r\n            }\r\n\r\n           \r\n\r\n        }\r\n        \r\n        \r\n        Alldata.doc = Serchedata;\r\n      \r\n      }\r\n   \r\n\r\nreturn Alldata;\r\n\r\n\r\n\r\n}\r\n\r\nfunction Searchwindow(er) {\r\n    \r\n    var pos = er.position();\r\n    //alert(\"left = \" + pos.left + \", top = \" + pos.top);\r\n    er.next().css(\"left\", pos.left+9);\r\n    (er.next()).toggle(\"fast\", function () { });\r\n}\r\n\r\nfunction Calmethod(er) {\r\n\r\n    var pos = er.position();\r\n    //alert(\"left = \" + pos.left + \", top = \" + pos.top);\r\n    er.next().css(\"left\", pos.left - 90);\r\n    (er.next()).toggle(\"fast\", function () { });\r\n}\r\n\r\nfunction AdvFilterWindow(ey) {\r\n    var pos = ey.position();\r\n    //alert(\"left = \" + pos.left + \", top = \" + pos.top);\r\n    ey.next().css(\"left\", pos.left + 9);\r\n    (ey.next()).toggle(\"fast\", function () { });\r\n}\r\n\r\nfunction AscSorting(cli, prop) {\r\n\r\n    \r\n    var Sortdata = cli.doc;\r\n\r\n    if (dataorder) {\r\n        dataorder= false;\r\n    }\r\n\r\n    else { dataorder = true; }\r\n\r\n\r\n if (Number(Sortdata[0][prop]) != NaN) {\r\nvar currentdata = Sortdata.sort(function (a, b) {\r\n\r\n    if (dataorder) return (((a[prop]).toLowerCase()) > ((b[prop]).toLowerCase()))\r\n                                    ? 1 :\r\n                                    ((((a[prop]).toLowerCase()) < ((b[prop]).toLowerCase()))\r\n                                    ? -1\r\n                                    : 0);\r\n                                    \r\n        else return (((b[prop]).toLowerCase()) > ((a[prop]).toLowerCase())) ? 1 : ((((b[prop]).toLowerCase()) < ((a[prop]).toLowerCase())) ? -1 : 0);\r\n\r\n\r\n    });\r\n}\r\nelse {\r\n    var currentdata = Sortdata.sort(function (a, b) {\r\n                        \r\n\r\n                        if (asc) return ((Number(a[prop]) > Number(b[prop]))\r\n                                                ? 1 :\r\n                                                (Number(a[prop]) < Number(b[prop]))\r\n                                                ? -1\r\n                                                : 0);\r\n                        else return ((Number(b[prop]) > Number(a[prop])) ? 1 : (Number(b[prop]) < Number(a[prop])) ? -1 : 0);\r\n\r\n\r\n                    });\r\n    \r\n    }\r\n    \r\n  \r\n\r\n    cli.doc=currentdata;\r\n    pagegrid(cli,1,\"\");\r\n}\r\n\r\nfunction Searchdata(cli, prop, control) {\r\n\r\n    \r\n    var Sortdata = opts.document;\r\n    var Serchedata = new Array() ;\r\n    if (control.length > 0) {\r\n        for (var y = 0; y < Sortdata.length; y++) {\r\n        if(typeof(Sortdata[y][prop])==\"string\"){\r\n            var x = ((Sortdata[y][prop]).toLowerCase()).indexOf((control).toLowerCase());\r\n            if (x > -1) {\r\n                Serchedata.push(Sortdata[y]);\r\n            }\r\n            }\r\n            else if(typeof(Sortdata[y][prop])==\"number\"){\r\n            \r\n            if (((Sortdata[y][prop])==control)) {\r\n                Serchedata.push(Sortdata[y]);\r\n            }\r\n            }\r\n        }\r\n        cli.doc = Serchedata;\r\n        pagegrid(cli, 1, control);\r\n        \r\n    }\r\n\r\n    pagegrid(Golbaldata, 1, control);\r\n\r\n}\r\n\r\nfunction AdvFilterdata(yit, prop, filter) {\r\n\r\n    \r\n    var Sortdata = yit.doc;\r\n    var Serchedata = new Array();\r\n    if (filter.length > 0) {\r\n        for (var y = 0; y < Sortdata.length; y++) {\r\n            for (var f = 0; f < filter.length; f++) {\r\n                if ((Sortdata[y][prop]) == filter[f]) {\r\n                    Serchedata.push(Sortdata[y]);\r\n                    break;\r\n                }\r\n            }\r\n           \r\n        }\r\n        \r\n        \r\n        yit.doc = Serchedata;\r\n        pagegrid(yit, 1, \"\");\r\n\r\n    }\r\n\r\n   // pagegrid(Golbaldata, 1, \"\");\r\n\r\n}\r\n\r\nfunction checkall(et) {\r\n    \r\n    var t = et.parent().parent().parent().next().next().children()\r\n    if (et.is(':checked')) {\r\n        for (var f = 0; f < t.length; f++) {\r\n            var con = t.eq(f).children().eq(0).children();\r\n            con.prop(\"checked\", true);\r\n        }\r\n    }\r\n    else {\r\n        for (var f = 0; f < t.length; f++) {\r\n            var con = t.eq(f).children().eq(0).children();\r\n            con.prop(\"checked\", false);\r\n        }\r\n    }\r\n}\r\n\r\n\r\n$.fn.Dropbind = function (dtext) {\r\n    \r\n    var ele = $(this);\r\n    for (var o = 0; o < dtext.length; o++) {\r\n        ele.append(\"<option value='\" + dtext[o].value + \"'>\" + dtext[o].text + \"</option>\")\r\n    }\r\n};\r\n\r\n\r\n$.fn.DropDownfill = function (fillData, _value, _text) {\r\n\r\n    var ele = $(this);\r\n    ele.html('');\r\n    for (var o = 0; o < fillData.length; o++) {\r\n        ele.append(\"<option value='\" + fillData[o][_value] + \"'>\" + fillData[o][_text] + \"</option>\")\r\n    }\r\n};\r\n\r\n\r\n$.fn.Validate = function (TextType) {\r\n\r\n    var ele = $(this);\r\n    if (TextType == \"Number\") {\r\n        ele.keydown(function (e) {\r\n            if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105) && (e.keyCode != 8) && (e.keyCode != 9) && (e.keyCode != 46) && (!e.Decimal)) {\r\n                e.preventDefault();\r\n            }\r\n        });\r\n    }\r\n    else if (TextType == \"String\") {\r\n        ele.keydown(function (e) {\r\n            if (e.shiftKey || (e.keyCode > 32 && e.keyCode < 37) || (e.keyCode > 40 && e.keyCode < 44) || (e.keyCode > 218 && e.keyCode < 223) || (e.keyCode > 185 && e.keyCode < 193 && e.keyCode != 188) && (e.keyCode != 190) && (e.keyCode != 110) && (e.keyCode != 37) && (e.keyCode != 38) && (e.keyCode != 39) && (e.keyCode != 40)) {\r\n                e.preventDefault();\r\n            }\r\n        });\r\n    }\r\n    else if (TextType == \"Decimal\") {\r\n\r\n        ele.keyup(function (e) {\r\n\r\n            var k = e.which;\r\n            if (k == 8 || k == 46 || k == 37) {\r\n                return\r\n            }\r\n            var t = false;\r\n            var value = $(this).val() || \"\";\r\n            // var Reg = /^[-+]?(\\d+\\d*[.])?\\d?\\d?\\d$/\r\n            var Reg = /^(?=.*\\d)\\d*(?:\\.\\d?\\d?\\d)?$/\r\n\r\n            // var Reg = /^[^'\"]*$/\r\n            //var c = String.fromCharCode(k);\r\n            // value += c;\r\n\r\n            var Newvalue = \"\";\r\n            var cout = 1;\r\n\r\n            for (var _t = 1; _t < value.length + 1; _t++) {\r\n                var res = value.slice(0, _t);\r\n                var restest = Number(value.slice(0, _t));\r\n                if (!Reg.test(restest)) {\r\n                    // var valString = value.toString();\r\n                    t = true;\r\n                    break;\r\n                }\r\n                Newvalue = res;\r\n            }\r\n\r\n            if (t == true) {\r\n                $(this).val(Newvalue);\r\n                e.preventDefault()\r\n            }\r\n            else {\r\n                $(this).val(Newvalue);\r\n            }\r\n        });\r\n    }\r\n\r\n    else if (TextType == \"Special\") {\r\n\r\n        \r\n        ele.keyup(function (e) {\r\n\r\n            \r\n\r\n            var k = e.which;\r\n            if (k == 8 || k == 46 || k == 37) {\r\n                return\r\n            }\r\n            var t = false;\r\n            var value = $(this).val() || \"\";\r\n            // var Reg = /^[-+]?(\\d+\\d*[.])?\\d?\\d?\\d$/\r\n            // var Reg = /^(?=.*\\d)\\d*(?:\\.\\d?\\d?\\d)?$/\r\n\r\n            var Reg = /^[^'\"]*$/\r\n            //var c = String.fromCharCode(k);\r\n            // value += c;\r\n\r\n            var Newvalue = \"\";\r\n            var cout = 1;\r\n\r\n            for (var _t = 1; _t < value.length + 1; _t++) {\r\n                var res = value.slice(0, _t);\r\n                var restest = (value.slice(0, _t));\r\n                if (!Reg.test(restest)) {\r\n                    // var valString = value.toString();\r\n                    t = true;\r\n                    break;\r\n                }\r\n                Newvalue = res;\r\n            }\r\n\r\n            if (t == true) {\r\n                $(this).val(Newvalue);\r\n                e.preventDefault()\r\n            }\r\n            else {\r\n                $(this).val(Newvalue);\r\n            }\r\n        });\r\n    }\r\n};\r\n\r\nfunction docuni(out,Ftext) {\r\n    \r\n    var u = {}, a = [];\r\n    for (var i = 0, l = out.length; i < l; ++i) {\r\n        if (u.hasOwnProperty(out[i][Ftext])) {\r\n            continue;\r\n        }\r\n        a.push(out[i][Ftext]);\r\n        u[out[i][Ftext]] = 1;\r\n    }\r\n    return a;\r\n}\r\n\r\nfunction dropfilter(out, col,filterstr) {\r\n    \r\n    var Sortdata = out\r\n    //var p = parseInt((filterstr).split(\"\").reverse().join(\"\"));\r\n    var p = filterstr;\r\n    var Fiterdata = new Array();\r\n    //var prop =Golbaldata.Head[Number(col)];\r\n    \r\n        for (var y = 1; y < Sortdata.length; y++) {\r\n\r\n            if (Number(Sortdata[y][\"Filter\"]) == p) {\r\n                Fiterdata.push(Sortdata[y]);\r\n                   }\r\n            \r\n            }\r\n\r\n        return Fiterdata;\r\n}\r\n\r\nfunction datechange(t) {\r\n    \r\n    $(\".calfill\").val(t.val());\r\n    (t.parent().parent().parent().parent().parent()).toggle(\"fast\", function () { });\r\n}\r\n\r\n\r\n\r\n\r\nfunction removesearch(bce){\r\npagegrid(bce,1,\"\");\r\n}\r\n\r\n\r\n\r\n\r\n/// Time Function////\r\n\r\n\r\n\r\nfunction datediff(_a, _b, _c) {\r\n    \r\n    _b = new Date(_b);\r\n    _c = new Date(_c);\r\n    if (_a == \"Minute\") {\r\n        return ((_c.getTime() - _b.getTime()) / 1000) / 60;\r\n    }\r\n\r\n    if (_a == \"Hour\") {\r\n        return ((_c.getTime() - _b.getTime()) / 1000) / 60/60;\r\n    }\r\n\r\n    if (_a == \"Day\") {\r\n        return ((_c.getTime() - _b.getTime()) / 1000) / 60/60/24;\r\n    }\r\n}\r\n\r\nfunction DateShow(a, b) {\r\n    \r\n    if (a != null) {\r\n        if (typeof (a) == \"string\") {\r\n            var _date = new Date(a);\r\n        } else { var _date = a }\r\n        var monthNames = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\r\n    \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\r\n\r\n        var MothShort = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\r\n    \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\r\n\r\n        if (b == \"dd/MMM/yyyy HH:mm\") {\r\n            var _dateFormate = (_date.getDate()) + '/' + (MothShort[_date.getMonth()]) + '/' + _date.getFullYear() + '  ' + (_date.getHours().length == 1 ? \"0\" + _date.getHours() : _date.getHours()) + ':' + (_date.getMinutes().length == 1 ? \"0\" + _date.getMinutes() : _date.getMinutes())\r\n        }\r\n        else if (b == \"dd/MMM/yyyy\") {\r\n            var _dateFormate = _date.getDate() + '/' + (MothShort[_date.getMonth()]) + '/' + _date.getFullYear();\r\n        }\r\n        else if (b == \"dd MMM yyyy\") {\r\n            var _dateFormate = _date.getDate() + ' ' + (MothShort[_date.getMonth()]) + ' ' + _date.getFullYear();\r\n        }\r\n\r\n        else if (b == \"dd/MM/yyyy HH:mm tt\") {\r\n            \r\n            var tt = _date.getHours() > 12 ? \"PM\" : \"AM\";\r\n            //var _dateFormate=_date.getDate()+'/'+_date.getMonth()+'/'+_date.getFullYear()+ ' '+ _date.getHours()+':'+_date.getMinutes()+' '+tt;\r\n            var _dateFormate = a;\r\n        }\r\n    }\r\n    else {\r\n        _dateFormate = a;\r\n    }\r\n    return _dateFormate;\r\n}\r\n\r\n\r\n(function ($) {\r\n    $.fn.AspGrid = function (options) {\r\n\r\n        \r\n        var ele = $(this);\r\n        var rowid = $(this).attr(\"id\");\r\n        var opts = $.extend({}, $.fn.AspGrid.defaults, options);\r\n\r\n        var d = ele.clone(true);\r\n        var y = ele.parent();\r\n        var filterCont = opts.Filter;\r\n        var PageLength = opts.PageSize;\r\n        y.html('');\r\n        y.append(\"<table class='table dataTable' id='\" + d.attr(\"id\") + \"'></table>\");\r\n\r\n        var _i = d.find(\"tr\");\r\n\r\n        var _t = _i.eq(0).children().length;\r\n        var _m = \"\";\r\n        for (var r = 0; r < _t; r++) {\r\n            _m += \"<td></td>\";\r\n        }\r\n\r\n        \r\n        //<input type='text' class='txtfildata' serdata='col\"+_i.eq(0).children().eq(r).text()+\"'/>\r\n\r\n\r\n\r\n        $(\"#\" + d.attr(\"id\")).append(\"<thead><tr>\" + _i.eq(0).html() + \"<td style='width:20;padding-left:0px;padding-right:0px'><span class='fa fa-filter' style='font-size:20px;cursor:pointer' onclick='filtershow($(this))'></span></td></tr></thead>\");\r\n\r\n        _i.splice(0, 1);\r\n\r\n        $(\"#\" + d.attr(\"id\")).append(\"<thead><tr class='filter' style='display:none'>\" + _m + \"</tr></thead>\");\r\n\r\n        \r\n\r\n        for (var _l = 0; _l < filterCont.length; _l++) {\r\n            \r\n            $(\"#\" + d.attr(\"id\")).find(\".filter\").children().eq(filterCont[_l].index).html(\"<input type='text' class='txtfildata form-control' serdata='\" + filterCont[_l].class + \"'/>\");\r\n\r\n        }\r\n\r\n        $(\"#\" + d.attr(\"id\")).append(\"<tbody id='\" + d.attr(\"id\") + \"body'></tbody>\");\r\n\r\n      \r\n\r\n         debugger;\r\n\r\n         //var numOfVisibleRows = $('tr:visible').length;\r\n\r\n         var numOfVisibleRows = $(\"#\" + d.attr(\"id\")).find(\"thead\").eq(0).find('tr').children().filter(function() {\r\n  return $(this).css('display') !== 'none';\r\n}).length;\r\n\r\ndebugger\r\n               $(\"#\" + d.attr(\"id\")).append('<tfoot><tr><td colspan=\"'+numOfVisibleRows+'\"><ul class=\"pagination\" id=\"'+d.attr(\"id\")+'pgr\"></ul></td></tr></tfoot>');\r\n              \r\n              var PageSize=PageLength;\r\n              var intialValue=0,EndValue=intialValue+PageSize;\r\n\r\n              var cout=Math.floor(_i.length/PageSize);\r\n\r\n              cout=(_i.length%PageSize)==0?cout:cout+1;\r\n\r\n              for(var y=0;y<cout;y++){\r\n              if($(\"#\" + d.attr(\"id\")+'pgr').children().length>6){\r\n                $(\"#\" + d.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingNext\">...</a></li>');\r\n               break;\r\n               }\r\n               $(\"#\" + d.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingClick\">'+(y+1)+'</a></li>');\r\n               }\r\n\r\n               $(\"#\" + d.attr(\"id\")+'pgr').children().first().addClass(\"active\");\r\n              \r\n\r\n        for (var _p = intialValue; _p < EndValue; _p++) {\r\n            $(\"#\" + d.attr(\"id\") + \"body\").append(\"<tr>\" + _i.eq(_p).html() + \"<tr>\");\r\n        }\r\n\r\n\r\n\r\n               //Paging Click\r\n    PaginFunction(d,PageLength);\r\n          \r\n        $('.txtfildata').each(function () {\r\n            $(this).keyup(function () {\r\n                \r\n                var _txtdata = $(this).val();\r\n               var  _filterData = [];\r\n\r\n                _i.each(function () {\r\n                    var _S = true;\r\n                    \r\n                    var _current = $(this);\r\n\r\n                    $('.txtfildata').each(function () {\r\n\r\n                        \r\n                        ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)\r\n                        if ((($(this).val() == \"\" ? 1 : ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)) && _S == true)) {\r\n\r\n                            _S = true;\r\n                        }\r\n                        else {\r\n                            _S = false;\r\n                        }\r\n\r\n                        if (_S == false) {\r\n                            \r\n                        }\r\n\r\n                    });\r\n\r\n                    \r\n                    if (_S == true) {\r\n                        _filterData.push($(this));\r\n                    }\r\n                  });\r\n\r\n                               \r\n                debugger;\r\n                 $(\"#\" + d.attr(\"id\")+'pgr').html('');\r\n              var PageSize=PageLength;\r\n              var intialValue=0,EndValue=intialValue+PageSize;\r\n\r\n              var cout=Math.floor(_filterData.length/PageSize);\r\n\r\n              cout=(_filterData.length%PageSize)==0?cout:cout+1;\r\n\r\n              if(_filterData.length>PageSize){\r\n             \r\n              for(var y=0;y<cout;y++){\r\n               if($(\"#\" + d.attr(\"id\")+'pgr').children().length>6){\r\n               $(\"#\" + d.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingNext\">...</a></li>');\r\n               break;\r\n               }\r\n               $(\"#\" + d.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingClick\">'+(y+1)+'</a></li>');\r\n               }\r\n\r\n               $(\"#\" + d.attr(\"id\")+'pgr').children().first().addClass(\"active\");\r\n               }\r\n\r\n               debugger;\r\n            $(\"#\" + d.attr(\"id\") + \"body\").html('');\r\n\r\n                for (var _p = 0; _p < PageSize; _p++) {\r\n                    $(\"#\" + d.attr(\"id\") + \"body\").append(\"<tr>\" + _filterData[_p].html() + \"<tr>\");\r\n                }\r\n                PaginFunction(d,PageLength);\r\n\r\n         \r\n           \r\n           });\r\n \r\n        });\r\n\r\n    };\r\n})(jQuery);\r\n\r\n// Plugin defaults – added as a property on our plugin function.\r\n$.fn.AspGrid.defaults = {\r\n    // Id: \"\",\r\n    Filter: \"\",\r\n    PageSize:10\r\n\r\n};\r\n\r\n\r\nfunction PaginFunction(Gdata,Psize){\r\n\r\nvar _i= Gdata.find(\"tr\");\r\n\r\n_i.splice(0, 1);\r\n\r\n $(\".PagingNext\").click(function(){\r\n\r\n               debugger;\r\n                $(this).parent().parent().children().each(function(){\r\n                $(this).removeClass(\"active\");\r\n                });\r\n\r\n                var _filterData=[];\r\n             \r\n\r\n                 _i.each(function () {\r\n                    var _S = true;\r\n                    \r\n                    var _current = $(this);\r\n\r\n                    $('.txtfildata').each(function () {\r\n\r\n                        \r\n                        ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)\r\n                        if ((($(this).val() == \"\" ? 1 : ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)) && _S == true)) {\r\n\r\n                            _S = true;\r\n                        }\r\n                        else {\r\n                            _S = false;\r\n                        }\r\n\r\n                        if (_S == false) {\r\n                            \r\n                        }\r\n\r\n                    });\r\n\r\n                    \r\n                    if (_S == true) {\r\n                        _filterData.push($(this));\r\n                    }\r\n                   });\r\n\r\n\r\n                 \r\n\r\n              var PageSize=Psize;\r\n              var intialValue=0,EndValue=intialValue+PageSize;\r\n\r\n              var cout=Math.floor(_filterData.length/PageSize);\r\n\r\n              cout=(_filterData.length%PageSize)==0?cout:cout+1;\r\n\r\n             var NextCount=Number($(this).parent().prev().children().text());\r\n             \r\n              $(\"#\" + Gdata.attr(\"id\")+'pgr').html('');\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').prepend('<li><a href=\"#\" class=\"PagingPrev\">...</a></li>');\r\n\r\n                  \r\n              for(var y=NextCount;y<cout;y++){\r\n               if($(\"#\" + Gdata.attr(\"id\")+'pgr').children().length>6){\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingNext\">...</a></li>');\r\n               break;\r\n               }\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingClick\">'+(y+1)+'</a></li>');\r\n               }\r\n\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').children().first().next().addClass(\"active\");\r\n              \r\n\r\n              PaginFunction(Gdata,Psize);\r\n                     debugger;\r\n                  var PageSize=Psize;\r\n                  var activeVal=NextCount+1;\r\n\r\n              var intialValue=(activeVal*PageSize),EndValue=intialValue+PageSize;\r\n\r\n               $(\"#\" + Gdata.attr(\"id\") + \"body\").html('');\r\n\r\n                for (var _p = intialValue; _p < EndValue; _p++) {\r\n                    $(\"#\" + Gdata.attr(\"id\") + \"body\").append(\"<tr>\" + _filterData[_p].html() + \"<tr>\");\r\n                }\r\n\r\n              \r\n               });\r\n\r\n\r\n               \r\n           $(\".PagingClick\").click(function(){\r\n\r\n               debugger;\r\n                $(this).parent().parent().children().each(function(){\r\n                $(this).removeClass(\"active\");\r\n                });\r\n               var _filterData=[];\r\n               $(this).parent().addClass(\"active\");\r\n\r\n                 _i.each(function () {\r\n                    var _S = true;\r\n                    \r\n                    var _current = $(this);\r\n\r\n                    $('.txtfildata').each(function () {\r\n\r\n                        \r\n                        ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)\r\n                        if ((($(this).val() == \"\" ? 1 : ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)) && _S == true)) {\r\n\r\n                            _S = true;\r\n                        }\r\n                        else {\r\n                            _S = false;\r\n                        }\r\n\r\n                        if (_S == false) {\r\n                            \r\n                        }\r\n\r\n                    });\r\n\r\n                    \r\n                    if (_S == true) {\r\n                        _filterData.push($(this));\r\n                    }\r\n                   });\r\n\r\n                     debugger;\r\n                  var PageSize=Psize;\r\n                  var activeVal=Number($(this).text())-1;\r\n\r\n              var intialValue=(activeVal*PageSize),EndValue=intialValue+PageSize;\r\n\r\n               $(\"#\" + Gdata.attr(\"id\") + \"body\").html('');\r\n\r\n                for (var _p = intialValue; _p < EndValue; _p++) {\r\n                    $(\"#\" + Gdata.attr(\"id\") + \"body\").append(\"<tr>\" + _filterData[_p].html() + \"<tr>\");\r\n                }\r\n\r\n               \r\n\r\n               });\r\n\r\n$(\".PagingPrev\").click(function(){\r\n\r\n               debugger;\r\n                $(this).parent().parent().children().each(function(){\r\n                $(this).removeClass(\"active\");\r\n                });\r\n\r\n                var _filterData=[];\r\n             \r\n\r\n                 _i.each(function () {\r\n                    var _S = true;\r\n                    \r\n                    var _current = $(this);\r\n\r\n                    $('.txtfildata').each(function () {\r\n\r\n                        \r\n                        ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)\r\n                        if ((($(this).val() == \"\" ? 1 : ((_current.find(\".\" + $(this).attr(\"serdata\")).text().toLowerCase().trim()).indexOf(($(this).val()).toLowerCase().trim()) >= 0)) && _S == true)) {\r\n\r\n                            _S = true;\r\n                        }\r\n                        else {\r\n                            _S = false;\r\n                        }\r\n\r\n                        if (_S == false) {\r\n                            \r\n                        }\r\n\r\n                    });\r\n\r\n                    \r\n                    if (_S == true) {\r\n                        _filterData.push($(this));\r\n                    }\r\n                   });\r\n\r\n\r\n                 \r\n\r\n              var PageSize=Psize;\r\n             \r\n              var cout=Math.floor(_filterData.length/PageSize);\r\n\r\n              cout=(_filterData.length%PageSize)==0?cout:cout+1;\r\n\r\n              debugger;\r\n\r\n             var NextCount=Number($(this).parent().next().children().text())-8;\r\n             \r\n              $(\"#\" + Gdata.attr(\"id\")+'pgr').html('');\r\n\r\n              if(NextCount!=0){\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').prepend('<li><a href=\"#\" class=\"PagingPrev\">...</a></li>');\r\n                 NextCount=NextCount+1;\r\n               }\r\n               \r\n                  \r\n              for(var y=NextCount;y<cout;y++){\r\n               if($(\"#\" + Gdata.attr(\"id\")+'pgr').children().length>6){\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingNext\">...</a></li>');\r\n               break;\r\n               }\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').append('<li><a href=\"#\" class=\"PagingClick\">'+(y+1)+'</a></li>');\r\n               }\r\n\r\n               $(\"#\" + Gdata.attr(\"id\")+'pgr').children().last().prev().addClass(\"active\");\r\n              \r\n\r\n              PaginFunction(Gdata,Psize);\r\n                     debugger;\r\n                  var PageSize=Psize;\r\n                  var activeVal=(NextCount-1)+7;\r\n\r\n                  if(activeVal==2){activeVal=1}\r\n                 \r\n              var intialValue=(activeVal*PageSize),EndValue=intialValue+PageSize;\r\n\r\n               $(\"#\" + Gdata.attr(\"id\") + \"body\").html('');\r\n\r\n                for (var _p = intialValue; _p < EndValue; _p++) {\r\n                    $(\"#\" + Gdata.attr(\"id\") + \"body\").append(\"<tr>\" + _filterData[_p].html() + \"<tr>\");\r\n                }\r\n\r\n              \r\n               });\r\n\r\n}\r\n\r\nfunction filtershow(el) {\r\n    \r\n    el.parent().parent().parent().parent().find(\".filter\").toggle();\r\n}\r\n\r\n\r\nfunction FilterArray(MenuArrey, FiterTex, FilterCol) {\r\n\r\n\r\n    var Serchedata = new Array();\r\n\r\n    for (var y = 0; y < MenuArrey.length; y++) {\r\n\r\n        if ((MenuArrey[y][FilterCol]) == FiterTex) {\r\n            Serchedata.push(MenuArrey[y]);\r\n\r\n        }\r\n\r\n    }\r\n    return Serchedata;\r\n\r\n}\r\n\r\n\r\n"}}
{"actor":{"display_login":"SingChandan"}}