export declare const NSGridCode = "var nsModuleExport = function(root,name,prototype)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\tmodule.exports[name] = prototype;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\tdefine(name,[], function () {return prototype;});\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\texports[name] = prototype;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\troot[name] = prototype;\r\n\t\t}\r\n\t};var nsIsWeb = function(root)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};if(!nsIsWeb())\r\n\t\t{\r\nvar nsutilRef = require('./nsUtil.min.js');\r\nvar NSUtil = nsutilRef.NSUtil;\r\nvar nscontainerbaseRef = require('./nsContainerBase.min.js');\r\nvar nsExtendPrototype = nscontainerbaseRef.nsExtendPrototype;\r\nvar NSContainerBase = nscontainerbaseRef.NSContainerBase;\r\nvar svgRef = require('./nsSVG.min.js');\r\nvar NSSvg = svgRef.NSSvg;\r\nvar NSSvgShapes = svgRef.NSSvgShapes;\r\nvar plugginsRef = require('./nsPluggins.min.js');\r\nvar nsTextEditor = plugginsRef.nsTextEditor;\r\nvar nsTextAreaEditor = plugginsRef.nsTextAreaEditor;\r\nvar NSCellSelection = plugginsRef.NSCellSelection;\r\nvar NSTableCellNavigator = plugginsRef.NSTableCellNavigator;\r\nvar dateutilRef = require('./nsDateUtil.min.js');\r\nvar NSDateUtil = dateutilRef.NSDateUtil;\r\n\r\n\t\t}\r\n \"use strict\"; \r\nvar NSMenu = (function()\r\n{\r\n\tfunction NSMenu(setting) \r\n\t{\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.DEFAULT_POSITION = this.util.POS_BOTTOMRIGHT;\r\n\t\t\r\n\t\tthis.__setting = setting;\r\n\t\tthis.__config = null;\r\n\t\t\r\n\t\tthis.__id = null;\r\n\t\tthis.__popUp = null;\r\n\t\tthis.__nsPopUp = null;\r\n\t\tthis.__fieldItem = null;\r\n\t\tthis.__fieldItemChild = null;\r\n\t\tthis.__fieldChild = \"children\";\r\n\t\tthis.__isInternalCall = false;\r\n\t\tthis.__suppressDocumentHandler = false;\r\n\t\t\r\n\t\tthis.__documentClickRef = null;\r\n\t\tthis.__documentKeyUpRef = null;\r\n\t\tthis.__lastSelectedTarget = null;\r\n\t\t\r\n\t\tthis.__initialize();\r\n\t}\r\n\t\r\n\tNSMenu.prototype.create = function (dataSource) \r\n\t{ \r\n\t\tif(dataSource && (this.__config.createRunTime || this.__isInternalCall))\r\n\t\t{\r\n\t\t\tif(this.__popUp)\r\n\t\t\t{\r\n\t\t\t\tthis.remove();\r\n\t\t\t}\r\n\t\t\tthis.__isInternalCall = false;\r\n\t\t\tthis.__config.dataSource = dataSource;\r\n\t\t\tthis.__popUp = this.__createElement(true,this.__config.dataSource);\r\n\t\t\tthis.util.addStyleClass(this.__nsPopUp,\"nsMainMenu\");\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.remove = function () \r\n\t{ \r\n\t\tif(this.__config.createRunTime || this.__isInternalCall)\r\n\t\t{\r\n\t\t\tthis.__isInternalCall = false;\r\n\t\t\tthis.__nsPopUp.remove();\r\n\t\t\tthis.__popUp = null;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.show = function (event) \r\n\t{ \r\n\t\tevent = this.util.getEvent(event);\r\n\t\tthis.__nsPopUp.hideOtherNSPopUp();\r\n\t\tif(this.__config.createRunTime)\r\n\t\t{\r\n\t\t\tthis.__isInternalCall = true;\r\n\t\t\tvar dataSource = null;\r\n\t\t\tif(this.__config.sourceProvider)\r\n\t\t\t{\r\n\t\t\t\tdataSource = this.__config.sourceProvider(this.__lastSelectedTarget);\r\n\t\t\t}\r\n\t\t\tif(dataSource && dataSource.length > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.create(dataSource);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.preventDefault(event);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__nsPopUp.show();\r\n\t\tthis.__nsPopUp.placePopUp(event);\r\n\t\tif(!this.__documentClickRef)\r\n\t\t{\r\n\t\t\tthis.__documentClickRef = this.__documentClickHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document.documentElement,\"click\", this.__documentClickRef);\r\n\t\t}\r\n\t\tif(!this.__documentKeyUpRef)\r\n\t\t{\r\n\t\t\tthis.__documentKeyUpRef = this.__documentKeyUpHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document.documentElement,\"keyup\", this.__documentKeyUpRef);\r\n\t\t}\r\n\t\tthis.util.preventDefault(event);\r\n\t};\r\n\tNSMenu.prototype.hide = function() \r\n\t{\r\n\t\tthis.__lastSelectedTarget = null;\r\n\t\tthis.__hideAllSubMenus();\r\n\t\tif(this.__config.createRunTime)\r\n\t\t{\r\n\t\t\tthis.__isInternalCall = true;\r\n\t\t\tthis.remove();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__nsPopUp.hide();\r\n\t\t}\r\n\t\tif(this.__documentClickRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document.documentElement,\"click\", this.__documentClickRef, false);\r\n\t\t\tthis.__documentClickRef = null;\r\n\t\t}\r\n\t\tif(this.__documentKeyUpRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document.documentElement,\"keyup\", this.__documentKeyUpRef, false);\r\n\t\t\tthis.__documentKeyUpRef = null;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__initialize = function ()\r\n\t{\r\n\t\tif(this.__setting)\r\n\t\t{\r\n\t\t\t//eventHandler:extra eventHandler which developer wants to execute on the event i.e. click,customEvent etc\r\n\t\t\tthis.__config = {\r\n\t\t\t\t\tparent: this.__setting[\"parent\"] || null,\r\n\t\t\t\t\tdataSource: this.__setting[\"dataSource\"] || null,\r\n\t\t\t\t\tisContextMenu: (this.util.isUndefined(this.__setting[\"isContextMenu\"]) || this.__setting[\"isContextMenu\"] === null) ? true : Boolean.parse(this.__setting[\"isContextMenu\"]),\r\n\t\t\t\t\teventType: this.__setting[\"eventType\"] || \"click\",\r\n\t\t\t\t\tcreateRunTime: (this.util.isUndefined(this.__setting[\"createRunTime\"]) || this.__setting[\"createRunTime\"] === null) ? false : Boolean.parse(this.__setting[\"createRunTime\"]),\r\n\t\t\t\t\tsourceProvider: this.__setting[\"sourceProvider\"] || null,\r\n\t\t\t\t\ttargetType: this.__setting[\"targetType\"] || null,\r\n\t\t\t\t\tdefaultHandler: (this.__setting[\"defaultHandler\"] ? this.util.getFunction(this.__setting[\"defaultHandler\"]) : null),\r\n\t\t\t\t\teventHandler: (this.__setting[\"eventHandler\"] ? this.util.getFunction(this.__setting[\"eventHandler\"]) : null),\r\n\t\t\t\t\tposition: this.__setting[\"position\"] || this.DEFAULT_POSITION,\r\n\t\t\t\t\twidth: parseInt(this.__setting[\"width\"]) || -1\r\n\t\t\t\t};\r\n\t\t\tif(this.__config.parent)\r\n\t\t\t{\r\n\t\t\t\tvar popUpSetting = {id:this.__getID() + \"menu\",type:\"ul\",width:this.__config.width,position:this.__config.position};\r\n\t\t\t\tthis.__nsPopUp = new this.util.nsPopUp(popUpSetting);\r\n\t\t\t\tthis.__fieldItem = this.__getID() + \"_item\";\r\n\t\t\t\tthis.__fieldItemChild = this.__getID() + \"_child\";\r\n\t\t\t\tif(!this.__config.createRunTime)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__isInternalCall = true;\r\n\t\t\t\t\tthis.create(this.__config.dataSource);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__config.isContextMenu)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addEvent(this.__config.parent,\"contextmenu\", this.__parentContextMenuHandler.bind(this));\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addEvent(this.__config.parent,this.__config.eventType, this.__parentClickHandler.bind(this),false);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__createElement = function(isRoot,dataSource) \r\n\t{\r\n\t\tvar parentNode = null;\r\n\t\tif(dataSource && dataSource.length > 0)\r\n\t\t{\r\n\t\t\tif(isRoot)\r\n\t\t\t{\r\n\t\t\t\tparentNode = this.__nsPopUp.create();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tparentNode = document.createElement(\"ul\"); \r\n\t\t\t\tthis.util.addStyleClass(parentNode,\"nsMenu\");\r\n\t\t\t\tif(this.__config.width > -1)\r\n\t\t\t\t{\r\n\t\t\t\t\tparentNode.style.width = this.__config.width + \"px\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (var count = 0; count < dataSource.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar item = dataSource[count];\r\n\t\t\t\tthis.__createItem(item,parentNode);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn parentNode;\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__createItem = function(item,parent)\r\n\t{\r\n\t\tvar menuItem = null;\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tmenuItem = document.createElement(\"li\");\r\n\t\t\tthis.util.addStyleClass(menuItem,\"nsMenuItem\");\r\n\t\t\tif(item[\"header\"])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(menuItem,\"nsHeader\");\r\n\t\t\t}\r\n\t\t\tif(item[\"disabled\"])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(menuItem,\"nsDisabled\");\r\n\t\t\t}\r\n\t\t\tvar button = document.createElement(\"BUTTON\");\r\n\t\t\tthis.util.addStyleClass(button,\"nsMenuButton\");\r\n\t\t\tif(item[\"iconHTML\"])\r\n\t\t\t{\r\n\t\t\t\tvar spanIcon = document.createElement(\"span\");\r\n\t\t\t\tthis.util.addStyleClass(spanIcon,\"nsMenuAlign\");\r\n\t\t\t\tspanIcon.innerHTML = item[\"iconHTML\"];\r\n\t\t\t\tbutton.appendChild(spanIcon);\r\n\t\t\t}\r\n\t\t\tvar spanText = document.createElement(\"span\");\r\n\t\t\tthis.util.addStyleClass(spanText,\"nsMenuText\");\r\n\t\t\tspanText.appendChild(document.createTextNode(item[\"title\"]));\r\n\t\t\tbutton.appendChild(spanText);\r\n\t\t\tmenuItem.appendChild(button);\r\n\t\t\tthis.util.addEvent(menuItem,\"click\",this.__itemClickHandler.bind(this));\r\n\t\t\tthis.util.addEvent(menuItem,\"mouseenter\",this.__itemMouseOverHandler.bind(this));\r\n\t\t\tthis.util.addEvent(menuItem,\"mouseleave\",this.__itemMouseOutHandler.bind(this));\r\n\t\t\tif(item[this.__fieldChild]) \r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(menuItem,\"nsSubMenu\");\r\n\t\t    \tvar subMenu = this.__createElement(false,item[this.__fieldChild]);\r\n\t\t    \tif(subMenu)\r\n\t\t    \t{\r\n\t\t    \t\tthis.util.addStyleClass(subMenu,\"nsSubMenuContainer\");\r\n\t\t\t    \tmenuItem.appendChild(subMenu);\r\n\t\t\t    \titem[this.__fieldItemChild] = subMenu;\r\n\t\t\t    \tmenuItem.setAttribute(\"hasChild\",true);\r\n\t\t    \t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmenuItem.setAttribute(\"hasChild\",false);\r\n\t\t\t}\r\n\t\t\tif(parent)\r\n\t\t\t{\r\n\t\t\t\tparent.appendChild(menuItem);\r\n\t\t\t\tif(item[\"separatorBelow\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tvar lineMenuItem = document.createElement(\"li\");\r\n\t\t\t\t\tthis.util.addStyleClass(lineMenuItem,\"nsMenuSeparator\");\r\n\t\t\t\t\tparent.appendChild(lineMenuItem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\titem[this.__fieldItem] = menuItem;\r\n\t\t}\r\n\t\treturn menuItem;\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__itemClickHandler = function(event) \r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"LI\");\r\n\t\tvar item = this.__getItem(target,this.__config.dataSource);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar handler = null;\r\n\t\t\tif(item[\"handler\"])\r\n\t\t\t{\r\n\t\t\t\thandler = this.util.getFunction(item[\"handler\"]);\r\n\t\t\t}\r\n\t\t\tif(!handler)\r\n\t\t\t{\r\n\t\t\t\thandler = this.__config.defaultHandler;\r\n\t\t\t}\r\n\t\t\tif(handler)\r\n\t\t\t{\r\n\t\t\t\thandler(this.__lastSelectedTarget,item);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.hide();\r\n\t\tevent.stopImmediatePropagation();\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__itemMouseOverHandler = function(event) \r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"LI\");\r\n\t\tif(target.getAttribute(\"hasChild\") === \"true\")\r\n\t\t{\r\n\t\t\tvar item = this.__getItem(target,this.__config.dataSource);\r\n\t\t\tif(item && item[this.__fieldItemChild])\r\n\t\t\t{\r\n\t\t\t\tvar childMenu = item[this.__fieldItemChild];\r\n\t\t\t\tthis.util.addStyleClass(childMenu,\"nsShowMenu\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__itemMouseOutHandler = function(event) \r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"LI\");\r\n\t\tif(target.getAttribute(\"hasChild\") === \"true\")\r\n\t\t{\r\n\t\t\tvar item = this.__getItem(target,this.__config.dataSource);\r\n\t\t\tif(item && item[this.__fieldItemChild])\r\n\t\t\t{\r\n\t\t\t\tvar childMenu = item[this.__fieldItemChild];\r\n\t\t\t\tthis.util.removeStyleClass(childMenu,\"nsShowMenu\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__documentClickHandler = function(event) \r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\t/*if(!this.__config.isContextMenu && this.__isParentPresent(event.target,this.__config.parent))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}*/\r\n\t\t//commenting this so that menu closes on click in Grid\r\n\t\t/*if(this.__suppressDocumentHandler)\r\n\t\t{\r\n\t\t\tthis.__suppressDocumentHandler = false;\r\n\t\t\treturn;\r\n\t\t}*/\r\n\t\tthis.hide();\r\n\t};\r\n\t\r\n\t\r\n\tNSMenu.prototype.__documentKeyUpHandler = function(event) \r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tif(event.keyCode === this.util.KEYCODE.ESC) \r\n\t\t{\r\n\t\t\tthis.hide();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__parentContextMenuHandler = function(event)\r\n\t{\r\n\t\tif(this.__config.eventHandler)\r\n\t\t{\r\n\t\t\tthis.__config.eventHandler(event);\r\n\t\t}\r\n\t\tthis.__setLastSelectedTarget(this.util.getTarget(event));\r\n\t\tthis.show(event);\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__parentClickHandler = function(event)\r\n\t{\r\n\t\tif(this.__config.eventHandler)\r\n\t\t{\r\n\t\t\tthis.__config.eventHandler(event);\r\n\t\t}\r\n\t\tthis.__setLastSelectedTarget(this.util.getTarget(event));\r\n\t\t//below condition to make documentClickhandler aware that do not hide the menu,hence put only for click handler\r\n\t\tif(this.__config.eventType === \"click\")\r\n\t\t{\r\n\t\t\tthis.__suppressDocumentHandler = true;\r\n\t\t\tevent.stopPropagation();\r\n\t\t}\r\n\t\tthis.show(event);\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__getItem = function(objItem,dataSource)\r\n\t{\r\n\t\tif(objItem)\r\n\t\t{\r\n\t\t\tfor (var count = 0; count < dataSource.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar item = dataSource[count];\r\n\t\t\t\tif(item[this.__fieldItem] == objItem)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t\tif(item.hasOwnProperty(this.__fieldChild))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar childItem = this.__getItem(objItem,item[this.__fieldChild]);\r\n\t\t\t\t\tif(childItem)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn childItem;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__hideAllSubMenus = function()\r\n\t{\r\n\t\tvar arrSubMenus = this.__popUp.querySelectorAll(\"ul\");\r\n\t\tif(arrSubMenus && arrSubMenus.length > 0)\r\n\t\t{\r\n\t\t\tvar subMenu = null;\r\n\t\t\tfor(var count = 0;count < arrSubMenus.length;count++)\r\n\t\t\t{\r\n\t\t\t\tsubMenu = arrSubMenus[count];\r\n\t\t\t\tthis.util.removeStyleClass(subMenu,\"nsShowMenu\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__setLastSelectedTarget = function(target)\r\n\t{\r\n\t\tif(target && this.__config.targetType)\r\n\t\t{\r\n\t\t\ttarget = this.util.findParent(target,this.__config.targetType);\r\n\t\t}\r\n\t\tthis.__lastSelectedTarget = target;\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__getID = function()\r\n\t{\r\n\t\tif(!this.__id)\r\n\t\t{\r\n\t\t\tif(this.__config.parent.hasAttribute(\"id\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__id = this.__config.parent.getAttribute(\"id\");\r\n\t\t\t}\r\n\t\t\telse if(this.__config.parent.hasAttribute(\"name\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__id = this.__config.parent.getAttribute(\"name\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__id = \"comp\" + this.util.getUniqueId();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.__id;\r\n\t};\r\n\t\r\n\tNSMenu.prototype.__isParentPresent =  function(node,parentNode) \r\n\t{\r\n\t\twhile (node && node!== document.body)\r\n\t\t{\r\n\t\t\tif(node.id === parentNode.id) \r\n\t\t\t{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tnode = node.parentNode;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\treturn NSMenu;\r\n})();\r\nnsModuleExport(this,\"NSMenu\",NSMenu); \"use strict\";\r\nvar NSPagination = (function()\r\n{\r\n\tfunction NSPagination(setting) \r\n\t{\r\n\t\tthis.PAGE_CLICK = \"pageClick\";\r\n\t\tthis.PAGE_CHANGE = \"pageChange\";\r\n\t\tthis.util = new NSUtil();\r\n\t\t\r\n\t\tthis.__setting = setting;\r\n\t\tthis.__config = null;\r\n\t\t\r\n\t\tthis.__id = null;\r\n\t\tthis.__container = null;\r\n\t\tthis.__itemFirst = null;\r\n\t\tthis.__itemLast = null;\r\n\t\tthis.__itemPrev = null;\r\n\t\tthis.__itemNext = null;\r\n\t\tthis.__arrItemPage = [];\r\n\t\tthis.__pageCount = 0;\r\n\t\tthis.__selectedPage = -1;\r\n\t\tthis.__initialize();\r\n\t}\r\n\t\r\n\tNSPagination.prototype.__initialize = function ()\r\n\t{\r\n\t\tif(this.__setting)\r\n\t\t{\r\n\t\t\tthis.__config = {\r\n\t\t\t\t\tparent: this.__setting[\"parent\"] || null,\r\n\t\t\t\t\ttotalRecords: parseInt(this.__setting[\"totalRecords\"]) || 0,\r\n\t\t\t\t\tpageSize: parseInt(this.__setting[\"pageSize\"]) || 0,\r\n\t\t\t\t\ttotalPageCount: parseInt(this.__setting[\"totalPageCount\"]) || 0,\r\n\t\t\t\t\tvisiblePages: parseInt(this.__setting[\"visiblePages\"]) || 5,\r\n\t\t\t\t\tcontainerStyle: this.__setting[\"containerStyle\"] || \"nsPaginationContainer\",\r\n\t\t\t\t\tactiveStyle: this.__setting[\"activeStyle\"] || \"nsPageActive\",\r\n\t\t\t\t\tdisabledStyle: this.__setting[\"disabledStyle\"] || \"nsPageDisabled\",\r\n\t\t\t\t\ttextFirst : this.__setting[\"textFirst\"] || \"&laquo;\",\r\n\t\t\t\t\ttextLast : this.__setting[\"textLast\"] || \"&raquo;\",\r\n\t\t\t\t\ttextNext : this.__setting[\"textNext\"] || \"&rsaquo;\",\r\n\t\t\t\t\ttextPrev : this.__setting[\"textPrev\"] || \"&lsaquo;\",\r\n\t\t\t\t\ttextTitlePagePrefix: this.__setting[\"textTitlePagePrefix\"] || \"Page\",\r\n\t\t\t        textTitleFirst : this.__setting[\"textTitleFirst\"] || 'First Page', \r\n\t\t\t        textTitleLast : this.__setting[\"textTitleLast\"] || 'Last Page',\r\n\t\t\t        textTitleNext : this.__setting[\"textTitleNext\"] || 'Next Page', \r\n\t\t\t        textTitlePrev : this.__setting[\"textTitlePrev\"] || 'Previous Page', \r\n\t\t\t\t\tshowPrevNext : (!this.util.isUndefined(this.__setting[\"showPrevNext\"]) && this.__setting[\"showPrevNext\"] != null) ? Boolean.parse(this.__setting[\"showPrevNext\"]) : true,\r\n\t\t\t\t\tshowFirstLast : (!this.util.isUndefined(this.__setting[\"showFirstLast\"]) && this.__setting[\"showFirstLast\"] != null) ? Boolean.parse(this.__setting[\"showFirstLast\"]) : false\r\n\t\t\t\t};\r\n\t\t\tthis.__create();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSPagination.prototype.changePageSize = function(pageSize)\r\n\t{\r\n\t\tif(pageSize > 0 && this.__config)\r\n\t\t{\r\n\t\t\tthis.__config.pageSize = pageSize;\r\n\t\t\tthis.__create();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSPagination.prototype.setSelectedPage = function(pageNumber)\r\n\t{\r\n\t\tthis.__update(pageNumber);\r\n\t};\r\n\t\r\n\tNSPagination.prototype.getSelectedPage = function(pageNumber)\r\n\t{\r\n\t\treturn this.__selectedPage;\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__create = function()\r\n\t{\r\n\t\tif(this.__config.parent)\r\n\t\t{\r\n\t\t\tif(this.__container)\r\n\t\t\t{\r\n\t\t\t\tthis.__container.parentNode.removeChild(this.__container);\r\n\t\t\t\tthis.__arrItemPage = [];\r\n\t\t\t\tthis.__selectedPage = -1;\r\n\t\t\t}\r\n\t\t\tif(this.__config.totalPageCount > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__pageCount = this.__config.totalPageCount;\r\n\t\t\t}\r\n\t\t\telse if(this.__config.pageSize > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__pageCount =  Math.ceil(this.__config.totalRecords / this.__config.pageSize);\r\n\t\t\t}\r\n\t\t\tthis.__container = this.util.createElement(\"ul\",this.__getID() + \"container\",this.__config.containerStyle);\r\n\t\t\tthis.__config.parent.appendChild(this.__container);\r\n\t\t\tif(this.__config.showFirstLast)\r\n\t\t\t{\r\n\t\t\t\tthis.__itemFirst = this.__createItem(\"-4\",this.__config[\"textFirst\"],this.__config.textTitleFirst,this.__controlItemClickHandler);\r\n\t\t\t}\r\n\t\t\tif(this.__config.showPrevNext)\r\n\t\t\t{\r\n\t\t\t\tthis.__itemPrev = this.__createItem(\"-3\",this.__config[\"textPrev\"],this.__config.textTitlePrev,this.__controlItemClickHandler);\r\n\t\t\t}\r\n\t\t\tvar createdNumber = Math.min(this.__pageCount,this.__config.visiblePages);\r\n\t\t\tfor(var count = 1;count <= createdNumber;count++)\r\n\t\t\t{\r\n\t\t\t\tvar pageItem = this.__createItem(count,count,this.__config.textTitlePagePrefix + \" \" + count,this.__pageItemClickHandler);\r\n\t\t\t\tthis.__arrItemPage.push(pageItem);\r\n\t\t\t}\r\n\t\t\tif(this.__config.showPrevNext)\r\n\t\t\t{\r\n\t\t\t\tthis.__itemNext = this.__createItem(\"-2\",this.__config[\"textNext\"],this.__config.textTitleNext,this.__controlItemClickHandler);\r\n\t\t\t}\r\n\t\t\tif(this.__config.showFirstLast)\r\n\t\t\t{\r\n\t\t\t\tthis.__itemLast = this.__createItem(\"-1\",this.__config[\"textLast\"],this.__config.textTitleLast,this.__controlItemClickHandler);\r\n\t\t\t}\r\n\t\t\t//this.__selectPage(1);\r\n\t\t\tthis.__updateControlState(1);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__controlItemClickHandler = function(event)\r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"li\");\r\n\t\tvar index = parseInt(target.getAttribute(\"pageNum\"));\r\n\t\tvar pageSelected = -1;\r\n\t\tswitch(index)\r\n\t\t{\r\n\t\t\tcase -4:\r\n\t\t\t\tpageSelected = 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase -3:\r\n\t\t\t\tpageSelected = this.__selectedPage - 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase -2:\r\n\t\t\t\tpageSelected = this.__selectedPage + 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase -1:\r\n\t\t\t\tpageSelected = this.__pageCount;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tthis.__update(pageSelected);\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__pageItemClickHandler = function(event)\r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"li\");\r\n\t\tvar index = parseInt(target.getAttribute(\"pageNum\"));\r\n\t\tthis.__update(index);\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__createItem = function(pageNumber,htmlText,titleText,clickHandler)\r\n\t{\r\n\t\tvar pageItem = this.util.createElement(\"li\",this.__getID() + \"Page\" + pageNumber,null);\r\n\t\tpageItem.setAttribute(\"pageNum\",pageNumber);\r\n\t\tpageItem.setAttribute(\"title\",titleText);\r\n\t\tthis.util.addEvent(pageItem,\"click\",clickHandler.bind(this));\r\n\t\tvar pageText = this.util.createElement(\"a\",null,null);\r\n\t\tpageText.setAttribute(\"href\",\"javascript:void(0);\");\r\n\t\tpageText.innerHTML = htmlText;\r\n\t\tpageItem.appendChild(pageText);\r\n\t\tthis.__container.appendChild(pageItem);\r\n\t\treturn pageItem;\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__update = function(pageNumber)\r\n\t{\r\n\t\tif(pageNumber <= 0)\r\n\t\t{\r\n\t\t\tpageNumber = 1;\r\n\t\t}\r\n\t\telse if(pageNumber > this.__pageCount)\r\n\t\t{\r\n\t\t\tpageNumber = this.__pageCount;\r\n\t\t}\r\n\t\tvar range = this.__calculateRange(this.__pageCount,Math.min(this.__pageCount,this.__config.visiblePages),pageNumber);\r\n\t\tthis.__updateItem(range[0],range[1]);\r\n\t\tthis.__selectPage(pageNumber);\r\n\t\tthis.__updateControlState(pageNumber);\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__updateItem = function(fromPage,toPage)\r\n\t{\r\n\t\tvar firstNumber = parseInt(this.__arrItemPage[0].getAttribute(\"pageNum\"));\r\n\t\tvar lastNumber = parseInt(this.__arrItemPage[this.__arrItemPage.length - 1].getAttribute(\"pageNum\"));\r\n\t\tif(!(firstNumber === fromPage && lastNumber === toPage))\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < this.__arrItemPage.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar pageItem = this.__arrItemPage[count];\r\n\t\t\t\tvar index = count + fromPage;\r\n\t\t\t\tpageItem.setAttribute(\"pageNum\",index);\r\n\t\t\t\tpageItem.setAttribute(\"title\",this.__config.textTitlePagePrefix + \" \" + index);\r\n\t\t\t\tvar pageText = pageItem.firstChild;\r\n\t\t\t\tpageText.innerHTML = index;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__updateControlState = function(pageNumber)\r\n\t{\r\n\t\tif(pageNumber === 1)\r\n\t\t{\r\n\t\t\tthis.__itemFirst ? this.util.addStyleClass(this.__itemFirst,this.__config.disabledStyle) : \"\";\r\n\t\t\tthis.__itemPrev ? this.util.addStyleClass(this.__itemPrev,this.__config.disabledStyle) : \"\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__itemFirst ? this.util.removeStyleClass(this.__itemFirst,this.__config.disabledStyle) : \"\";\r\n\t\t\tthis.__itemPrev ? this.util.removeStyleClass(this.__itemPrev,this.__config.disabledStyle) : \"\";\r\n\t\t}\r\n\t\tif(pageNumber === this.__pageCount)\r\n\t\t{\r\n\t\t\tthis.__itemNext ? this.util.addStyleClass(this.__itemNext,this.__config.disabledStyle) : \"\";\r\n\t\t\tthis.__itemLast ? this.util.addStyleClass(this.__itemLast,this.__config.disabledStyle) : \"\";\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__itemNext ? this.util.removeStyleClass(this.__itemNext,this.__config.disabledStyle) : \"\";\r\n\t\t\tthis.__itemLast ? this.util.removeStyleClass(this.__itemLast,this.__config.disabledStyle) : \"\";\r\n\t\t};\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__calculateRange = function(totalPages,visiblePages,pageToBeSelected)\r\n\t{\r\n\t\tvar renderPage = [1,totalPages];\r\n\t\tvar limit = Math.floor(visiblePages/2);\r\n\t\tif(visiblePages > 0)\r\n\t\t{\r\n\t\t\trenderPage[0] = Math.max(pageToBeSelected - limit, 1);\r\n\t\t\trenderPage[1] = Math.min(pageToBeSelected + limit, totalPages);\r\n\t\t\tvar difference = renderPage[1] - renderPage[0];\r\n\t\t\tif(renderPage[0] === 1 && difference < visiblePages)\r\n\t\t\t{\r\n\t\t\t\trenderPage[1] = visiblePages;\r\n\t\t\t}\r\n\t\t\telse if(renderPage[1] === totalPages && difference < visiblePages)\r\n\t\t\t{\r\n\t\t\t\trenderPage[0] = renderPage[1] - visiblePages + 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn renderPage;\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__selectPage = function(pageIndex)\r\n\t{\r\n\t\tvar selectedIndex = -1;\r\n\t\tfor(var count = 0;count < this.__arrItemPage.length;count++)\r\n\t\t{\r\n\t\t\tvar pageItem = this.__arrItemPage[count];\r\n\t\t\tthis.util.removeStyleClass(pageItem,this.__config.activeStyle);\r\n\t\t\tvar index = parseInt(pageItem.getAttribute(\"pageNum\"));\r\n\t\t\tif(index === pageIndex)\r\n\t\t\t{\r\n\t\t\t\tselectedIndex = count;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(selectedIndex > -1)\r\n\t\t{\r\n\t\t\tvar oldPage = this.__selectedPage;\r\n\t\t\tthis.util.addStyleClass(this.__arrItemPage[selectedIndex],this.__config.activeStyle);\r\n\t\t\tthis.__selectedPage = pageIndex;\r\n\t\t\tvar fromRecord =  (pageIndex - 1) * this.__config.pageSize;\r\n\t\t\tvar toRecord = fromRecord +  this.__config.pageSize - 1;\r\n\t\t\ttoRecord = (toRecord < this.__config.totalRecords) ? toRecord : ((toRecord === this.__config.totalRecords) ? this.__config.totalRecords - 1 : this.__config.totalRecords);\r\n\t\t\tvar item = {oldIndex:oldPage,newIndex:this.__selectedPage,fromRecord:fromRecord,toRecord:toRecord};\r\n\t\t\tthis.util.dispatchEvent(this.__config.parent,this.PAGE_CLICK,item,item);\r\n\t\t\tif(oldPage !== this.__selectedPage)\r\n\t\t\t{\r\n\t\t\t\tthis.util.dispatchEvent(this.__config.parent,this.PAGE_CHANGE,item,item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSPagination.prototype.__getID = function()\r\n\t{\r\n\t\tif(!this.__id)\r\n\t\t{\r\n\t\t\tif(this.__config.parent.hasAttribute(\"id\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__id = this.__config.parent.getAttribute(\"id\");\r\n\t\t\t}\r\n\t\t\telse if(this.__config.parent.hasAttribute(\"name\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__id = this.__config.parent.getAttribute(\"name\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__id = \"comp\" + this.util.getUniqueId();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.__id;\r\n\t};\r\n\t\r\n\treturn NSPagination;\r\n})();\r\nnsModuleExport(this,\"NSPagination\",NSPagination);\r\nvar NSExport = (function()\r\n{\r\n\t//DONOT REMOVE: taken from https://gist.github.com/sevir/3946819\r\n\tif (window && !window.atob && !window.btoa)\r\n\t{\r\n\t ( function( window ) {\r\n\t    var _PADCHAR = \"=\",\r\n\t      _ALPHA = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n\t   \r\n\t    function _getbyte64( s, i ) { \r\n\t      var idx = _ALPHA.indexOf( s.charAt( i ) );\r\n\t   \r\n\t      if ( idx === -1 ) {\r\n\t        throw \"Cannot decode base64\";\r\n\t      }\r\n\t   \r\n\t      return idx;\r\n\t    }\r\n\t   \r\n\t    function _decode( s ) {\r\n\t      var pads = 0,\r\n\t        i,\r\n\t        b10,\r\n\t        imax = s.length,\r\n\t        x = [];\r\n\t   \r\n\t      s = String( s );\r\n\t   \r\n\t      if ( imax === 0 ) {\r\n\t        return s;\r\n\t      }\r\n\t   \r\n\t      if ( imax % 4 !== 0 ) {\r\n\t        throw \"Cannot decode base64\";\r\n\t      }\r\n\t   \r\n\t      if ( s.charAt( imax - 1 ) === _PADCHAR ) {\r\n\t        pads = 1;\r\n\t   \r\n\t        if ( s.charAt( imax - 2 ) === _PADCHAR ) {\r\n\t          pads = 2;\r\n\t        }\r\n\t   \r\n\t        // either way, we want to ignore this last block\r\n\t        imax -= 4;\r\n\t      }\r\n\t   \r\n\t      for ( i = 0; i < imax; i += 4 ) {\r\n\t        b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 ) | _getbyte64( s, i + 3 );\r\n\t        x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff, b10 & 0xff ) );\r\n\t      }\r\n\t   \r\n\t      switch ( pads ) {\r\n\t        case 1:\r\n\t          b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 );\r\n\t          x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff ) );\r\n\t          break;\r\n\t   \r\n\t        case 2:\r\n\t          b10 = ( _getbyte64( s, i ) << 18) | ( _getbyte64( s, i + 1 ) << 12 );\r\n\t          x.push( String.fromCharCode( b10 >> 16 ) );\r\n\t          break;\r\n\t      }\r\n\t   \r\n\t      return x.join( \"\" );\r\n\t    }\r\n\t   \r\n\t    function _getbyte( s, i ) {\r\n\t      var x = s.charCodeAt( i );\r\n\t   \r\n\t      if ( x > 255 ) {\r\n\t        throw \"INVALID_CHARACTER_ERR: DOM Exception 5\";\r\n\t      }\r\n\t   \r\n\t      return x;\r\n\t    }\r\n\t   \r\n\t    function _encode( s ) {\r\n\t      if ( arguments.length !== 1 ) {\r\n\t        throw \"SyntaxError: exactly one argument required\";\r\n\t      }\r\n\t   \r\n\t      s = String( s );\r\n\t   \r\n\t      var i,\r\n\t        b10,\r\n\t        x = [],\r\n\t        imax = s.length - s.length % 3;\r\n\t   \r\n\t      if ( s.length === 0 ) {\r\n\t        return s;\r\n\t      }\r\n\t   \r\n\t      for ( i = 0; i < imax; i += 3 ) {\r\n\t        b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 ) | _getbyte( s, i + 2 );\r\n\t        x.push( _ALPHA.charAt( b10 >> 18 ) );\r\n\t        x.push( _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) );\r\n\t        x.push( _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) );\r\n\t        x.push( _ALPHA.charAt( b10 & 0x3f ) );\r\n\t      }\r\n\t   \r\n\t      switch ( s.length - imax ) {\r\n\t        case 1:\r\n\t          b10 = _getbyte( s, i ) << 16;\r\n\t          x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _PADCHAR + _PADCHAR );\r\n\t          break;\r\n\t   \r\n\t        case 2:\r\n\t          b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 );\r\n\t          x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) + _PADCHAR );\r\n\t          break;\r\n\t      }\r\n\t   \r\n\t      return x.join(\"\");\r\n\t    }\r\n\t\r\n\t    window.btoa = _encode;\r\n\t    window.atoa = _decode;\r\n\t   \r\n\t  })( window );\r\n\t}\r\n\t\r\n\t\"use strict\"; \r\n\tfunction NSExport(grid,fileName,extPath,ignoreColumn) \r\n\t{\r\n\t\tthis.__grid = grid;\r\n\t\tthis.__fileName = fileName;\r\n\t\tthis.__ignoreColumn = ignoreColumn;\r\n\t\tthis.__extFilePath = extPath ? extPath : \"../lib/com/ext\";\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.__defaultDelimiter = \",\";\r\n\t\tthis.__defaultNewLine = \"\\r\\n\";\r\n\t\tthis.__externalScriptLoad = {jspdf:false,html2canvas:false};\r\n\t}\r\n\t\r\n\t//Orientation: portrait or landscape\r\n\tNSExport.prototype.word = function(setting) \r\n\t{\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(setting.type === \"doc\")\r\n\t\t\t{\r\n\t\t\t\tvar docSetting = {appType:\"doc\",extension:\"doc\",event:setting.event,orientation:setting.orientation,element:setting.element,pageBreakTag:setting.pageBreakTag,headerFooterCss:\"\",startHtml:\"\",endHtml:\"\"};\r\n\t\t\t\tif(setting.hasHeaderOrFooter)\r\n\t            {\r\n\t            \tdocSetting.headerFooterCss = setting.headerFooterCss || \"\";\r\n\t            \tdocSetting.startHtml = setting.startHtml || \"\";\r\n\t            \tdocSetting.endHtml = setting.endHtml || \"\";\r\n\t            }\r\n\t\t\t\tif(setting.enablePageNumber)\r\n\t\t\t\t{\r\n\t\t\t\t\tdocSetting.headerFooterCss += \"p.MsoHeader, li.MsoHeader, div.MsoHeader{     margin:0in;     margin-top:.0001pt;     mso-pagination:widow-orphan;     tab-stops:center 3.0in right 6.0in; } p.MsoFooter, li.MsoFooter, div.MsoFooter{     margin:0in 0in 1in 0in;     margin-bottom:.0001pt;     mso-pagination:widow-orphan;     tab-stops:center 3.0in right 6.0in; } .footer {     font-size: 9pt; } @page Section1{     size:8.5in 11.0in;     margin:0.5in 0.5in 0.5in 0.5in;     mso-header-margin:0.5in;     mso-header:h1;     mso-footer:f1;     mso-footer-margin:0.5in;     mso-paper-source:0; } div.Section1{     page:Section1; } table#hrdftrtbl{     margin:0in 0in 0in 9in; }\";\r\n\t\t\t\t\tdocSetting.startHtml = \"<div class=\\\"Section1\\\">\" + docSetting.startHtml; \r\n\t\t\t\t\tdocSetting.endHtml += \"<table id=\\\"hrdftrtbl\\\" border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\"> <tr> <td> <div style=\\\"mso-element:footer\\\" id=\\\"f1\\\"> <p class=\\\"MsoFooter\\\"> <table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\"> <tr> <td align=\\\"center\\\" class=\\\"footer\\\"> <g:message code=\\\"offer.letter.page.label\\\"/> <span style=\\\"mso-field-code: PAGE \\\"></span> of <span style=\\\"mso-field-code: NUMPAGES \\\"></span> </td> </tr> </table> </p> </div> </td> </tr> </table> </div>\";;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__exportOfficeTypes(docSetting);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(!setting.orientation || (setting.orientation !== \"portrait\" && setting.orientation !== \"landscape\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.warning(\"NSExport\",\"Docx type value was either not valid or not in the correct format.Hence defaulting to portrait\");\r\n\t\t\t\t\tsetting.orientation = \"portrait\";\r\n\t\t\t\t}\r\n\t\t\t\tvar docSetting = {appType:\"doc\",element:setting.element,pageBreakTag:setting.pageBreakTag,headerFooterCss:\"\",startHtml:\"\",endHtml:\"\"};\r\n\t\t\t\tif(setting.hasHeaderOrFooter)\r\n\t            {\r\n\t            \tdocSetting.headerFooterCss = setting.headerFooterCss;\r\n\t            \tdocSetting.startHtml = setting.startHtml;\r\n\t            \tdocSetting.endHtml = setting.endHtml;\r\n\t            }\r\n\t\t\t\tvar htmlText = this.__getHTMLTextForOffice(docSetting);\r\n\t\t\t\tif(htmlText && htmlText.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar fileName = this.__getFileName(\"docx\");\r\n\t\t\t\t\tvar exportSetting = {fileName:fileName,htmlSetting:{html:htmlText,htmlStyle: setting.extraStyle,loopNodesCallback: setting.loopNodesCallback},printSetting:{orientation: setting.orientation}};\r\n\t\t\t\t\tvar docxExport = new NSDocxExport(exportSetting);\r\n\t\t\t\t\tdocxExport.process();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.powerpoint = function(setting) \r\n\t{\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tvar docSetting = {appType:\"powerpoint\",extension:\"ppt\",event:setting.event,element:setting.element};\r\n\t\t\tthis.__exportOfficeTypes(docSetting);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.excel = function(setting) \r\n\t{\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(setting.type === \"xls\")\r\n\t\t\t{\r\n\t\t\t\tvar docSetting = {appType:\"excel\",extension:\"xls\",sheetName:setting.sheetName,event:setting.event,element:setting.element,properties:setting.properties};\r\n\t\t\t\tthis.__exportOfficeTypes(docSetting);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar objXslxExport = new this.xslxExport(this,setting.sheetName,setting.event,setting.properties);\r\n\t\t\t\tobjXslxExport.exportToxlsx();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.csv = function(event) \r\n\t{ \r\n\t\tvar csvText = this.__getTableAsString(this.__defaultDelimiter,this.__defaultNewLine);\r\n\t\tif(csvText)\r\n\t\t{\r\n\t\t\tvar uri = \"application/csv\";\r\n\t\t\tthis.__downloadFile(csvText,uri,\"csv\",event);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.xml = function(event) \r\n\t{ \r\n\t\tvar xmlText = this.__getTableAsXML();\r\n\t\tif(xmlText)\r\n\t\t{\r\n\t\t\tvar uri = \"application/xml\";\r\n\t\t\tthis.__downloadFile(xmlText,uri,\"xml\",event);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.text = function(event) \r\n\t{ \r\n\t\tvar csvText = this.__getTableAsString(this.__defaultDelimiter,this.__defaultNewLine,\"-\");\r\n\t\tif(csvText)\r\n\t\t{\r\n\t\t\tvar uri = \"application/txt\";\r\n\t\t\tthis.__downloadFile(csvText,uri,\"txt\",event);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.json = function(event) \r\n\t{ \r\n\t\tvar jsonText = this.__getTableAsJson();\r\n\t\tif(jsonText)\r\n\t\t{\r\n\t\t\tvar uri = \"application/json\";\r\n\t\t\tthis.__downloadFile(jsonText,uri,\"json\",event);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.pdf = function(event,setting) \r\n\t{ \r\n\t\tthis.__processPDF = function()\r\n\t\t{\r\n\t\t\tthis.__externalScriptLoad.jspdf = true;\r\n\t\t\tif(!setting)\r\n\t\t\t{\r\n\t\t\t\tsetting = {};\r\n\t\t\t}\r\n\t\t\tvar config = {\r\n\t\t\t\t\tfontSize: setting[\"fontSize\"] || 14,\r\n\t\t\t\t\twidth: setting[\"width\"] || 1200,\r\n\t\t\t\t\ttopMargin: setting[\"topMargin\"] || 30,\r\n\t\t\t\t\tbottomMargin: setting[\"bottomMargin\"] || 60,\r\n\t\t\t\t\tleftMargin: setting[\"leftMargin\"] || 60,\r\n\t\t\t\t\tmaxWidth: setting[\"maxWidth\"] || 550\r\n\t\t\t};\r\n\t\t\tvar divSource = this.__getStructureForPDF(config.width,config.fontSize);\r\n\t\t\tdocument.body.appendChild(divSource);\r\n\t\t\tvar pdf = new jsPDF(\"p\", \"pt\", \"ledger\");\r\n\t\t\t// we support special element handlers. Register them with jQuery-style \r\n\t\t    // ID selector for either ID or node name. (\"#iAmID\", \"div\", \"span\" etc.)\r\n\t\t    // There is no support for any other type of selectors \r\n\t\t    // (class, of compound) at this time.\r\n\t\t\tspecialElementHandlers = \r\n\t\t\t{\r\n\t\t        // element with id of \"bypass\" - jQuery style selector\r\n\t\t        '#bypassme' : function(element, renderer) {\r\n\t\t            // true = \"handled elsewhere, bypass text extraction\"\r\n\t\t            return true;\r\n\t\t        }\r\n\t\t    };\r\n\t\t    margins = {\r\n\t\t        top : config.topMargin,\r\n\t\t        bottom : config.bottomMargin,\r\n\t\t        left : config.leftMargin,\r\n\t\t        width : config.maxWidth\r\n\t\t    };\r\n\t\t    var self =  this;\r\n\t\t    // all coords and widths are in jsPDF instance's declared units\r\n\t\t    // 'inches' in this case\r\n\t\t    pdf.fromHTML(divSource, // HTML string or DOM elem ref.\r\n\t\t    margins.left, // x coord\r\n\t\t    margins.top, { // y coord\r\n\t\t        'width' : margins.width, // max width of content on PDF\r\n\t\t        'elementHandlers' : specialElementHandlers\r\n\t\t    },\r\n\t\r\n\t\t    function(dispose) {\r\n\t\t        // dispose: object with X, Y of the last line add to the PDF \r\n\t\t        //          this allow the insertion of new lines after html\r\n\t\t        pdf.save(self.__getFileName(\"pdf\"));\r\n\t\t\t\tdocument.body.removeChild(divSource);\r\n\t\t    }, margins);\r\n\t\t};\r\n\t\tif(!this.__externalScriptLoad.jspdf)\r\n\t\t{\r\n\t\t\tthis.__includeJavaScriptFile(this.__extFilePath + \"/jspdf/jspdf.min.js\",this.__processPDF.bind(this));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__processPDF.bind(this)();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.image = function(setting) \r\n\t{\r\n\t\tif(!setting)\r\n\t\t{\r\n\t\t\tsetting = {};\r\n\t\t}\r\n\t\tthis.__processImage = function()\r\n\t\t{\r\n\t\t\tthis.__externalScriptLoad.html2canvas = true;\r\n\t\t\tif(!setting.type || (setting.type !== \"png\" && setting.type !== \"jpeg\"))\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSExport\",\"Image type value was either not valid or not in the correct format.Hence defaulting to png\");\r\n\t\t\t\tsetting.type = \"png\";\r\n\t\t\t}\r\n\t\t\tvar imageType = \"image/\" + setting.type; \r\n\t\t\tvar divParent = this.__getStructureForImage();\r\n\t\t\tif(divParent)\r\n\t\t\t{\r\n\t\t\t\tvar nsExport = this;\r\n\t\t\t\thtml2canvas(divParent,{\r\n\t\t\t\t\tonrendered: function(canvas) {\t\t\r\n\t\t\t\t\t\t//document.body.appendChild(canvas);\r\n\t\t\t\t\t\tvar data = canvas.toDataURL(imageType);\r\n\t\t\t\t\t\tif(!data || data === \"data:,\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tnsExport.util.throwNSError(\"NSExport\",\"Please give table some width and height\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tnsExport.__downloadFile(data,imageType,setting.type);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\t\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSExport\",\"Please add the table inside a parent Element\");\r\n\t\t\t}\r\n\t\t};\r\n\t\tif(!this.__externalScriptLoad.html2canvas)\r\n\t\t{\r\n\t\t\tthis.__includeJavaScriptFile(this.__extFilePath + \"/html2canvas/html2canvas.min.js\",this.__processImage.bind(this));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__processImage.bind(this)();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.__exportOfficeTypes = function(setting) \r\n\t{\r\n\t\tvar htmlText = this.__getHTMLTextForOffice(setting);\r\n\t\tif(htmlText && htmlText.length > 0)\r\n\t\t{\r\n\t\t\tvar uri = \"application/vnd.ms-\" + setting.appType;\r\n\t\t\tif(setting.extension === \"doc\")\r\n\t\t\t{\r\n\t\t\t\turi = \"application/msword\";\r\n\t\t\t}\r\n\t\t\tthis.__downloadFile(htmlText,uri,setting.extension,setting.event);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getHTMLTextForOffice = function(setting) \r\n\t{\r\n\t\tvar appType = setting.appType;\r\n\t\tvar element = setting.element;\r\n\t\tvar headerFooterCss = setting.headerFooterCss ? setting.headerFooterCss : \"\";\r\n\t    var startHtml = setting.startHtml ? setting.startHtml : \"\";\r\n\t    var endHtml = setting.endHtml ? setting.endHtml : \"\";\r\n\t\tvar htmlText = \"\";\r\n\t\tvar outerHTML = null;\r\n\t\tvar isTable =  false;\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\touterHTML = element.outerHTML;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar table = this.__getTable();\r\n\t\t\tif(table)\r\n\t\t\t{\r\n\t\t\t\touterHTML = table.outerHTML;\r\n\t\t\t}\r\n\t\t\tisTable = true;\r\n\t\t}\r\n\t\tvar objValue = {};\r\n\t\tswitch(appType)\r\n\t\t{\r\n\t\t\tcase \"doc\":\r\n\t\t\t\tobjValue = this.__getHTMLTextForWord(setting,outerHTML,isTable);\r\n\t\t\tbreak;\r\n\t\t\tcase \"excel\":\r\n\t\t\t\tobjValue = this.__getHTMLTextForExcel(setting,outerHTML,isTable);\r\n\t\t\tbreak;\r\n\t\t\tcase \"powerpoint\":\r\n\t\t\t\tobjValue = this.__getHTMLTextForPpt(setting,outerHTML,isTable);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif(outerHTML)\r\n\t\t{\r\n\t\t\tobjValue.style = (objValue.style) ? objValue.style : \"\";\r\n\t\t\thtmlText = '<html  xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:' + appType +'\" xmlns=\"http://www.w3.org/TR/REC-html40\">';\r\n\t\t\thtmlText += '<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">';\r\n\t\t\thtmlText +='<!--[if gte mso 9]><xml>';\r\n\t\t\thtmlText += objValue.header;\r\n\t\t\thtmlText += '</xml><![endif]-->';\r\n\t\t    //htmlText +=\"<o:shapedefaults v:ext=\\\"edit\\\" spidmax=\\\"1026\\\"/>\";\r\n\t\t\thtmlText += '<style>' + objValue.style + headerFooterCss + '.header{mso-style-parent:style0;color:white;font-size:10.0pt;font-weight:700;font-family:Tahoma, sans-serif;mso-font-charset:0;text-align:center;background:gray;mso-pattern:black none;}</style>';\r\n\t\t\thtmlText += '</head>';\r\n\t\t\thtmlText += '<body link=\"blue\" vlink=\"purple\">';\r\n\t\t\thtmlText += startHtml + objValue.html + endHtml;\r\n\t\t\thtmlText += '</body></html>';\r\n\t\t}\r\n\t\treturn htmlText;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getHTMLTextForWord = function(setting,html,isTable)\r\n\t{\r\n\t\tvar objReturn = {header:null,style:null,html:html};\r\n\t\tobjReturn.header = \"<w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom><w:DoNotOptimizeForBrowser/></w:WordDocument>\";\r\n\t\tif(isTable)\r\n\t\t{\r\n\t\t\tobjReturn.style = 'table{border-collapse: collapse;} table, th, td {border: 1px solid black;} ';\r\n\t\t}\r\n\t\tif(setting[\"pageBreakTag\"])\r\n\t\t{\r\n\t\t\tobjReturn.html = objReturn.html.replaceAll(setting[\"pageBreakTag\"],\"<br clear=all style='mso-special-character:line-break;page-break-before:always'>\");\r\n\t\t}\r\n\t\treturn objReturn;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getHTMLTextForExcel = function(setting,html,isTable)\r\n\t{\r\n\t\tvar objReturn = {header:null,style:null,html:html};\r\n\t\tobjReturn.header = \"<x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>\";\r\n\t\tobjReturn.header += (setting[\"sheetName\"] ? setting[\"sheetName\"]: ((this.__fileName ? this.__fileName : \"Sheet 1\")));\r\n\t\tobjReturn.header += '</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook>';\r\n\t\treturn objReturn;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getHTMLTextForPpt = function(setting,html,isTable)\r\n\t{\r\n\t\tvar objReturn = {header:null,style:null,html:html};\r\n\t\tobjReturn.header = \"<x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>\";\r\n\t\tobjReturn.header += (setting[\"sheetName\"] ? setting[\"sheetName\"]: ((this.__fileName ? this.__fileName : \"Sheet 1\")));\r\n\t\tobjReturn.header += '</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook>';\r\n\t\treturn objReturn;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__downloadFile = function(text,uri,fileType,event) \r\n\t{\r\n\t\tif(text && fileType)\r\n\t\t{\r\n\t\t\tif (\"Blob\" in window) \r\n\t\t\t{\r\n\t\t\t\tvar fileName = this.__getFileName(fileType);\r\n\t\t\t\tif (\"msSaveOrOpenBlob\" in window.navigator) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar blobObject = null;\r\n\t\t\t\t\tif(text instanceof Blob)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tblobObject = text;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(!(text instanceof ArrayBuffer) && text.indexOf(\"base64\") > -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tblobObject = this.__dataURItoBlob(text);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tblobObject = new Blob([text], { type: uri});\r\n\t\t\t\t\t}\r\n\t\t\t\t\twindow.navigator.msSaveOrOpenBlob(blobObject,fileName);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar hrefvalue = null;\r\n\t\t\t\t\tif(text instanceof ArrayBuffer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar blobObject = new Blob([text], {type: uri});\r\n\t\t\t\t\t\threfvalue = URL.createObjectURL(blobObject);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(text instanceof Blob)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\threfvalue = URL.createObjectURL(text);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(text.indexOf(\"data:\") === -1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\turi = \"data:\" + uri;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(text.indexOf(\";base64,\") === -1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar base64String = \";base64,\" + window.btoa(window.unescape(encodeURIComponent(text)));\r\n\t\t\t\t\t\t\threfvalue = uri + base64String;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\threfvalue = text;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t    var anchor = document.createElement(\"a\");\r\n\t\t\t\t    if (\"webkitURL\" in window) \r\n\t\t\t\t    {\r\n\t\t\t\t          // Chrome allows the link to be clicked without actually adding it to the DOM.\r\n\t\t\t\t    \t//hrefvalue = window.webkitURL.createObjectURL([hrefvalue]);\r\n\t\t\t\t    }\r\n\t\t\t\t    else\r\n\t\t\t\t    {\r\n\t\t\t\t    \t//hrefvalue = window.URL.createObjectURL([hrefvalue]);\r\n\t\t\t\t    \tanchor.style.display = 'none';\r\n\t\t\t\t        document.body.appendChild(anchor);\r\n\t\t\t\t        this.util.addEvent(anchor,\"click\",function(event){\r\n\t\t\t\t    \t\tdocument.body.removeChild(event.target);\r\n\t\t\t\t    \t});\r\n\t\t\t\t    }\r\n\t\t\t\t    anchor.setAttribute(\"href\",hrefvalue);\r\n\t\t\t\t    anchor.setAttribute(\"download\",this.__getFileName(fileType));\r\n\t\t\t\t    anchor.setAttribute(\"target\",\"_blank\");\r\n\t\t\t\t    anchor.innerHTML = \"Download File\";\r\n\t\t\t\t    /*if(window.URL && window.URL.revokeObjectURL)\r\n\t\t\t\t    {\r\n\t\t\t\t    \twindow.URL.revokeObjectURL(hrefvalue);\r\n\t\t\t\t    }*/\r\n\t\t\t\t    anchor.click();\r\n\t\t\t\t    if(event)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tthis.util.preventDefault(event);\r\n\t\t\t\t    }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getTable = function() \r\n\t{ \r\n\t\tvar tblResult = null;\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t\t\tvar tblHeader = grid.__tblCenterHeader;\r\n\t\t    \tvar tblBody = grid.__tblCenterBody;\r\n\t\t    \ttblResult = document.createElement(\"TABLE\");\r\n\t\t    \ttblResult.style.width = tblHeader.style.width;\r\n\t\t    \tif(tblHeader && tblHeader.tBodies && tblHeader.tBodies.length > 0 && tblHeader.tBodies[0].rows && tblHeader.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tvar arrColumns = grid.__columns;\r\n\t\t    \t\tif(grid.gridType === grid.GRID_TYPE_GROUP)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrColumns = grid.util.cloneObject(arrColumns);\r\n\t\t\t\t\t\tarrColumns.splice(0, 1);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar header = tblResult.createTHead();\r\n\t\t    \t\tvar headerRow = header.insertRow(-1);\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t\t        for(colIndex = 0; colIndex < arrColumns.length; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = arrColumns[colIndex];\r\n\t\t\t        \tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t        \t{\r\n\t\t\t        \t\tvar headerCell = headerRow.insertCell(-1);\r\n\t\t\t        \t\tthis.util.addStyleClass(headerCell,\"header\");\r\n\t\t\t\t    \t\theaderCell.style.width = colItem[\"width\"]; \r\n\t\t\t\t    \t\tvar headerText = colItem[\"headerText\"];\r\n\t\t\t\t    \t\theaderCell.appendChild(document.createTextNode(headerText));\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        if(tblBody && tblBody.tBodies && tblBody.tBodies.length > 0 && tblBody.tBodies[0].rows && tblBody.tBodies[0].rows.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t        \tvar arrItems = grid.__getAllItems();\r\n\t\t\t        \tvar body = document.createElement(\"tbody\");\r\n\t\t\t        \ttblResult.appendChild(body);\r\n\t\t\t        \tvar colText = \"\";\r\n\t\t\t        \tvar row = null;\r\n\t\t\t        \tfor(rowIndex = 0;rowIndex < arrItems.length;rowIndex++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tvar item = arrItems[rowIndex];\r\n\t\t\t        \t\tif(!item.hasOwnProperty(grid.__fieldRowVisible) || item[grid.__fieldRowVisible])\r\n\t\t\t        \t\t{\r\n\t\t\t\t        \t\tvar bodyRow = body.insertRow(-1);\r\n\t\t\t\t        \t\tfor(colIndex = 0;colIndex < arrColumns.length;colIndex++)\r\n\t\t\t\t    \t        {\r\n\t\t\t\t        \t\t\tvar colItem = arrColumns[colIndex];\r\n\t\t\t\t        \t\t\tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t\t    \t        \t{\r\n\t\t\t\t        \t\t\t\tcolText = item[colItem[\"dataField\"]];\r\n\t\t\t\t\t\t\t\t\t\tif(colItem.hasOwnProperty(\"exportRenderer\"))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tcolText = colItem[\"exportRenderer\"](item,colItem[\"dataField\"],item[grid.__fieldIndex],count);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t        \t\t\t\tvar bodyCell = bodyRow.insertCell(-1);\r\n\t\t\t\t\t        \t\t\tbodyCell.style.width = colItem[\"width\"]; \r\n\t\t\t\t\t    \t    \t\tbodyCell.innerHTML = colText;\r\n\t\t\t\t    \t        \t}\r\n\t\t\t\t    \t        }\r\n\t\t\t        \t\t}\r\n\t\t\t \t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttblResult = this.__grid.cloneNode(true);\r\n\t\t\t\tif(tblResult.tHead && tblResult.tHead.rows && tblResult.tHead.rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerRow = tblResult.tHead.rows[0];\r\n\t\t\t\t\tif(headerRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrCells = [];\r\n\t\t\t\t\t\tvar arrTempCells = [];\r\n\t\t\t\t\t\tif(headerRow.getElementsByTagName(\"th\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrTempCells = headerRow.getElementsByTagName(\"th\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(headerRow.getElementsByTagName(\"td\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrTempCells = headerRow.getElementsByTagName(\"td\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tarrCells = Array.prototype.slice.call(arrTempCells).slice(0);\r\n\t\t\t    \t\tvar colIndex = 0;\r\n\t\t\t    \t\tvar cell = null;\r\n\t\t\t    \t\tfor(colIndex = arrCells.length - 1; colIndex >= 0; colIndex--)\r\n\t\t\t\t        {\r\n\t\t\t    \t\t\theaderRow.deleteCell(colIndex);\r\n\t\t\t\t        }\r\n\t\t\t\t        for(colIndex = 0; colIndex < arrCells.length; colIndex++)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tcell = arrCells[colIndex];\r\n\t\t\t\t        \tvar headerCell = headerRow.insertCell(-1);\r\n\t\t\t\t        \theaderCell.style.width = cell.offsetWidth + \"px\";\r\n\t\t\t\t        \theaderCell.color = \"red\";\r\n\t\t\t\t        \theaderCell.appendChild(document.createTextNode(cell.textContent.trim()));\r\n\t\t\t\t        \tthis.util.addStyleClass(headerCell,\"header\");\r\n\t\t\t\t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(tblResult)\r\n\t\t\t{\r\n\t\t\t\ttblResult.setAttribute(\"border\",0);\r\n\t\t    \ttblResult.setAttribute(\"cellpadding\",0);\r\n\t\t    \ttblResult.setAttribute(\"cellspacing\",0);\r\n\t\t    \ttblResult.setAttribute(\"style\",\"border-collapse:collapse;table-layout:fixed;\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn tblResult;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getTableAsString = function(delimiter,newLine,headerSeparator) \r\n\t{ \r\n\t\tvar strResult = \"\";\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t\t\tvar tblHeader = grid.__tblCenterHeader;\r\n\t\t    \tvar tblBody = grid.__tblCenterBody;\r\n\t\t    \tif(tblHeader && tblHeader.tBodies && tblHeader.tBodies.length > 0 && tblHeader.tBodies[0].rows && tblHeader.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tvar arrColumns = grid.__columns;\r\n\t\t    \t\tif(grid.gridType === grid.GRID_TYPE_GROUP)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrColumns = grid.util.cloneObject(arrColumns);\r\n\t\t\t\t\t\tarrColumns.splice(0, 1);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tvar cell = null;\r\n\t\t    \t\tvar arrCollItem = [];\r\n\t\t\t        for(colIndex = 0; colIndex < arrColumns.length; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = arrColumns[colIndex];\r\n\t\t\t        \tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t        \t{\r\n\t\t\t\t    \t\tvar headerText = colItem[\"headerText\"];\r\n\t\t\t\t    \t\tif(colIndex > 0)\r\n\t\t\t\t    \t\t{\r\n\t\t\t\t    \t\t\tstrResult += delimiter;\r\n\t\t\t\t    \t\t}\r\n\t\t\t\t    \t\tstrResult += this.__getFieldValue(headerText,delimiter);\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        strResult += newLine;\r\n\t\t\t        if(headerSeparator)\r\n\t\t\t        {\r\n\t\t\t        \tvar separatorLength = strResult.length + 20;\r\n\t\t\t        \tfor(var count = 0;count < separatorLength;count++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tstrResult += headerSeparator;\r\n\t\t\t \t        }\r\n\t\t\t        \tstrResult += newLine;\r\n\t\t\t        }\r\n\t\t\t        if(tblBody && tblBody.tBodies && tblBody.tBodies.length > 0 && tblBody.tBodies[0].rows && tblBody.tBodies[0].rows.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t        \tvar arrItems = grid.__getAllItems();\r\n\t\t\t        \tvar colText = \"\";\r\n\t\t\t        \tfor(rowIndex = 0;rowIndex < arrItems.length;rowIndex++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tvar item = arrItems[rowIndex];\r\n\t\t\t        \t\tif(!item.hasOwnProperty(grid.__fieldRowVisible) || item[grid.__fieldRowVisible])\r\n\t\t\t        \t\t{\r\n\t\t\t\t        \t\tfor(colIndex = 0;colIndex < arrColumns.length;colIndex++)\r\n\t\t\t\t    \t        {\r\n\t\t\t\t        \t\t\tvar colItem = arrColumns[colIndex];\r\n\t\t\t\t        \t\t\tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t\t    \t        \t{\r\n\t\t\t\t        \t\t\t\tif(colIndex > 0)\r\n\t\t\t\t\t\t\t    \t\t{\r\n\t\t\t\t\t\t\t    \t\t\tstrResult += delimiter;\r\n\t\t\t\t\t\t\t    \t\t}\r\n\t\t\t\t        \t\t\t\tcolText = item[colItem[\"dataField\"]];\r\n\t\t\t\t\t\t\t\t\t\tif(colItem.hasOwnProperty(\"exportRenderer\"))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tcolText = colItem[\"exportRenderer\"](item,colItem[\"dataField\"],item[grid.__fieldIndex],count);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t        \t\t\t\tstrResult += this.__getFieldValue(colText,delimiter);\r\n\t\t\t\t    \t        \t}\r\n\t\t\t\t    \t        }\r\n\t\t\t\t        \t\tstrResult += newLine;\r\n\t\t\t        \t\t}\r\n\t\t\t \t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.__grid.tHead && this.__grid.tHead.rows && this.__grid.tHead.rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerRow = this.__grid.tHead.rows[0];\r\n\t\t\t\t\tif(headerRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrCells = [];\r\n\t\t\t\t\t\tif(headerRow.getElementsByTagName(\"th\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"th\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(headerRow.getElementsByTagName(\"td\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"td\");\r\n\t\t\t\t\t\t}\r\n\t\t\t    \t\tvar colIndex = 0;\r\n\t\t\t    \t\tvar cell = null;\r\n\t\t\t\t        for(colIndex = 0; colIndex < arrCells.length; colIndex++)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t\t\t        \tcell = arrCells[colIndex];\r\n\t\t\t\t\t    \t\tvar headerText = cell.textContent.trim();\r\n\t\t\t\t\t    \t\tif(colIndex > 0)\r\n\t\t\t\t\t    \t\t{\r\n\t\t\t\t\t    \t\t\tstrResult += delimiter;\r\n\t\t\t\t\t    \t\t}\r\n\t\t\t\t\t    \t\tstrResult += this.__getFieldValue(headerText,delimiter);\r\n\t\t\t\t        \t}\r\n\t\t\t\t        }\r\n\t\t\t\t        strResult += newLine;\r\n\t\t\t\t        if(headerSeparator)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tvar separatorLength = strResult.length + 20;\r\n\t\t\t\t        \tfor(var count = 0;count < separatorLength;count++)\r\n\t\t\t\t \t        {\r\n\t\t\t\t        \t\tstrResult += headerSeparator;\r\n\t\t\t\t \t        }\r\n\t\t\t\t        \tstrResult += newLine;\r\n\t\t\t\t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__grid.tBodies && this.__grid.tBodies.length > 0 && this.__grid.tBodies[0].rows && this.__grid.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrRows = this.__grid.tBodies[0].rows;\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tfor(rowIndex = 0;rowIndex < arrRows.length;rowIndex++)\r\n\t\t \t        {\r\n\t\t        \t\tvar row = arrRows[rowIndex];\r\n\t\t        \t\tvar cells = row.cells;\r\n\t\t        \t\tfor(colIndex = 0;colIndex < cells.length;colIndex++)\r\n\t\t    \t        {\r\n\t\t        \t\t\tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t        \t\t\tvar cell = cells[colIndex];\r\n\t\t\t        \t\t\tif(colIndex > 0)\r\n\t\t\t\t\t    \t\t{\r\n\t\t\t\t\t    \t\t\tstrResult += delimiter;\r\n\t\t\t\t\t    \t\t}\r\n\t\t\t        \t\t\tstrResult += this.__getFieldValue(cell.textContent.trim());\r\n\t\t\t\t        \t}\r\n\t\t    \t        }\r\n\t\t        \t\tstrResult += newLine;\r\n\t\t \t        }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn strResult;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getTableAsXML = function() \r\n\t{ \r\n\t\tvar strXML = \"\";\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tstrXML = '<?xml version=\"1.0\" encoding=\"utf-8\"?>';\r\n\t\t\tstrXML += '<root>';\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t\t\tvar tblHeader = grid.__tblCenterHeader;\r\n\t\t    \tvar tblBody = grid.__tblCenterBody;\r\n\t\t    \tif(tblHeader && tblHeader.tBodies && tblHeader.tBodies.length > 0 && tblHeader.tBodies[0].rows && tblHeader.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tstrXML += '<columns>';\r\n\t\t    \t\tvar arrColumns = grid.__columns;\r\n\t\t    \t\tif(grid.gridType === grid.GRID_TYPE_GROUP)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrColumns = grid.util.cloneObject(arrColumns);\r\n\t\t\t\t\t\tarrColumns.splice(0, 1);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tvar cell = null;\r\n\t\t    \t\tvar arrCollItem = [];\r\n\t\t\t        for(colIndex = 0; colIndex < arrColumns.length; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = arrColumns[colIndex];\r\n\t\t\t        \tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t        \t{\r\n\t\t\t\t    \t\tvar headerText = colItem[\"headerText\"];\r\n\t\t\t\t    \t\tstrXML += \"<column>\" + headerText + \"</column>\";\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        strXML += '</columns>';\r\n\t\t\t        if(tblBody && tblBody.tBodies && tblBody.tBodies.length > 0 && tblBody.tBodies[0].rows && tblBody.tBodies[0].rows.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t        \tstrXML += '<rows>';\r\n\t\t\t        \tvar arrItems = grid.__getAllItems();\r\n\t\t\t        \tvar colText = \"\";\r\n\t\t\t        \tvar rowCounter = 1;\r\n\t\t\t        \tfor(rowIndex = 0;rowIndex < arrItems.length;rowIndex++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tvar item = arrItems[rowIndex];\r\n\t\t\t        \t\tif(!item.hasOwnProperty(grid.__fieldRowVisible) || item[grid.__fieldRowVisible])\r\n\t\t\t        \t\t{\r\n\t\t\t        \t\t\tstrXML += '<row id=\"row-'+ rowCounter++ +'\">';\r\n\t\t\t\t\t\t\t\tvar colCounter = 1;\r\n\t\t\t\t        \t\tfor(colIndex = 0;colIndex < arrColumns.length;colIndex++)\r\n\t\t\t\t    \t        {\r\n\t\t\t\t        \t\t\tvar colItem = arrColumns[colIndex];\r\n\t\t\t\t        \t\t\tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t\t    \t        \t{\r\n\t\t\t\t        \t\t\t\tcolText = item[colItem[\"dataField\"]];\r\n\t\t\t\t\t\t\t\t\t\tif(colItem.hasOwnProperty(\"exportRenderer\"))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tcolText = colItem[\"exportRenderer\"](item,colItem[\"dataField\"],item[grid.__fieldIndex],count);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t        \t\t\t\tstrXML += '<column id=\"column-'+ colCounter++ +'\">';\r\n\t\t\t\t        \t\t\t\tstrXML += colText;\r\n\t\t\t\t        \t\t\t\tstrXML += '</column>';\r\n\t\t\t\t    \t        \t}\r\n\t\t\t\t    \t        }\r\n\t\t\t\t        \t\tstrXML += '</row>';\r\n\t\t\t        \t\t}\r\n\t\t\t \t        }\r\n\t\t\t        \tstrXML += '</rows>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.__grid.tHead && this.__grid.tHead.rows && this.__grid.tHead.rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerRow = this.__grid.tHead.rows[0];\r\n\t\t\t\t\tif(headerRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrCells = [];\r\n\t\t\t\t\t\tif(headerRow.getElementsByTagName(\"th\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"th\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(headerRow.getElementsByTagName(\"td\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"td\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstrXML += '<columns>';\r\n\t\t\t    \t\tvar colIndex = 0;\r\n\t\t\t    \t\tvar cell = null;\r\n\t\t\t\t        for(colIndex = 0; colIndex < arrCells.length; colIndex++)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t\t\t        \tcell = arrCells[colIndex];\r\n\t\t\t\t\t        \tstrXML += \"<column>\" + cell.textContent.trim() + \"</column>\";\r\n\t\t\t\t        \t}\r\n\t\t\t\t        }\r\n\t\t\t\t        strXML += '</columns>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__grid.tBodies && this.__grid.tBodies.length > 0 && this.__grid.tBodies[0].rows && this.__grid.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrRows = this.__grid.tBodies[0].rows;\r\n\t\t\t\t\tstrXML += '<rows>';\r\n\t\t        \tvar rowCounter = 1;\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tfor(rowIndex = 0;rowIndex < arrRows.length;rowIndex++)\r\n\t\t \t        {\r\n\t\t    \t\t\tstrXML += '<row id=\"row-'+ rowCounter++ +'\">';\r\n\t\t    \t\t\tvar colCounter = 1;\r\n\t\t        \t\tvar row = arrRows[rowIndex];\r\n\t\t        \t\tvar cells = row.cells;\r\n\t\t        \t\tfor(colIndex = 0;colIndex < cells.length;colIndex++)\r\n\t\t    \t        {\r\n\t\t        \t\t\tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t        \t\t\tvar cell = cells[colIndex];\r\n\t\t\t        \t\t\tstrXML += '<column id=\"column-'+ colCounter++ +'\">';\r\n\t\t        \t\t\t\tstrXML += cell.textContent.trim();\r\n\t\t        \t\t\t\tstrXML += '</column>';\r\n\t\t\t\t        \t}\r\n\t\t    \t        }\r\n\t\t        \t\tstrXML += '</row>';\r\n\t\t \t        }\r\n\t\t    \t\tstrXML += '</rows>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tstrXML += '</root>';\r\n\t\t}\r\n\t\treturn strXML;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getTableAsJson = function() \r\n\t{ \r\n\t\tvar retValue = { columns: [], rows: [] };\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t\t\tvar tblHeader = grid.__tblCenterHeader;\r\n\t\t    \tvar tblBody = grid.__tblCenterBody;\r\n\t\t    \tif(tblHeader && tblHeader.tBodies && tblHeader.tBodies.length > 0 && tblHeader.tBodies[0].rows && tblHeader.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tvar arrColumns = grid.__columns;\r\n\t\t    \t\tif(grid.gridType === grid.GRID_TYPE_GROUP)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrColumns = grid.util.cloneObject(arrColumns);\r\n\t\t\t\t\t\tarrColumns.splice(0, 1);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t\t        for(colIndex = 0; colIndex < arrColumns.length; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = arrColumns[colIndex];\r\n\t\t\t        \tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t        \t{\r\n\t\t\t\t    \t\tvar headerText = colItem[\"headerText\"];\r\n\t\t\t\t    \t\tretValue.columns.push(headerText);\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        if(tblBody && tblBody.tBodies && tblBody.tBodies.length > 0 && tblBody.tBodies[0].rows && tblBody.tBodies[0].rows.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t        \tvar arrItems = grid.__getAllItems();\r\n\t\t\t        \tvar colText = \"\";\r\n\t\t\t        \tfor(rowIndex = 0;rowIndex < arrItems.length;rowIndex++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tvar item = arrItems[rowIndex];\r\n\t\t\t        \t\tif(!item.hasOwnProperty(grid.__fieldRowVisible) || item[grid.__fieldRowVisible])\r\n\t\t\t        \t\t{\r\n\t\t\t\t        \t\tvar rowData = [];\r\n\t\t\t\t        \t\tfor(colIndex = 0;colIndex < arrColumns.length;colIndex++)\r\n\t\t\t\t    \t        {\r\n\t\t\t\t        \t\t\tvar colItem = arrColumns[colIndex];\r\n\t\t\t\t        \t\t\tif(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"])))\r\n\t\t\t\t    \t        \t{\r\n\t\t\t\t        \t\t\t\tcolText = item[colItem[\"dataField\"]];\r\n\t\t\t\t\t\t\t\t\t\tif(colItem.hasOwnProperty(\"exportRenderer\"))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tcolText = colItem[\"exportRenderer\"](item,colItem[\"dataField\"],item[grid.__fieldIndex],count);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\trowData.push(colText ? colText : \"\");\r\n\t\t\t\t    \t        \t}\r\n\t\t\t\t    \t        }\r\n\t\t\t\t        \t\tretValue.rows.push(rowData);\r\n\t\t\t        \t\t}\r\n\t\t\t \t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.__grid.tHead && this.__grid.tHead.rows && this.__grid.tHead.rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerRow = this.__grid.tHead.rows[0];\r\n\t\t\t\t\tif(headerRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrCells = [];\r\n\t\t\t\t\t\tif(headerRow.getElementsByTagName(\"th\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"th\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(headerRow.getElementsByTagName(\"td\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"td\");\r\n\t\t\t\t\t\t}\r\n\t\t\t    \t\tvar colIndex = 0;\r\n\t\t\t    \t\tvar cell = null;\r\n\t\t\t\t        for(colIndex = 0; colIndex < arrCells.length; colIndex++)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t\t\t        \tcell = arrCells[colIndex];\r\n\t\t\t\t\t        \tretValue.columns.push(typeof cell !== \"undefined\" ? cell.textContent.trim() : \"\");\r\n\t\t\t\t        \t}\r\n\t\t\t\t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__grid.tBodies && this.__grid.tBodies.length > 0 && this.__grid.tBodies[0].rows && this.__grid.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrRows = this.__grid.tBodies[0].rows;\r\n\t\t        \tvar rowCounter = 1;\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tfor(rowIndex = 0;rowIndex < arrRows.length;rowIndex++)\r\n\t\t \t        {\r\n\t\t        \t\tvar row = arrRows[rowIndex];\r\n\t\t        \t\tvar style = window.getComputedStyle(row);\r\n\t\t        \t\tif (style.display !== \"none\") \r\n\t\t        \t\t{\r\n\t\t        \t\t\tvar rowData = [];\r\n\t\t\t        \t\tvar cells = row.cells;\r\n\t\t\t        \t\tfor(colIndex = 0;colIndex < cells.length;colIndex++)\r\n\t\t\t    \t        {\r\n\t\t\t        \t\t\tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t\t        \t{\r\n\t\t\t\t        \t\t\tvar cell = cells[colIndex];\r\n\t\t\t\t        \t\t\trowData.push(typeof cell !== \"undefined\" ? cell.textContent.trim() : \"\");\r\n\t\t\t\t\t        \t}\r\n\t\t\t    \t        }\r\n\t\t\t        \t\tretValue.rows.push(rowData);\r\n\t\t        \t\t}\r\n\t\t \t        }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn JSON.stringify(retValue);\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getTableAsArray = function() \r\n\t{ \r\n\t\tvar arrSource = [];\r\n\t\tvar arrColumns = [];\r\n\t\tvar util = this.util;\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t    \tif(grid.__columns && grid.__columns.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tvar arrColumnsTemp = grid.util.cloneObject(grid.__columns,true);\r\n\t\t    \t\tif(grid.gridType === grid.GRID_TYPE_GROUP)\r\n\t\t\t\t\t{\r\n\t\t    \t\t\tarrColumnsTemp.splice(0, 1);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t\t        for(colIndex = 0; colIndex < arrColumnsTemp.length; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = arrColumnsTemp[colIndex];\r\n\t\t\t        \tif(!(colItem && (!colItem.hasOwnProperty(grid.__fieldColVisible) || colItem[grid.__fieldColVisible]) && (!colItem.hasOwnProperty(\"isExportable\") || Boolean.parse(colItem[\"isExportable\"]))))\r\n\t\t\t        \t{\r\n\t\t\t        \t\tarrColumnsTemp.splice(colIndex, 1);\r\n\t\t\t        \t}\r\n\t\t\t        \telse\r\n\t\t\t        \t{\r\n\t\t\t        \t\tcolItem.headerCellStyle = colItem[\"excelStyleHeaderFunction\"] ? colItem[\"excelStyleHeaderFunction\"](colItem,colIndex) : null;\r\n\t\t\t        \t\tcolItem.type = colItem.exportType;\r\n\t\t\t        \t\tif(!util.isUndefinedOrNull(colItem.width))\r\n\t\t\t\t        \t{\r\n\t\t\t\t        \t\tvar unit = util.getDimensionUnit(colItem.width);\r\n\t\t\t\t        \t\tswitch(unit)\r\n\t\t\t\t        \t\t{\r\n\t\t\t\t        \t\t\tcase 1:\r\n\t\t\t\t        \t\t\t\tcolItem.widthInPercentage = parseInt(colItem.width.substring(0,colItem.width.length - 1));\r\n\t\t\t\t        \t\t\t\tcolItem.width = null;\r\n\t\t\t\t        \t\t\tbreak;\r\n\t\t\t\t        \t\t\tcase 2:\r\n\t\t\t\t        \t\t\t\tcolItem.widthInPx = util.getDimensionAsNumber(null,colItem.width);\r\n\t\t\t\t        \t\t\t\tcolItem.width = null;\r\n\t\t\t\t        \t\t\tbreak;\r\n\t\t\t\t        \t\t}\r\n\t\t\t\t        \t}\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        var dataSource = grid.getFilteredData();\r\n\t\t\t        if(dataSource && dataSource.length > 0)\r\n\t\t\t        {\r\n\t\t\t        \tfor(rowIndex = 0;rowIndex < dataSource.length;rowIndex++)\r\n\t\t\t \t        {\r\n\t\t\t        \t\tvar data = dataSource[rowIndex];\r\n\t\t\t        \t\tvar item = {};\r\n\t\t\t        \t\tfor(colIndex = 0;colIndex < arrColumnsTemp.length;colIndex++)\r\n\t\t\t    \t        {\r\n\t\t\t        \t\t\tvar colItem = arrColumnsTemp[colIndex];\r\n\t\t\t        \t\t\tvar dataField = colItem.dataField;\r\n\t\t\t        \t\t\tvar text = colItem[\"exportGetBodyTextFunction\"] ? colItem[\"exportGetBodyTextFunction\"](data,dataField,colItem) : data[dataField];\r\n\t\t\t        \t\t\tvar style = colItem[\"excelStyleBodyFunction\"] ? colItem[\"excelStyleBodyFunction\"](data,dataField,colItem,text) : null;\r\n\t\t\t        \t\t\titem[dataField] = {value: text,style: style};\r\n\t\t\t    \t        }\r\n\t\t\t        \t\tarrSource.push(item);\r\n\t\t\t \t        }\r\n\t\t\t        \tif(grid.__enableFooter)\r\n\t\t\t        \t{\r\n\t\t\t        \t\tvar item = {};\r\n\t\t\t        \t\tfor (var colIndex = 0; colIndex < arrColumnsTemp.length; colIndex++)\r\n\t\t\t    \t\t    {\r\n\t\t\t    \t\t    \tvar colItem = arrColumnsTemp[colIndex];\r\n\t\t\t    \t\t    \tvar dataField = colItem.dataField;\r\n\t\t\t    \t\t    \tvar text = colItem[\"exportGetFooterTextFunction\"] ? colItem[\"exportGetFooterTextFunction\"](dataField,colItem,grid.getGroupedSource(),0,colIndex) : \"\";\r\n\t\t\t    \t\t    \tvar style = colItem[\"excelStyleFooterFunction\"] ? colItem[\"excelStyleFooterFunction\"](dataField,colItem,grid.getGroupedSource(),0,colIndex,text) : null;\r\n\t\t\t        \t\t\titem[dataField] = {value: text,style: style};\r\n\t\t\t    \t\t    }\r\n\t\t\t        \t\tarrSource.push(item);\r\n\t\t\t        \t}\r\n\t\t\t        }\r\n\t\t\t        arrColumns = arrColumnsTemp;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.__grid.tHead && this.__grid.tHead.rows && this.__grid.tHead.rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerRow = this.__grid.tHead.rows[0];\r\n\t\t\t\t\tif(headerRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrCells = [];\r\n\t\t\t\t\t\tif(headerRow.getElementsByTagName(\"th\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"th\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(headerRow.getElementsByTagName(\"td\").length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells = headerRow.getElementsByTagName(\"td\");\r\n\t\t\t\t\t\t}\r\n\t\t\t    \t\tvar colIndex = 0;\r\n\t\t\t    \t\tvar cell = null;\r\n\t\t\t    \t\tvar text = \"\";\r\n\t\t\t    \t\tvar headerText = \"\";\r\n\t\t\t    \t\tvar dataField = \"\";\r\n\t\t\t\t        for(colIndex = 0; colIndex < arrCells.length; colIndex++)\r\n\t\t\t\t        {\r\n\t\t\t\t        \tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t        \t{\r\n\t\t\t\t\t        \tcell = arrCells[colIndex];\r\n\t\t\t\t\t        \tvar altText = \"col\" + colIndex;\r\n\t\t\t\t\t        \tif(typeof cell == \"undefined\" || cell.textContent.trim() !== \"\")\r\n\t\t\t\t\t        \t{\r\n\t\t\t\t\t        \t\ttext = \"\";\r\n\t\t\t\t\t        \t\theaderText = \"\";\r\n\t\t\t\t\t        \t\tdataField = altText;\r\n\t\t\t\t\t        \t}\r\n\t\t\t\t\t        \telse\r\n\t\t\t\t\t        \t{\r\n\t\t\t\t\t        \t\ttext = cell.textContent.trim();\r\n\t\t\t\t\t        \t\theaderText = text;\r\n\t\t\t\t\t        \t\tdataField = text;\r\n\t\t\t\t\t        \t}\r\n\t\t\t\t\t        \tarrColumns.push({headerText:headerText,dataField:dataField,widthInPx:cell.offsetWidth});\r\n\t\t\t\t        \t}\r\n\t\t\t\t        }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__grid.tBodies && this.__grid.tBodies.length > 0 && this.__grid.tBodies[0].rows && this.__grid.tBodies[0].rows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrRows = this.__grid.tBodies[0].rows;\r\n\t\t    \t\tvar rowIndex = 0;\r\n\t\t    \t\tvar colIndex = 0;\r\n\t\t    \t\tfor(rowIndex = 0;rowIndex < arrRows.length;rowIndex++)\r\n\t\t \t        {\r\n\t\t        \t\tvar row = arrRows[rowIndex];\r\n\t\t        \t\tvar style = window.getComputedStyle(row);\r\n\t\t        \t\tif (style.display !== \"none\") \r\n\t\t        \t\t{\r\n\t\t\t        \t\tvar cells = row.cells;\r\n\t\t\t        \t\tvar item = {};\r\n\t\t\t        \t\tvar arrColIndex = 0;\r\n\t\t\t        \t\tfor(colIndex = 0;colIndex < cells.length;colIndex++)\r\n\t\t\t    \t        {\r\n\t\t\t        \t\t\tif(!this.__isColumnIgnored(colIndex))\r\n\t\t\t\t\t        \t{\r\n\t\t\t\t        \t\t\tvar cell = cells[colIndex];\r\n\t\t\t\t        \t\t\tvar objColumn = arrColumns[arrColIndex];\r\n\t\t\t\t        \t\t\tvar text = (typeof cell == \"undefined\" || cell.textContent.trim() !== \"\") ? cell.textContent.trim() : \"\";\r\n\t\t\t\t        \t\t\titem[objColumn.dataField] = {value: text};\r\n\t\t\t\t        \t\t\tarrColIndex++;\r\n\t\t\t\t\t        \t}\r\n\t\t\t    \t        }\r\n\t\t\t        \t\tarrSource.push(item);\r\n\t\t        \t\t}\r\n\t\t \t        }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn {columns:arrColumns,source:arrSource};\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getStructureForPDF = function(width,fontSize) \r\n\t{ \r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar tblResult = this.__getTable();\r\n\t\t\ttblResult.style.width = width + \"px\";\r\n\t\t\ttblResult.style.fontSize = fontSize + \"px\";\r\n\t\t\tvar divParent = this.util.createDiv(\"div\" + this.util.getUniqueId());\r\n\t\t\tdivParent.appendChild(tblResult);\r\n\t\t\treturn divParent;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getStructureForImage = function() \r\n\t{ \r\n\t\tvar divReturn = null;\r\n\t\tif(this.__grid)\r\n\t\t{\r\n\t\t\tvar grid = this.__getPrototype(this.__grid);\r\n\t\t\tif(grid && this.__isTypeNSGrid(grid))\r\n\t\t\t{\r\n\t\t\t\tdivReturn = grid.__divOuterContainer;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdivReturn = this.__grid.parentElement;\r\n\t\t\t\tif(divReturn && divReturn.nodeName === \"BODY\")\r\n\t\t\t\t{\r\n\t\t\t\t\tdivReturn = null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn divReturn;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__isColumnIgnored = function(colIndex) \r\n\t{\r\n\t    if(this.__ignoreColumn && this.__ignoreColumn.length > 0)\r\n\t    {\r\n\t    \tfor(var count = 0;count < this.__ignoreColumn.length;count++)\r\n\t    \t{\r\n\t    \t\tif(this.__ignoreColumn[count] === colIndex)\r\n\t    \t\t{\r\n\t    \t\t\treturn true;\r\n\t    \t\t}\r\n\t    \t}\r\n\t    }\r\n\t    return false;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getFieldValue = function(value,delimiter) \r\n\t{\r\n\t\tif(!value)\r\n\t\t{\r\n\t\t\tvalue = \"\";\r\n\t\t}\r\n\t\tvalue = \"\" + value;\r\n\t    var addQuotes = (value.indexOf(delimiter) !== -1) || (value.indexOf('\\r') !== -1) || (value.indexOf('\\n') !== -1);\r\n\t    var replaceDoubleQuotes = (value.indexOf('\"') !== -1);\r\n\t    if (replaceDoubleQuotes) \r\n\t    {\r\n\t    \tvalue = fixedValue.replace(/\"/g, '\"\"');\r\n\t    }\r\n\t    if (addQuotes || replaceDoubleQuotes) \r\n\t    {\r\n\t    \tvalue = '\"' + value + '\"';\r\n\t    }\r\n\t    return value;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getFileName = function(format) \r\n\t{\r\n\t\tvar date = new Date();\r\n\t    var day = date.getDate();\r\n\t    var month = date.getMonth() + 1;\r\n\t    var year = date.getFullYear();\r\n\t    var hour = date.getHours();\r\n\t    var mins = date.getMinutes();\r\n\t    var timePart = day + \".\" + month + \".\" + year + \"_\" + hour + \".\" + mins;\r\n\t    var fileName = (this.__fileName? this.__fileName : \"download\");\r\n\t    fileName = fileName + \"(\" + timePart + \")\" + \".\" + format;\r\n\t    \r\n\t    return fileName;\r\n\t};\r\n\t\r\n\t//taken from http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata\r\n\tNSExport.prototype.__dataURItoBlob = function(dataURI) \r\n\t{\r\n\t    // convert base64/URLEncoded data component to raw binary data held in a string\r\n\t    var byteString = null;\r\n\t    var uintArray = null;\r\n\t    var mimeString = null;\r\n\t    if (dataURI.split(',')[0].indexOf('base64') >= 0)\r\n\t    {\r\n\t    \t byteString = window.atob(dataURI.split(',')[1]);\r\n\t    }\r\n\t    else\r\n\t    {\r\n\t    \t byteString = decodeURIComponent(dataURI.split(',')[1]);\r\n\t    }\r\n\t    // separate out the mime component\r\n\t    mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];\r\n\t    // write the bytes of the string to a typed array\r\n\t    uintArray = new Uint8Array(byteString.length);\r\n\t    for (var count = 0; count < byteString.length; count++) \r\n\t    {\r\n\t    \tuintArray[count] = byteString.charCodeAt(count);\r\n\t    }\r\n\t\r\n\t    return new Blob([uintArray], {type:mimeString});\r\n\t};\r\n\t\r\n\tNSExport.prototype.__includeJavaScriptFile = function (filePath,callback,position)\r\n\t{\r\n\t    if(filePath)\r\n\t    {\r\n\t        if(!position)\r\n\t        {\r\n\t            position = \"body\";\r\n\t        }\r\n\t        var domPosition = document.getElementsByTagName(position)[0];\r\n\t        var script = document.createElement(\"script\");\r\n\t        script.setAttribute(\"id\", filePath);\r\n\t        script.setAttribute(\"type\",\"text/javascript\");\r\n\t        script.setAttribute(\"src\",filePath);\r\n\t        if(callback)\r\n\t        {\r\n\t            script.onload = function()\r\n\t            {\r\n\t            \tcallback(filePath);\r\n\t            }; \r\n\t        }\r\n\t        domPosition.appendChild(script);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSExport.prototype.__getPrototype = function(grid) \r\n\t{\r\n\t\tif(grid)\r\n\t\t{\r\n\t\t\tif(this.util.isElementOfType(grid,\"NS-GRID\"))\r\n\t\t\t{\r\n\t\t\t\tgrid = grid.__nsGrid;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn grid;\r\n\t};\r\n\t\r\n\tNSExport.prototype.__isTypeNSGrid = function(grid) \r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(grid)\r\n\t\t\t{\r\n\t\t\t\tif(grid instanceof NSGrid)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(error)\r\n\t\t{}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSExport.prototype.xslxExport = function(objNSExport,worksheetName,event,properties)\r\n\t{\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.__objNSExport = objNSExport;\r\n\t\tthis.__worksheetName = worksheetName;\r\n\t\tthis.__event = event;\r\n\t\tthis.__properties = properties;\r\n\t\tvar self = this;\r\n\t\t\r\n\t\tthis.exportToxlsx = function() \r\n\t\t{\r\n\t\t\tvar processXSLX = function()\r\n\t\t\t{\r\n\t\t\t\tvar objTableValue = self.__objNSExport.__getTableAsArray();\r\n\t\t\t\tif(objTableValue)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!self.__properties)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.__properties = {};\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar fileName = self.__objNSExport.__getFileName(\"xlsx\");\r\n\t\t\t\t\tvar headerStyle = {\r\n\t\t\t\t\t\t\tfont: {bold: true, color: '#FFFFFF'},\r\n\t\t\t\t\t\t\thorizontal: 'center',\r\n\t\t\t\t\t\t\tpattern: {color: '#000000'}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tvar prop = {};\r\n\t\t\t\t\tfor(var key in self.__properties)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tprop[key] = self.__properties[key];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tprop.dataSource = objTableValue.source;\r\n\t\t\t\t\tprop.columns = objTableValue.columns;\r\n\t\t\t\t\tprop.name = prop.name || \"Sheet 1\";\r\n\t\t\t\t\tprop.headerStyle = prop.headerStyle || headerStyle;\r\n\t\t\t\t\tvar arrSheet=[prop];\r\n\t\t\t\t\tvar setting = {fileName:fileName,sheets:arrSheet};\r\n\t\t\t\t\tvar xlsxExport = new NSXlsxExport(setting);\r\n\t\t\t\t\txlsxExport.process();\r\n\t\t\t\t\tif(self.__event)\r\n\t\t\t\t    {\r\n\t\t\t\t\t\tself.util.preventDefault(this.__event);\r\n\t\t\t\t    }\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tprocessXSLX();\r\n\t\t};\r\n\t};\r\n\treturn NSExport;\r\n})();\r\nnsModuleExport(this,\"NSExport\",NSExport);\"use strict\";\r\nvar NSFilter = (function()\r\n{\r\n\tfunction NSFilter(data,filter,setting,recordLimit,isHierarchical,childField,filterFunction,hierarchyFilterChildren,arrIgnoreKeysInCloneDataSource) \r\n\t{\r\n\t\tthis.EXACT = \"exact\";\r\n\t\tthis.STARTS_WITH = \"startsWith\";\r\n\t\tthis.ENDS_WITH = \"endsWith\";\r\n\t\tthis.CONTAINS = \"contains\";\r\n\t\t\r\n\t\tthis.IS_FOUND_FIELD = \"__nsFilter__found\";\r\n\t\t\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.__data = data;\r\n\t\tthis.__filter = filter;\r\n\t\tthis.__setting = setting;\r\n\t\tthis.__recordLimit = (parseInt(recordLimit) > 0) ? recordLimit : -1;\r\n\t\tthis.__isHierarchical = this.util.isUndefined(isHierarchical) ? false : Boolean.parse(isHierarchical);\r\n\t\tthis.__childField = childField ? childField : \"children\";\r\n\t\tthis.__filterFunction = filterFunction;\r\n\t\tthis.__hierarchyFilterChildren = hierarchyFilterChildren;\r\n\t\tthis.__arrIgnoreKeysInCloneDataSource = arrIgnoreKeysInCloneDataSource;\r\n\t\tthis.__ignoreSameLevelNode = true;\r\n\t}\r\n\t\r\n\tNSFilter.prototype.execute = function(data,filter,setting,recordLimit,isHierarchical,childField,filterFunction,hierarchyFilterChildren,arrIgnoreKeysInCloneDataSource) \r\n\t{ \r\n\t\tdata = data ? data : this.__data;\r\n\t\tfilter = filter ? filter : this.__filter;\r\n\t\tsetting = setting ? setting : this.__setting;\r\n\t\trecordLimit = (parseInt(recordLimit) > 0) ? recordLimit : this.__recordLimit;\r\n\t\tisHierarchical = this.util.isUndefined(isHierarchical) ? Boolean.parse(this.__isHierarchical) : Boolean.parse(isHierarchical);\r\n\t\tchildField = childField ? childField : this.__childField;\r\n\t\tfilterFunction = filterFunction ? filterFunction : this.__filterFunction;\r\n\t\thierarchyFilterChildren = hierarchyFilterChildren ? hierarchyFilterChildren : this.__hierarchyFilterChildren;\r\n\t\tarrIgnoreKeysInCloneDataSource = this.util.isUndefinedOrNull(arrIgnoreKeysInCloneDataSource) ? this.__arrIgnoreKeysInCloneDataSource : arrIgnoreKeysInCloneDataSource;\r\n\t\tif(data && filter)\r\n\t\t{\r\n\t\t\tvar dataSource = data.slice(0);\r\n\t\t\tvar arrFilter = [];\r\n\t\t\tvar self = this;\r\n\t\t\tvar callFilterFunction = function(source,level,parentItem)\r\n\t\t\t{\r\n\t\t\t\tvar arrReturn = [];\r\n\t\t\t\tfor (var count = 0; count < source.length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = source[count];\r\n\t\t\t\t\tvar found = false;\r\n\t\t\t\t\tif(isHierarchical && item[childField] && item[childField].length > 0 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar arrChild = callFilterFunction(item[childField],level + 1,item);\r\n\t\t\t\t\t\tif(arrChild && arrChild.length > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\tif(self.__ignoreSameLevelNode)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t            item[childField] = arrChild;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tarrReturn.push(item);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!found && self.__filterItem(item,filter,setting,isHierarchical,childField,parentItem,filterFunction))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(isHierarchical && hierarchyFilterChildren)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar arrChildren = item[childField];\r\n\t\t\t\t\t\t\tif(arrChildren && arrChildren.length > 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar childItem = null;\r\n\t\t\t\t\t\t\t\tvar childLength = arrChildren.length;\r\n\t\t\t\t\t\t\t\tfor(var childCount = childLength - 1;childCount > -1;childCount--)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tchildItem = arrChildren[childCount];\r\n\t\t\t\t\t\t\t\t\tif(childItem)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif(!hierarchyFilterChildren(childItem,childCount,childItem[self.IS_FOUND_FIELD],filter,setting,item))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tarrChildren.splice(childCount, 1);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\tarrReturn.push(item);\r\n\t\t\t\t\t\tif(!isHierarchical && recordLimit > 0 && arrReturn.length >= recordLimit)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//return false;\r\n\t\t\t\treturn arrReturn;\r\n\t\t\t};\r\n\t\t\tvar callNonHierarchicalFilterFunction = function(source)\r\n\t\t\t{\r\n\t\t\t\tvar arrReturn = [];\r\n\t\t\t\tfor (var count = 0; count < source.length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = source[count];\r\n\t\t\t\t\tif(self.__filterItemNonHierarchical(item,filter,setting,filterFunction))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrReturn.push(item);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn arrReturn;\r\n\t\t\t};\r\n\t\t\tdataSource = this.util.cloneObject(dataSource,isHierarchical,[],arrIgnoreKeysInCloneDataSource);\r\n\t\t\tif(isHierarchical)\r\n\t\t\t{\r\n\t\t\t\tarrFilter = callFilterFunction(dataSource,1,null);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tarrFilter = callNonHierarchicalFilterFunction(dataSource);\r\n\t\t\t}\r\n\t\t\treturn arrFilter;\r\n\t\t}\r\n\t\treturn data;\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__filterItemNonHierarchical = function(item,filter,setting,filterFunction) \r\n\t{\r\n\t\tvar retValue = false;\r\n\t\tif(filterFunction)\r\n\t\t{\r\n\t\t\tretValue = filterFunction(item,filter,setting);\r\n\t\t\tthis.__setItem(item,retValue);\r\n\t\t\treturn retValue;\r\n\t\t}\r\n\t\telse if(filter instanceof Function) \r\n\t    {\r\n\t\t\tretValue = filter(item,setting);\r\n\t        this.__setItem(item,retValue);\r\n\t        return retValue;\r\n\t    }\r\n\t    else if(filter instanceof Array) \r\n\t    {\r\n\t        for (var count = 0; count < filter.length; ++count) \r\n\t        {\r\n\t            if (this.__filterItemNonHierarchical(item,filter[count],setting,filterFunction))\r\n\t            {\r\n\t            \tthis.__setItem(item,true);\r\n\t            \treturn true;\r\n\t            }\r\n\t        }\r\n\t        return false;\r\n\t    }\r\n\t    else if(setting.type === \"date\" && filter)\r\n\t    {\r\n\t        return this.__filterDate(item,filter,setting);\r\n\t    }\r\n\t    else if(typeof(item) === \"string\" && filter)\r\n\t    {\r\n\t        return this.__filterString(item,filter,setting);\r\n\t    }\r\n\t    else if (item === item + 0 && filter)\r\n\t    {\r\n\t        return this.__filterNumeric(item,filter);\r\n\t    }\r\n\t    else if(typeof (filter) === \"object\") \r\n\t    {\r\n\t        for(var key in filter) \r\n\t        {\r\n\t        \tvar tempSetting = {};\r\n\t        \tif(setting && setting[key])\r\n\t        \t{\r\n\t        \t\ttempSetting = setting[key];\r\n\t        \t}\r\n\t            if(!this.__filterItemNonHierarchical(item[key],filter[key],tempSetting,filterFunction))\r\n\t            {\r\n\t            \treturn false;\r\n\t            }\r\n\t        }\r\n\t        this.__setItem(item,true);\r\n\t        return true;\r\n\t    }\r\n\t\tretValue = (filter == item);\r\n\t    this.__setItem(item,retValue);\r\n\t    return retValue;\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__filterItem = function(item,filter,setting,isHierarchical,childField,parentItem,filterFunction) \r\n\t{\r\n\t\tvar retValue = false;\r\n\t\tif(filterFunction)\r\n\t\t{\r\n\t\t\tretValue = filterFunction(item,filter,setting,isHierarchical,childField,parentItem);\r\n\t\t\tthis.__setItem(item,retValue);\r\n\t\t\treturn retValue;\r\n\t\t}\r\n\t\telse if(filter instanceof Function) \r\n\t    {\r\n\t\t\tretValue = filter(item,setting);\r\n\t        this.__setItem(item,retValue);\r\n\t        return retValue;\r\n\t    }\r\n\t    else if(filter instanceof Array) \r\n\t    {\r\n\t        for (var count = 0; count < filter.length; ++count) \r\n\t        {\r\n\t            if (this.__filterItem(item,filter[count],setting,isHierarchical,childField,parentItem,filterFunction))\r\n\t            {\r\n\t            \tthis.__setItem(item,true);\r\n\t            \treturn true;\r\n\t            }\r\n\t        }\r\n\t        return false;\r\n\t    }\r\n\t    else if(setting.type === \"date\" && filter)\r\n\t    {\r\n\t        return this.__filterDate(item,filter,setting);\r\n\t    }\r\n\t    else if(typeof(item) === \"string\" && filter)\r\n\t    {\r\n\t        return this.__filterString(item,filter,setting);\r\n\t    }\r\n\t    else if (item === item + 0 && filter)\r\n\t    {\r\n\t        return this.__filterNumeric(item,filter);\r\n\t    }\r\n\t    else if(typeof (filter) === \"object\") \r\n\t    {\r\n\t        for(var key in filter) \r\n\t        {\r\n\t        \tif(isHierarchical && key === childField)\r\n\t        \t{\r\n\t        \t\tcontinue;\r\n\t        \t}\r\n\t        \tvar tempSetting = {};\r\n\t        \tif(setting && setting[key])\r\n\t        \t{\r\n\t        \t\ttempSetting = setting[key];\r\n\t        \t}\r\n\t            if(!this.__filterItem(item[key],filter[key],tempSetting,isHierarchical,childField,parentItem,filterFunction))\r\n\t            {\r\n\t            \treturn false;\r\n\t            }\r\n\t        }\r\n\t        this.__setItem(item,true);\r\n\t        return true;\r\n\t    }\r\n\t\tretValue = (filter == item);\r\n\t    this.__setItem(item,retValue);\r\n\t    return retValue;\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__setItem = function(item,isFound)\r\n\t{\r\n\t\tif(item && typeof (item) === \"object\" && isFound)\r\n\t\t{\r\n\t\t\titem[this.IS_FOUND_FIELD] = true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__filterNumeric= function(value,searchParam)\r\n\t{\r\n\t\tvar retValue = false;\r\n\t\tvalue = parseFloat(value);\r\n\t\tif(!isNaN(value))\r\n\t\t{\r\n\t\t\tif(/<=/.test(searchParam)) // first checks if there is an operator (<,>,<=,>=)\r\n\t\t\t{\r\n\t\t\t\tretValue = (value <= parseFloat(searchParam.replace(/<=/,\"\")));\r\n\t\t\t}\r\n\t\t\telse if(/>=/.test(searchParam))\r\n\t\t\t{\r\n\t\t\t\tretValue = (value >= parseFloat(searchParam.replace(/>=/,\"\")));\r\n\t\t\t}\r\n\t\t\telse if(/</.test(searchParam))\r\n\t\t\t{\r\n\t\t\t\tretValue = (value < parseFloat(searchParam.replace(/</,\"\")));\r\n\t\t\t}\r\n\t\t\telse if(/>/.test(searchParam))\r\n\t\t\t{\r\n\t\t\t\tretValue = (value > parseFloat(searchParam.replace(/>/,\"\")));\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tretValue = (value === parseFloat(searchParam));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__filterDate= function(value,searchParam,setting)\r\n\t{\r\n\t\tvar retValue = false;\r\n\t\tvar self = this;\r\n\t\tvar matchValue = function(compareValue,opt)\r\n\t\t{\r\n\t\t\tvar compValue = false;\r\n\t\t\tif(self.util.isUndefinedOrNull(value))\r\n\t\t\t{\r\n\t\t\t\tcompValue = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar newVal = self.__getDate(value,setting.cellFormat);\r\n\t\t\t\tif(newVal)\r\n\t\t\t\t{\r\n\t\t\t\t\tnewVal.setHours(0, 0, 0, 0);\r\n\t\t\t\t\tcompareValue.setHours(0, 0, 0, 0);\r\n\t\t\t\t\tswitch(opt)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcase \"equals\":\r\n\t\t\t\t\t\t\tif (compareValue.getTime() === newVal.getTime()) \r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcompValue = true;\r\n\t\t\t\t            }\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"greaterThan\":\r\n\t\t\t\t\t\t\tif (compareValue.getTime() < newVal.getTime()) \r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcompValue = true;\r\n\t\t\t\t            }\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"lessThan\":\r\n\t\t\t\t\t\t\tif (compareValue.getTime() > newVal.getTime()) \r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcompValue = true;\r\n\t\t\t\t            }\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"notEqual\":\r\n\t\t\t\t\t\t\tif (compareValue.getTime() != newVal.getTime()) \r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcompValue = true;\r\n\t\t\t\t            }\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tself.util.warning(\"NSFilter\",value + \" cannot be converted to date Object for given cell format\");\r\n\t\t\t\t\tcompValue = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn compValue;\r\n\t\t};\r\n\t\tvar processDate = function(date,type)\r\n\t\t{\r\n\t\t\tvar compValue = false;\r\n\t\t\tif(date && matchType1)\r\n\t\t\t{\r\n\t\t\t\tif(!date || !Object.prototype.toString.call(date) === '[object Date]')\r\n\t\t\t\t{\r\n\t\t\t\t\tcompValue = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(setting.comparator)\r\n\t\t\t\t{\r\n\t\t\t\t\tcompValue = setting.comparator(value,date,setting);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcompValue = matchValue(date,type);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn compValue;\r\n\t\t};\r\n\t\tif(setting.matchType1 || setting.matchType2)\r\n\t\t{\r\n\t\t\tvar matchType1 = setting.matchType1;\r\n\t\t\tvar firstDate = setting.firstDate;\r\n\t\t\tvar operation = setting.operation;\r\n\t\t\tvar matchType2 = setting.matchType2;\r\n\t\t\tvar secondDate = setting.secondDate;\r\n\t\t\tif(this.util.isUndefinedOrNull(value))\r\n\t\t\t{\r\n\t\t\t\tretValue = false;\r\n\t\t\t}\r\n\t\t\telse if(firstDate && secondDate && matchType1 && matchType2 && operation)\r\n\t\t\t{\r\n\t\t\t\tvar firstVal = processDate(firstDate,matchType1);\r\n\t\t\t\tvar secondVal = processDate(secondDate,matchType2);\r\n\t\t\t\tswitch(operation)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase \"and\":\r\n\t\t\t\t\t\tretValue = (firstVal && secondVal);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"or\":\r\n\t\t\t\t\t\tretValue = (firstVal || secondVal);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(firstDate && matchType1)\r\n\t\t\t{\r\n\t\t\t\tretValue = processDate(firstDate,matchType1);\r\n\t\t\t}\r\n\t\t\telse if(secondDate && matchType2)\r\n\t\t\t{\r\n\t\t\t\tretValue = processDate(secondDate,matchType2);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tretValue = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(!searchParam || !Object.prototype.toString.call(searchParam) === '[object Date]')\r\n\t\t\t{\r\n\t\t\t\tretValue = true;\r\n\t\t\t}\r\n\t\t\telse if(setting.comparator)\r\n\t\t\t{\r\n\t\t\t\tretValue = setting.comparator(value,searchParam,setting);\r\n\t\t\t}\r\n\t\t\telse if(this.util.isUndefinedOrNull(value))\r\n\t\t\t{\r\n\t\t\t\tretValue = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tretValue = matchValue(searchParam,\"equals\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__filterString= function(value,searchParam,setting)\r\n\t{\r\n\t\tvar regExp = null;\r\n\t\tvar regExpModifier = \"g\";\r\n\t\tvar startWithChar = \"(^)\";\r\n\t\tvar endsWithChar = \"($)\";\r\n\t\tvar searchString = \"\";\r\n\t\tvar isCaseSensitive = false;\r\n\t\tvar isMultiline = false;\r\n\t\tvar matchType = this.CONTAINS;\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tisCaseSensitive = Boolean.parse(setting[\"caseSensitive\"]);\r\n\t\t\tisMultiline = Boolean.parse(setting[\"multiline\"]);\r\n\t\t\tmatchType = setting[\"matchType\"] ? setting[\"matchType\"] : matchType;\r\n\t\t}\r\n\t\tif(!isCaseSensitive)\r\n\t\t{\r\n\t\t\tregExpModifier += \"i\";\r\n\t\t}\r\n\t\tif(isMultiline)\r\n\t\t{\r\n\t\t\tregExpModifier += \"m\";\r\n\t\t}\r\n\t\tsearchParam = this.__removeSpecialCharacter(searchParam);\r\n\t\tif(matchType === this.EXACT)\r\n\t\t{\r\n\t\t\tsearchString = startWithChar + searchParam + endsWithChar;\r\n\t\t}\r\n\t\telse if(matchType === this.STARTS_WITH)\r\n\t\t{\r\n\t\t\tsearchString = startWithChar + searchParam;\r\n\t\t}\r\n\t\telse if(matchType === this.ENDS_WITH)\r\n\t\t{\r\n\t\t\tsearchString = searchParam + endsWithChar;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tsearchString = searchParam;\r\n\t\t}\r\n\t\tregExp = new RegExp(searchString,regExpModifier);\r\n\t\treturn regExp.test(value);\r\n\t};\r\n\t\r\n\tNSFilter.prototype.__removeSpecialCharacter = function(text)\r\n\t{\r\n\t\tfunction replaceEscape(char)\r\n\t\t{\r\n\t\t\tif(text)\r\n\t\t\t{\r\n\t\t\t\tvar exp = new RegExp(\"\\\\\" + char,\"g\");\r\n\t\t\t\ttext = text.replace(exp,\"\\\\\" + char);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar specialChar = ['\\\\','[','^','$','.','|','?','*','+','(',')'];\r\n\t\tfor(var count = 0;count < specialChar.length;count++) \r\n\t\t{\r\n\t\t\treplaceEscape(specialChar[count]);\r\n\t\t}\r\n\t\treturn text;\r\n\t};\r\n\t\r\n\t//ref from : https://stackoverflow.com/questions/7445328/check-if-a-string-is-a-date-value\r\n\tNSFilter.prototype.__getDate = function(value,arrFormat) \r\n\t{\r\n\t\tif(value)\r\n\t\t{\r\n\t\t\tvar dateFormat;\r\n\t\t    if (Object.prototype.toString.call(value) === '[object Date]') \r\n\t\t    {\r\n\t\t        return value;\r\n\t\t    }\r\n\t\t    if(arrFormat)\r\n\t\t    {\r\n\t\t    \tvar dateUtil = new NSDateUtil();\r\n\t\t    \tif(!this.util.isArray(arrFormat))\r\n\t\t    \t{\r\n\t\t    \t\tarrFormat = [arrFormat];\r\n\t\t    \t}\r\n\t\t    \tfor(var count = 0;count < arrFormat.length;count++)\r\n\t\t    \t{\r\n\t\t    \t\tvar format = arrFormat[count];\r\n\t\t    \t\tvar date = dateUtil.parseString(value,format);\r\n\t\t    \t\tif(date)\r\n\t\t    \t\t{\r\n\t\t    \t\t\treturn date;\r\n\t\t    \t\t}\r\n\t\t    \t}\r\n\t\t    }\r\n\t\t    else\r\n\t\t    {\r\n\t\t    \tif (typeof value.replace === 'function') \r\n\t\t\t    {\r\n\t\t\t        value.replace(/^\\s+|\\s+$/gm, '');\r\n\t\t\t    }\r\n\t\t\t    dateFormat = /(^\\d{1,4}[\\.|\\\\/|-]\\d{1,2}[\\.|\\\\/|-]\\d{1,4})(\\s*(?:0?[1-9]:[0-5]|1(?=[012])\\d:[0-5])\\d\\s*[ap]m)?$/;\r\n\t\t\t    if(dateFormat.test(value))\r\n\t\t\t    {\r\n\t\t\t    \treturn new Date(value);//Date.parse(value);\r\n\t\t\t    }\r\n\t\t    }\r\n\t\t}\r\n\t    return null;\r\n\t};\r\n\t\r\n\treturn NSFilter;\r\n})();\r\nnsModuleExport(this,\"NSFilter\",NSFilter);\"use strict\";\r\nvar NSTouchToMouse = (function()\r\n{\r\n\tfunction NSTouchToMouse(element,setting,doc,win) \r\n\t{\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.doc = this.util.getDoc(doc);\r\n\t\tthis.win = this.util.getWin(win);\r\n\t\tthis.__element = this.util.getElement(element);\r\n\t\tthis.__setting = setting;\r\n\t\tthis.__config = null;\r\n\t\tthis.__touchEventRef = null;\r\n\t\tthis.__gestureChangeRef = null;\r\n\t\tthis.__gestureEndRef = null;\r\n\t\tthis.__objLocal = {documentClick: false,doubleTapWaiting: false,preTouchStart: false,gestureChanged: false};\r\n\t\tthis.__objEvents = null;\r\n\t\tthis.__useConstructor = false;\r\n\t\tthis.__initialize();\r\n\t};\r\n\t\r\n\tNSTouchToMouse.prototype.isTouchSupported = function()\r\n\t{\r\n\t\tvar isTouchSupported = ((\"ontouchstart\" in this.win) || (this.win.navigator.msMaxTouchPoints > 0));\r\n\t\treturn isTouchSupported;\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.isGestureSupported = function()\r\n\t{\r\n\t\tvar isGestureSupported = (\"ongesturestart\" in this.win);\r\n\t\treturn isGestureSupported;\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.destroy = function()\r\n\t{\r\n\t\tif(this.__touchEventRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__element,\"touchstart\",this.__touchEventRef);\r\n\t\t\tthis.util.removeEvent(this.__element,\"touchmove\",this.__touchEventRef,true);\r\n\t\t\tthis.util.removeEvent(this.__element,\"touchend\",this.__touchEventRef,true);\r\n\t\t\tthis.util.removeEvent(this.__element,\"touchcancel\",this.__touchEventRef,true);\r\n\t\t\tthis.__touchEventRef = null;\r\n\t\t}\r\n\t\tif(this.__gestureChangeRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__element,\"gesturechange\",this.__gestureChangeRef);\r\n\t\t\tthis.__gestureChangeRef = null;\r\n\t\t}\r\n\t\tif(this.__gestureEndRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__element,\"gestureend\",this.__gestureEndRef);\r\n\t\t\tthis.__gestureEndRef = null;\r\n\t\t}\r\n\t\tthis.__objLocal = {documentClick: false,doubleTapWaiting: false,preTouchStart: false,gestureChanged: false};\r\n\t};\r\n\t\r\n\tNSTouchToMouse.prototype.__initialize = function()\r\n\t{\r\n\t\tif(!this.__element)\r\n\t\t{\r\n\t\t\tthis.util.throwNSError(\"NSTouchToMouse\",\"Element is not valid\");\r\n\t\t}\r\n\t\tvar setting = this.__setting || {};\r\n\t\tthis.__config = {\r\n\t\t\tdoubleTapInterval: this.util.isUndefinedOrNull(setting[\"doubleTapInterval\"]) ? 500 : parseInt(setting[\"doubleTapInterval\"]),\r\n\t\t\tsuppressMouseEvent: Boolean.parse(setting[\"suppressMouseEvent\"]),\r\n\t\t\ttouchStartHandler: setting[\"touchStartHandler\"],//format function(screenXPos,screenYPos,event)\r\n\t\t\ttouchMoveHandler: setting[\"touchMoveHandler\"],//format function(screenXPos,screenYPos,event)\r\n\t\t\ttouchEndHandler: setting[\"touchEndHandler\"],//format function(screenXPos,screenYPos,event)\r\n\t\t\tdoubleTapHandler: setting[\"doubleTapHandler\"],//format function(screenXPos,screenYPos,event)\r\n\t\t\tpinchHandler: setting[\"pinchHandler\"],//format function(scale,event)\r\n\t\t};\r\n\t\tthis.__initObjEvents();\r\n\t\tthis.__addListeners();\r\n\t\tthis.__useConstructor = this.__isMouseEventConstructorExists();\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__initObjEvents = function()\r\n\t{\r\n\t\tthis.__objEvents = {\r\n\t\t\t\"touchstart\":{mouseEventType: \"mousedown\",callback:this.__touchStartHandler.bind(this)},\r\n\t\t\t\"touchmove\":{mouseEventType: \"mousemove\",callback:this.__touchMoveHandler.bind(this)},\r\n\t\t\t\"touchend\":{mouseEventType: \"mouseup\",callback:this.__touchEndHandler.bind(this),fireExtraEvent:this.__fireClickEvent.bind(this)},\r\n\t\t};\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__addListeners = function()\r\n\t{\r\n\t\tvar isTouchSupported = this.isTouchSupported();\r\n\t\tvar isGestureSupported = this.isGestureSupported();\r\n\t\tif (isTouchSupported) \r\n\t\t{\r\n\t\t\tif(!this.__touchEventRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__touchEventRef = this.__touchEventHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"touchstart\",this.__touchEventRef);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"touchmove\",this.__touchEventRef,true);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"touchend\",this.__touchEventRef,true);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"touchcancel\",this.__touchEventRef,true);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.debug(\"NSTouchToMouse\",\"Touch is not supported\");\r\n\t\t}\r\n\t\tif(isGestureSupported)\r\n\t\t{\r\n\t\t\tif(!this.__gestureChangeRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__gestureChangeRef = this.__gestureChangeHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"gesturechange\",this.__gestureChangeRef);\r\n\t\t\t}\r\n\t\t\tif(!this.__gestureEndRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__gestureEndRef = this.__gestureEndHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(this.__element,\"gestureend\",this.__gestureEndRef);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.debug(\"NSTouchToMouse\",\"Gesture is not supported\");\r\n\t\t}\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__touchEventHandler = function(event)\r\n\t{\r\n\t\tif(!this.__objLocal.gestureChanged)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar touch = event.touchEvent;\r\n\t\t\tvar item = this.__objEvents[event.type];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tvar mouseEventType = item.mouseEventType;\r\n\t\t\t\titem.callback(event,touch);\r\n\t\t\t\tthis.__fireMouseEvent(mouseEventType,event,touch);\r\n\t\t\t\tif(item.fireExtraEvent)\r\n                {\r\n                \titem.fireExtraEvent(event,touch);\r\n                }\r\n                event.preventDefault();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.debug(\"NSTouchToMouse\",event.type + \" is not supported\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__gestureChangeHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tthis.__objLocal.gestureChanged = true;\r\n\t\tif(this.__config.pinchHandler)\r\n\t\t{\r\n\t\t\tthis.__config.pinchHandler(event.scale,event);\r\n\t\t}\r\n\t\tthis.__objLocal.preTouchStart = true;\r\n        event.preventDefault();\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__gestureEndHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tthis.__objLocal.gestureChanged = false;\r\n\t\tevent.preventDefault();\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__touchStartHandler = function(event,touch)\r\n\t{\r\n\t\tthis.__fireCallback(\"touchStartHandler\",event,touch);\r\n\t\tthis.__objLocal.preTouchStart = true;\r\n\t\tthis.__objLocal.documentClick = true;\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__touchMoveHandler = function(event,touch)\r\n\t{\r\n\t\tthis.__fireCallback(\"touchMoveHandler\",event,touch);\r\n\t\tthis.__objLocal.preTouchStart = false;\r\n\t\tthis.__objLocal.documentClick = false;\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__touchEndHandler = function(event,touch)\r\n\t{\r\n\t\tif (this.__objLocal.doubleTapWaiting && this.__objLocal.preTouchStart) \r\n\t\t{\t\r\n\t\t\tthis.__fireCallback(\"doubleTapHandler\",event,touch);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tthis.__objLocal.doubleTapWaiting = true;\r\n\t\t\tthis.__fireCallback(\"touchEndHandler\",event,touch);\r\n\t\t\tvar self = this;\r\n\t\t\twindow.setTimeout(function () \r\n\t\t\t{\r\n\t\t\t\tself.__objLocal.doubleTapWaiting = false;\r\n\t\t\t}, this.__config.doubleTapInterval);\t\t\t\t\t\t\t\r\n\t\t}\r\n\t\tthis.__objLocal.preTouchStart = false;\r\n\t};\r\n\t\r\n\tNSTouchToMouse.prototype.__fireClickEvent = function(event,touch)\r\n\t{\r\n\t\tif(this.__objLocal.documentClick)\r\n\t\t{\r\n\t\t\tthis.__fireMouseEvent(\"click\",event,touch);\r\n            this.__objLocal.documentClick = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSTouchToMouse.prototype.__fireMouseEvent = function(mouseEventType,event,touch)\r\n\t{\r\n\t\tif(!this.__config.suppressMouseEvent)\r\n\t\t{\r\n\t\t\tvar mouseEvent = null;\r\n\t\t\tvar option = {bubbles: true,cancelable: true,view:this.win,detail:1,screenX:touch.screenX,screenY:touch.screenY,clientX:touch.clientX,clientY:touch.clientY,ctrlKey:false,\r\n\t\t\t\t\t\t  altKey:false,shiftKey:false,metaKey:false,button:0,relatedTarget:null};\r\n\t\t\tif(this.__useConstructor)\r\n\t\t\t{\r\n\t\t\t\tmouseEvent = new MouseEvent(mouseEventType,option);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmouseEvent = this.doc.createEvent(\"MouseEvent\");\r\n\t\t\t\tmouseEvent.initMouseEvent(mouseEventType,option.bubbles,option.cancelable,option.view,option.detail,\r\n\t\t\t\t\t\t\t\t\t\t  option.screenX,option.screenY,option.clientX,option.clientY,option.ctrlKey,\r\n\t\t\t\t\t\t\t\t\t\t  option.altKey,option.shiftKey,option.metaKey,option.button,option.relatedTarget);\r\n\t\t\t}\r\n\t\t\ttouch.target.dispatchEvent(mouseEvent);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSTouchToMouse.prototype.__isMouseEventConstructorExists = function()\r\n\t{\r\n\t\ttry \r\n\t\t{\r\n\t\t    new MouseEvent(\"test\");\r\n\t\t    return true;\r\n\t\t} \r\n\t\tcatch(error) \r\n\t\t{\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\r\n\tNSTouchToMouse.prototype.__fireCallback = function(callbackKey,event,touch)\r\n\t{\r\n\t\tif(this.__config[callbackKey])\r\n\t\t{\r\n\t\t\tthis.__config[callbackKey](touch.screenX,touch.screenY,event);\r\n\t\t}\r\n\t};\r\n\r\n\treturn NSTouchToMouse;\r\n})();\r\nnsModuleExport(this,\"NSTouchToMouse\",NSTouchToMouse); \"use strict\";\r\nvar NSVirtualScroll = (function()\r\n{\r\n\tfunction NSVirtualScroll(setting) \r\n\t{\r\n\t\tthis.__setting = setting;\r\n\t\tthis.util = null;\r\n\t\tthis.__config = null;\r\n\t\tthis.__internal = {};\r\n\t\tthis.__objProp = {};\r\n\t\tthis.__objSelectedProp = {};\r\n\t\tthis.__domVariables = null;\r\n\t\tthis.__doc = null;\r\n\t\tthis.__win = null;\r\n\t\tthis.__scrollHandlerRef = null;\r\n\t\tthis.__resizeHandlerRef = null;\r\n\t\t\r\n\t\tthis.__initialize();\r\n\t}\r\n\t\r\n\tNSVirtualScroll.prototype.dataSource = function(paramItems)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(paramItems))\r\n\t\t{\r\n\t\t\tvar reInit = false;\r\n\t\t\tif(!this.__internal.itemDimension)\r\n\t\t\t{\r\n\t\t\t\treInit = true;\r\n\t\t\t}\r\n\t\t\tif(this.util.isNumber(paramItems))\r\n\t\t\t{\r\n\t\t\t\tthis.__config.totalLength = parseInt(paramItems);\r\n\t\t\t}\r\n\t\t\telse if(this.util.isArray(paramItems))\r\n\t\t\t{\r\n\t\t\t\tthis.__config.items = paramItems;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__config.totalLength = null;\r\n\t\t\t\tthis.__config.items = [paramItems];\r\n\t\t\t}\r\n            this.__internal.objItemComp = {};\r\n            this.__internal.arrItem = [];\r\n\t\t\tif(reInit)\r\n\t\t\t{\r\n                var item = this.__getItemAt(0);\r\n\t\t\t\tthis.__internal.isItemHtml = this.util.isString(item);\r\n\t\t\t\tthis.__setSize();\r\n\t\t\t}\r\n\t\t\tvar scrollElement = this.__config.scrollElement;\r\n\t\t\tvar scrollPos = scrollElement[this.__objSelectedProp.scroll];\r\n\t\t\tif(this.__internal.items && (this.__internal.items.length * this.__internal.itemDimension < scrollPos)) \r\n\t\t\t{\r\n\t\t\t\tscrollElement[this.__objSelectedProp.scroll] = 0;\r\n\t\t\t\tthis.__internal.lastPageNum = 0;\r\n\t\t    }\r\n\t\t\tthis.__addItems();\r\n\t\t\tscrollElement[this.__objSelectedProp.scroll] = scrollPos;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.refresh = function(isReset)\r\n\t{\r\n\t\tvar currItemSize = this.__internal.itemDimension;\r\n\t\tthis.__setSize();\r\n\t\tvar newItemSize = this.__internal.itemDimension;\r\n\t\tif((currItemSize != newItemSize) || isReset)\r\n\t\t{\r\n\t\t\tvar criteria = null;\r\n\t\t\tif(this.__config.totalLength)\r\n\t\t\t{\r\n\t\t\t\tcriteria = this.__config.totalLength;\r\n\t\t\t}\r\n\t\t\telse if(this.util.isArray(this.__config.items) && this.__config.items && this.__config.items.length)\r\n\t\t\t{\r\n\t\t\t\tcriteria = this.__config.items;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tcriteria = 0;\r\n\t\t\t}\r\n\t\t\tthis.dataSource(criteria);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.getScrollProgress = function()\r\n\t{\r\n\t\tvar scrollPos = this.__internal.scrollPos;\r\n\t\tvar itemSize = this.__internal.itemDimension;\r\n\t\tvar totalSize = this.__internal.arrItem.length * itemSize;\r\n\t\tvar progress = ((scrollPos / totalSize) * 100) || 0;\r\n\t\treturn progress;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.appendItems = function(arrItem)\r\n\t{\r\n\t\tthis.__addNewItems(arrItem,false);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.prependItems = function(arrItem)\r\n\t{\r\n\t\tthis.__addNewItems(arrItem,true);\r\n\t};\r\n\t\r\n\t//assuming that size of all rows are same\r\n\t//if not same add offset\r\n\t//if variable Row size and utility user has original scroll Position then set scrollPosition and pass index as null\r\n\tNSVirtualScroll.prototype.scrollToIndex = function(index,animationRequired,offset,scrollPosition)\r\n\t{\r\n\t\tvar arrItem = this.__internal.arrItem;\r\n\t\tif(arrItem && arrItem.length)\r\n\t\t{\r\n\t\t\tvar scrollPos = null;\r\n\t\t\tif(!this.util.isUndefinedOrNull(index) && index > -1 && index < arrItem.length)\r\n\t\t\t{\r\n\t\t\t\toffset = this.util.isUndefinedOrNull(offset) ? 0 : parseInt(offset);\r\n\t\t\t\tscrollPos = (this.__internal.itemDimension * index) + offset;\r\n\t\t\t}\r\n\t\t\telse if(!this.util.isUndefinedOrNull(scrollPosition))\r\n\t\t\t{\r\n\t\t\t\toffset = 0;\r\n\t\t\t\tscrollPos = scrollPosition;\r\n\t\t\t}\r\n\t\t\tif(!this.util.isUndefinedOrNull(scrollPos))\r\n\t\t\t{\r\n\t\t\t\tvar scrollElement = this.__config.scrollElement;\r\n\t\t\t\tif(animationRequired)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar animation = new this.util.animation(scrollElement,[\r\n\t\t       \t  \t    {\r\n\t\t       \t  \t      time: 500,\r\n\t\t       \t  \t      property:this.__objSelectedProp.scroll,\r\n\t\t       \t  \t      target: scrollPos,\r\n\t\t       \t  \t    }\r\n\t\t       \t  \t]);\r\n\t\t   \t  \t  \tanimation.animate();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tscrollElement[this.__objSelectedProp.scroll] = scrollPos;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t//this function is used for updating items(dom elements) already generated \r\n\tNSVirtualScroll.prototype.updateItems = function(updateCallback) \r\n\t{\r\n\t\tif(this.__internal.arrItem && this.__internal.arrItem.length && updateCallback) \r\n\t\t{\r\n\t\t\tvar arrItem = this.__internal.arrItem;\r\n\t\t\tfor(var count = 0;count < arrItem.length;count++) \r\n\t\t\t{\r\n\t\t\t\tvar item = arrItem[count]; \r\n\t\t\t\titem = updateCallback(item);\r\n\t\t\t\tarrItem[count] = item;\r\n\t\t\t}\r\n\t\t\tthis.__internal.arrItem = arrItem;\r\n\t\t\tthis.__internal.origArrItem = this.__internal.arrItem;\r\n\t\t}\r\n\t}\r\n\t\r\n\tNSVirtualScroll.prototype.destroy = function()\r\n\t{\r\n\t\tvar scrollElement = this.__config.scrollElement;\r\n\t\tvar contentElement = this.__config.contentElement;\r\n\t\tif(this.__internal.contentTabIndex)\r\n\t\t{\r\n\t\t\tcontentElement.setAttribute(\"tabindex\",this.__internal.contentTabIndex);\r\n\t\t}\r\n\t\tthis.util.removeStyleClass(scrollElement,\"nsVirtualScrollElement nsVirtualScrollElement\" + this.util.toCamelCase(this.__config.direction,true));\r\n\t\tthis.util.removeStyleClass(contentElement,\"nsVirtualScrollContent nsVirtualScrollContent\" + this.util.toCamelCase(this.__config.direction,true));\r\n\t\tif(this.__scrollHandlerRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(scrollElement,\"scroll\",this.__scrollHandlerRef);\r\n\t\t\tthis.__scrollHandlerRef = null;\r\n\t\t}\r\n\t\tif(this.__resizeHandlerRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__win,\"resize\",this.__resizeHandlerRef);\r\n\t\t\tthis.__resizeHandlerRef = null;\r\n\t\t}\r\n\t\tif(this.__internal.divLoader)\r\n\t\t{\r\n\t\t\tthis.__internal.divLoader.parentNode.removeChild(this.__internal.divLoader);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__initialize = function()\r\n\t{\r\n\t\tthis.util = new NSUtil();\r\n\t\tif(this.__setting)\r\n\t\t{\r\n\t\t\tthis.__config = {\r\n\t\t\t\t\tscrollElement: this.util.getElement(this.__setting[\"scrollElement\"]),\r\n\t\t\t\t\tcontentElement: this.util.getElement(this.__setting[\"contentElement\"]),\r\n\t\t\t\t\tdirection: this.__setting[\"direction\"] || NSVirtualScroll.DIRECTION_VERTICAL,\r\n\t\t\t\t\titemTag: this.__setting[\"itemTag\"],\r\n\t\t\t\t\tpageSize: parseInt(this.__setting[\"pageSize\"]) || 30,//number of items after the cache will be refreshed\r\n\t\t\t\t\tpagesRendered: parseInt(this.__setting[\"pagesRendered\"]) || 3,//number of items(pageSize * pagesRendered) to be rendered\r\n\t\t\t\t\titems: this.__setting[\"items\"],//array of items, can be html or nodes\r\n\t\t\t\t\ttotalLength: parseInt(this.__setting[\"totalLength\"]) || 0,//either mention items or totalLength and itemCreateCallback\r\n\t\t\t\t\tgetItemComponent: this.__setting[\"getItemComponent\"],\r\n\t\t\t\t\tgetEmptyItemComponent: this.__setting[\"getEmptyItemComponent\"],\r\n\t\t\t\t\tenableScrollDelay: Boolean.parse(this.__setting[\"enableScrollDelay\"]),//for Mobile device which are slow in rendering\r\n\t\t\t\t\tscrollInterval: this.__setting[\"scrollInterval\"],\r\n\t\t\t\t\tenableLoader: Boolean.parse(this.__setting[\"enableLoader\"]),\r\n\t\t\t\t\tgetLoaderComponent: this.__setting[\"getLoaderComponent\"],\r\n\t\t\t\t\tresizeInterval: parseInt(this.__setting[\"resizeInterval\"]) || 150,\r\n\t\t\t\t\tscrollingProgress: this.__setting[\"scrollingProgress\"], //scrollingProgress callback while scrolling like  scrollingProgress(progress)\r\n\t\t\t\t\tpageWillChange: this.__setting[\"pageWillChange\"], //pageWillChange callback before page change like  pageWillChange(oldPage,newPage)\r\n\t\t\t\t\tpageChanged: this.__setting[\"pageChanged\"], //pageChanged callback before page change like  pageChanged(page)\r\n\t\t\t\t};\r\n\t\t\tif(!this.__config.scrollElement)\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSVirtualScroll\",\"scrollElement is not valid\");\r\n\t\t\t}\r\n\t\t\tif(!this.__config.contentElement)\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSVirtualScroll\",\"contentElement is not valid\");\r\n\t\t\t}\r\n\t\t\tthis.__domVariables = this.util.getDomVariables();\r\n\t\t\tthis.__doc = this.__domVariables.doc;\r\n\t\t\tthis.__win = this.__domVariables.win;\r\n\t\t\tif((!this.__config.items || this.__config.items.length == 0) && !this.__config.totalLength)\r\n\t\t\t{\r\n\t\t\t\tthis.__config.items = this.__fetchChildren(contentElement);\r\n\t\t\t}\r\n\t\t\tthis.__setProps();\r\n\t\t\tthis.__setInternalVars();\r\n\t\t\tthis.__create();\r\n\t\t\tthis.__addListeners();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__setProps = function()\r\n\t{\r\n\t\tthis.__objProp = {\r\n\t\t\t    vertical: {\r\n\t\t\t        direction:NSVirtualScroll.DIRECTION_VERTICAL,size: \"height\",offset: \"offsetHeight\",\r\n\t\t\t        scroll: \"scrollTop\", scrollSize: \"scrollHeight\",paddingStart:\"paddingTop\",\r\n\t\t\t        paddingEnd:\"paddingBottom\",marginStart:\"marginTop\",marginEnd:\"marginBottom\"\r\n\t\t\t    },\r\n\t\t\t    horizontal: {\r\n\t\t\t        direction:NSVirtualScroll.DIRECTION_HORIZONTAL,size: \"width\",offset: \"offsetWidth\",\r\n\t\t\t        scroll: \"scrollLeft\", scrollSize: \"scrollWidth\",paddingStart:\"paddingLeft\",\r\n\t\t\t        paddingEnd:\"paddingRight\",marginStart:\"marginLeft\",marginEnd:\"marginRight\"\r\n\t\t\t    }\r\n\t\t};\r\n\t\tthis.__objSelectedProp = this.__objProp[\"vertical\"];\r\n\t\tif(this.__config.direction == NSVirtualScroll.DIRECTION_HORIZONTAL)\r\n\t\t{\r\n\t\t\tthis.__objSelectedProp = this.__objProp[\"horizontal\"];\r\n\t\t}\r\n\t};\r\n\t\r\n\t//call this function only with init is needed\r\n\tNSVirtualScroll.prototype.__setInternalVars = function()\r\n\t{\r\n\t\tif(!this.__internal.itemDimension)\r\n\t\t{\r\n\t\t\tif(this.__config.contentElement.hasAttribute(\"tabindex\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__internal.contentTabIndex = this.__config.contentElement.getAttribute(\"tabindex\");\r\n\t\t\t}\r\n\t\t\tthis.__internal.scrollIntervalID = -1;\r\n\t\t\tthis.__internal.resizeIntervalID = -1;\r\n\t\t\tthis.__internal.scrollPos = -1;\r\n\t\t\tthis.__internal.lastPageNum = -1;\r\n\t\t\tthis.__internal.objItemComp = {};\r\n\t\t\tthis.__internal.objCache = {};\r\n\t\t\tthis.__internal.cssExtraItem = \"nsVirtualExtraItem\" + this.util.toCamelCase(this.__objSelectedProp.direction,true);\r\n\t\t\tthis.__internal.isMobile = this.util.isMobile().any;\r\n\t\t\tif(this.__config.enableScrollDelay && this.util.isUndefinedOrNull(this.__config.scrollInterval))\r\n\t\t\t{\r\n\t\t\t\tthis.__config.scrollInterval = this.__internal.isMobile ? 300 : 0;\r\n\t\t\t}\r\n\t\t\tthis.__internal.divLoader = null;\r\n\t\t\tthis.__addLoader();\r\n\t\t\tthis.__internal.pageSize = this.__config.pageSize;\r\n\t\t\tthis.__internal.pagesRendered = this.__config.pagesRendered;\r\n\t\t\tvar item = this.__getItemAt(0);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__internal.isItemHtml = this.util.isString(item);\r\n\t\t\t\tthis.__setSize();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__internal.itemDimension = 0;\r\n\t\t\t\tthis.__internal.pageDimension = 0;\r\n\t\t\t\tthis.__internal.itemsRendered = 0;\r\n\t\t\t\tthis.__internal.renderedSize = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__setSize = function()\r\n\t{\r\n\t\tthis.__internal.itemDimension = this.__getItemSize();\r\n\t\tthis.__internal.pageDimension = this.__internal.itemDimension * this.__internal.pageSize;\r\n\t\tthis.__internal.itemsRendered = this.__internal.pageSize * this.__internal.pagesRendered;\r\n\t\tthis.__internal.renderedSize = this.__internal.pagesRendered * this.__internal.pageDimension;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__create = function()\r\n\t{\r\n\t\tvar scrollElement = this.__config.scrollElement;\r\n\t\tvar contentElement = this.__config.contentElement;\r\n\t\tthis.util.addStyleClass(scrollElement,\"nsVirtualScrollElement nsVirtualScrollElement\" + this.util.toCamelCase(this.__config.direction,true));\r\n\t\tthis.util.addStyleClass(contentElement,\"nsVirtualScrollContent nsVirtualScrollContent\" + this.util.toCamelCase(this.__config.direction,true));\r\n\t\tcontentElement.setAttribute(\"tabindex\",0);\r\n\t\tif((this.__config.items && this.__config.items.length) || this.__config.totalLength)\r\n\t\t{\r\n\t\t\tvar scrollPos = scrollElement[this.__objSelectedProp.scroll];\r\n\t\t\tthis.__addItems();\r\n\t\t\tscrollElement[this.__objSelectedProp.scroll] = scrollPos;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__addListeners = function()\r\n\t{\r\n\t\tif(!this.__scrollHandlerRef)\r\n\t\t{\r\n\t\t\tthis.__scrollHandlerRef = this.__config.enableScrollDelay ? this.__scrollHandlerWithDelay.bind(this) : this.__scrollHandler.bind(this);\r\n\t\t\tthis.util.addEvent(this.__config.scrollElement,\"scroll\",this.__scrollHandlerRef);\r\n\t\t}\r\n\t\tif(!this.__resizeHandlerRef)\r\n\t\t{\r\n\t\t\tthis.__resizeHandlerRef = this.__resizeHandler.bind(this);\r\n\t\t\tthis.util.addEvent(this.__win,\"resize\",this.__resizeHandlerRef);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__scrollHandlerWithDelay = function(event)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tclearTimeout(this.__internal.scrollIntervalID);\r\n\t\tthis.__internal.scrollIntervalID = setTimeout(function(){\r\n\t\t\tself.__scrollHandler.call(self,event);\r\n\t\t},this.__config.scrollInterval);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__scrollHandler = function(event)\r\n\t{\r\n\t\tthis.__internal.scrollIntervalID = -1;\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar pageNumber = this.__getCurrentPageNum();\r\n\t\tvar lastPageNum = this.__internal.lastPageNum;\r\n\t\tthis.__internal.lastPageNum = pageNumber;\r\n\t\t/*console.log(\"lastPageNum::\" + lastPageNum + \" pageNumber::\" + pageNumber);*/\r\n\t\tif(lastPageNum != pageNumber)\r\n\t\t{\r\n\t\t\t//console.log(\"In Scroll\");\r\n\t\t\tthis.__addItems();\r\n\t\t\tthis.__fireCallback(\"scrollingProgress\",this.getScrollProgress());\r\n\t\t}\r\n\t};\r\n\t\r\n\t//not used for now\r\n\tNSVirtualScroll.prototype.__isScrollingDown = function() {\r\n\t\t  var isScrollingDown = false;\r\n\t\t  var currentScrollPos = this.__config.scrollElement[this.__objSelectedProp.scroll];\r\n\r\n\t\t  if (currentScrollPos > this.__internal.prevScrollPos) {\r\n\t\t    isScrollingDown = true;\r\n\t\t  } else {\r\n\t\t    isScrollingDown = false;\r\n\t\t  }\r\n\r\n\t\t  this.__internal.prevScrollPos = currentScrollPos;\r\n\t\t  return isScrollingDown;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__resizeHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tclearTimeout(this.__internal.resizeIntervalID);\r\n\t\tvar self = this;\r\n\t\tthis.__internal.resizeIntervalID = setTimeout(self.refresh.bind(self), this.__config.resizeInterval);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getItemSize = function()\r\n\t{\r\n\t\tvar contentElement = this.__config.contentElement;\r\n\t\tvar isAdded = false;\r\n\t\tvar size = null;\r\n\t\tif(!contentElement.children.length)\r\n\t\t{\r\n            var itemHtml = this.__getItemAt(0);\r\n\t\t\tthis.__setItemsInDom(itemHtml);\r\n\t\t\tisAdded = true;\r\n\t\t}\r\n\t\tvar item = null;\r\n\t\tvar length = contentElement.children.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\titem = contentElement.children[count];\r\n\t\t\tif(!this.util.hasStyleClass(item,this.__internal.cssExtraItem))\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!this.__config.itemTag)\r\n\t\t{\r\n\t\t\tthis.__config.itemTag = item.tagName.toLowerCase();\r\n\t\t}\r\n\t\tsize = item[this.__objSelectedProp.offset];\r\n\t\tif(this.__config.itemTag == \"tr\")\r\n\t\t{\r\n\t\t\tvar border = this.util.getStyleValue(contentElement,\"borderCollapse\");\r\n\t\t\tif(border != \"collapse\")\r\n\t\t\t{\r\n\t\t\t\tvar borderSpacing = this.util.getStyleValue(contentElement,\"borderSpacing\");\r\n\t\t\t\tsize += this.__getInt(borderSpacing);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar marginStart = this.util.getStyleValue(item,this.__objSelectedProp.marginStart);\r\n\t        var marginEnd = this.util.getStyleValue(item,this.__objSelectedProp.marginEnd);\r\n\t        marginStart = this.__getInt(marginStart);\r\n\t        marginEnd = this.__getInt(marginEnd);\r\n\t        size += Math.max(marginStart, marginEnd);\r\n\t\t}\r\n\t\tif(isAdded)\r\n\t\t{\r\n\t\t\tthis.__setItemsInDom(null);\r\n\t\t}\r\n\t\treturn size;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__addItems = function()\r\n\t{\r\n\t\tvar arrItem = this.__internal.arrItem || [];\r\n\t\tvar itemPage = this.__getPageData(arrItem,this.__getCurrentPageNum());\r\n\t\tvar hasPageContentChanged = this.__hasCacheChanged(\"data\",itemPage.arrItem);\r\n        var hasStartOffsetChanged = this.__hasCacheChanged(\"top\",itemPage.startOffset);\r\n        var hasEndOffsetChanged = this.__hasCacheChanged(\"bottom\",itemPage.endOffset);\r\n        var contentElement = this.__config.contentElement;\r\n        var arrSource = [];\r\n        if(hasPageContentChanged || hasStartOffsetChanged) \r\n        {\r\n            if(itemPage.startOffset) \r\n            {\r\n            \tarrSource.push(this.__getExtraItem(\"nsVirtualTopItem\",itemPage.startOffset));\r\n            }\r\n            arrSource.push.apply(arrSource,itemPage.arrItem);\r\n            if(itemPage.endOffset) \r\n            {\r\n            \tarrSource.push(this.__getExtraItem(\"nsVirtualBottomItem\",itemPage.endOffset));\r\n            }\r\n            this.__fireCallback(\"pageWillChange\",[this.__internal.currentItemPage,itemPage]);\r\n            this.__setItemsInDom(arrSource);\r\n            this.__handleTagAfterRender(itemPage);\r\n            this.__fireCallback(\"pageChanged\",[itemPage]);\r\n            this.__internal.currentItemPage = itemPage;\r\n        } \r\n        else if(hasEndOffsetChanged) \r\n        {\r\n        \tcontentElement.lastChild.style[this.__objSelectedProp.size] = itemPage.endOffset + \"px\";\r\n        }\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__setItemsInDom = function(arrItem,isAdd)\r\n\t{\r\n\t\tthis.__setLoaderVisibility(true);\r\n\t\tvar contentElement = this.__config.contentElement;\r\n\t\tif(this.__internal.isItemHtml)\r\n\t\t{\r\n\t\t\tif(arrItem)\r\n\t\t\t{\r\n\t\t\t\tvar html = this.__convertArrayToString(arrItem);\r\n\t\t\t\tisAdd ? contentElement.innerHTML += html : contentElement.innerHTML = html;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tisAdd ? null : contentElement.innerHTML = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(!isAdd)\r\n\t\t\t{\r\n\t\t\t\t//IE Bug that when Html elements are added(i.e. when this.__internal.isItemHtml is false) you do contentElement.innerHTML = \"\" \r\n\t\t\t\t//then the items being rendered in this.__internal.arrItem also becomes empty\r\n\t\t\t\tif(this.__internal.isItemHtml)\r\n\t\t\t\t{\r\n\t\t\t\t\tcontentElement.innerHTML = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\twhile(contentElement.firstChild) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontentElement.removeChild(contentElement.lastChild);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(arrItem)\r\n\t\t\t{\r\n\t\t\t\tarrItem = this.util.isArray(arrItem) ? arrItem : [arrItem];\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar length = arrItem.length;\r\n\t\t\t\tfor(var count =0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(arrItem[count]) {\r\n\t\t\t\t\t\titem = arrItem[count];\r\n\t\t\t\t\t\tthis.util.isString(item) ? contentElement.innerHTML += item : contentElement.appendChild(item);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__setLoaderVisibility(false);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getAllItems = function(fromIndex,toIndex)\r\n\t{\r\n\t\tif(this.__config.items && this.__config.items.length && this.__config.items.length > fromIndex)\r\n\t\t{\r\n            toIndex = this.__config.items.length > toIndex ? toIndex : this.__config.items.length - 1;\r\n            var arrCloned = this.__config.items.slice();\r\n\t\t\tvar arrItem = arrCloned.splice(fromIndex,toIndex - fromIndex);\r\n\t\t\treturn arrItem;\r\n\t\t}\r\n\t\telse if(this.__config.totalLength && this.__config.getItemComponent)\r\n\t\t{\r\n            fromIndex = this.__config.totalLength > fromIndex ? fromIndex : this.__config.totalLength - 1;\r\n            toIndex = this.__config.totalLength > toIndex ? toIndex : this.__config.totalLength - 1;\r\n            if(!this.__internal.arrItem) {\r\n\t\t\t\tthis.__internal.arrItem = [];\r\n\t\t\t}\r\n\t\t\tvar arrItem = this.__internal.arrItem;\r\n            var arrRet = [];\r\n\t\t\tfor(var count = fromIndex;count < toIndex + 1;count++)\r\n\t\t\t{\r\n                if(arrItem.length > count && arrItem[count]) {\r\n                    arrRet.push(arrItem[count]);\r\n                }\r\n                else {\r\n                    var item = this.__getItemFromComponent(count);\r\n                    arrItem[count] = item;\r\n                    arrRet.push(item);\r\n                }\r\n\t\t\t}\r\n\t\t\treturn arrRet;\r\n\t\t}\r\n\t\treturn [];\r\n\t};\r\n\r\n    NSVirtualScroll.prototype.__getItemAt = function(index) \r\n    {\r\n        if(this.__config.items && this.__config.items.length && this.__config.items.length > index)\r\n\t\t{\r\n           return this.__config.items[index];\r\n\t\t}\r\n        else if(this.__config.arrItem && this.__config.arrItem.length && this.__config.arrItem.length > index && this.__config.arrItem[index])\r\n\t\t{\r\n           return this.__config.arrItem[index];\r\n\t\t}\r\n        else if(this.__config.totalLength > index && this.__config.getItemComponent) {\r\n           return this.__getItemFromComponent(index);\r\n        }\r\n        return null;\r\n    };\r\n\t\r\n\tNSVirtualScroll.prototype.__getItemFromComponent = function(index)\r\n\t{\r\n\t\tvar item = null;\r\n\t\tif(this.__config.totalLength > index)\r\n\t\t{\r\n\t\t\tvar comp = new this.__config.getItemComponent(index);\r\n\t\t\titem = comp.getElement();\r\n\t\t\tthis.__internal.objItemComp[index.toString()] = comp;\r\n\t\t}\r\n\t\treturn item;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getPageData = function(arrItem,pageNum)\r\n\t{\r\n\t\tvar internal = this.__internal;\r\n\t\tvar retItem = null;\r\n        if(this.__config.totalLength === 0)\r\n\t\t{\r\n\t\t\tretItem = {startOffset: 0,endOffset: 0,itemsBefore: 0,arrItem:[this.__getEmptyItem()]};\r\n\t\t}\r\n\t\t/*else if(arrItem.length < internal.pageSize)\r\n\t\t{\r\n            var startIndex = 0;\r\n\t        var endIndex = internal.pageSize;\r\n            var arrRet = this.__getAllItems(startIndex,endIndex);\r\n\t\t\tretItem = {startOffset: 0,endOffset: 0,itemsBefore: 0,arrItem:arrRet};\r\n\t\t}*/\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar startIndex = Math.max((internal.itemsRendered - internal.pageSize) * pageNum, 0);\r\n\t        var endIndex = startIndex + internal.itemsRendered;\r\n            var totalLength = this.__getTotalLength();\r\n\t        var startOffset = Math.max(startIndex * internal.itemDimension, 0);\r\n\t        var endOffset = Math.max((totalLength - endIndex) * internal.itemDimension, 0);\r\n\t        var itemsBefore = startIndex;\r\n\t        if(startOffset < 1) \r\n\t        {\r\n\t        \titemsBefore++;\r\n\t        }\r\n\t        var arrRet = this.__getAllItems(startIndex,endIndex);//arrItem.slice(startIndex,endIndex);\r\n\t        retItem = {startOffset: startOffset,endOffset: endOffset,itemsBefore: itemsBefore,arrItem:arrRet};\r\n\t\t}\r\n\t\tconsole.log(retItem);\r\n\t\treturn retItem;\r\n\t};\r\n\r\n    NSVirtualScroll.prototype.__getTotalLength = function() \r\n    {\r\n        if(this.__config.items && this.__config.items.length)\r\n\t\t{\r\n           return this.__config.items.length;\r\n\t\t}\r\n        else if(this.__config.totalLength && this.__config.getItemComponent) {\r\n           return this.__config.totalLength;\r\n        }\r\n        return 0;\r\n    };\r\n\t\r\n\tNSVirtualScroll.prototype.__addNewItems = function(arrNewItem,isPrepend)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(arrNewItem))\r\n\t\t{\r\n\t\t\tarrNewItem = this.util.isArray(arrNewItem) ? arrNewItem : [arrNewItem];\r\n\t\t\tif(arrNewItem && arrNewItem.length)\r\n\t\t\t{\r\n\t\t\t\tvar arrItem = [];\r\n\t\t\t\tfor(var count = 0;count < arrNewItem.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrItem.push(arrNewItem.items[count]);\r\n\t\t\t\t}\r\n\t\t\t\tvar arrExisting = this.__internal.arrItem;\r\n\t\t\t\tthis.__internal.arrItem = isPrepend ? arrItem.concat(arrExisting) : arrExisting.concat(arrItem);\r\n\t\t\t\tthis.__addItems();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__handleTagAfterRender = function(itemPage)\r\n\t{\r\n\t\tvar contentElement = this.__config.contentElement;\r\n\t\tif(this.__config.itemTag == \"ol\")\r\n\t\t{\r\n\t\t\tcontentElement.setAttribute(\"start\", itemPage.itemsBefore);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__fetchChildren = function(element)\r\n\t{\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\tvar arrChildren = element.children;\r\n\t\t\tvar arrRet = [];\r\n\t\t\tvar length = arrChildren.length;\r\n\t\t\tvar child = null;\r\n\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tchild = arrChildren[count];\r\n\t\t\t\tarrRet.push(this.__getItemHtml(child));\r\n\t\t\t}\r\n\t\t\treturn arrRet;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__fireCallback = function(callbackName,args)\r\n\t{\r\n\t\tif(this.__config[callbackName]) {\r\n\t\t\tthis.__config[callbackName](args);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__hasCacheChanged = function(key,value)\r\n\t{\r\n\t\tvar changed = (value != this.__internal.objCache[key]);\r\n\t\tthis.__internal.objCache[key] = value;\r\n\t    return changed;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getCurrentPageNum = function()\r\n\t{\r\n\t\tthis.__internal.scrollPos = this.__config.scrollElement[this.__objSelectedProp.scroll];\r\n\t\tvar pageNum = Math.floor(this.__internal.scrollPos / (this.__internal.renderedSize - this.__internal.pageDimension)) || 0;\r\n\t\t//console.log(this.__internal.scrollPos + \",\" + this.__internal.renderedSize + \",\" + this.__internal.pageDimension + \",\" + pageNum);\r\n\t\treturn pageNum;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getExtraItem = function(cssClass,size)\r\n\t{\r\n\t\tvar item = this.util.createElement(this.__config.itemTag,null,this.__internal.cssExtraItem,this.__doc);\r\n\t\tcssClass && this.util.addStyleClass(item,cssClass);\r\n\t\tsize && (item.style[this.__objSelectedProp.size] = size + \"px\");\r\n\t\treturn (this.__internal.isItemHtml ? this.__getItemHtml(item) : item);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getEmptyItem = function()\r\n\t{\r\n\t\tif(this.__config.getEmptyItemComponent)\r\n\t\t{\r\n\t\t\tvar comp = new this.__config.getEmptyItemComponent();\r\n\t\t\treturn (this.__internal.isItemHtml ? this.__getItemHtml(comp.getElement()) : comp.getElement());\r\n\t\t}\r\n\t\tvar item = this.util.createElement(this.__config.itemTag,null,null,this.__doc);\r\n\t\tif(this.__config.itemTag == \"tr\")\r\n\t\t{\r\n\t\t\titem.innerHTML = \"<td colSpan='1000'></td>\";\r\n\t\t}\r\n\t\treturn (this.__internal.isItemHtml ? this.__getItemHtml(item) : item);\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getItemHtml = function(item)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\treturn this.util.isString(item) ? item : item.outerHTML;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__addLoader = function()\r\n\t{\r\n\t\tif(this.__config.enableLoader)\r\n\t\t{\r\n\t\t\tthis.__internal.divLoader = this.util.createDiv(null,\"nsVirtualScrollLoader\");\r\n\t\t\tvar divText = null;\r\n\t\t\tif(this.__config.getLoaderComponent)\r\n\t\t\t{\r\n\t\t\t\tvar comp = new this.__config.getLoaderComponent();\r\n\t\t\t\tdivText = comp.getElement();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdivText = this.util.createDiv(null,\"nsVirtualScrollLoaderTextCon\");\r\n\t\t\t\tdivText.innerHTML = \"<b class=\\\"nsVirtualScrollLoaderText\\\">Rendering...</b>\";\r\n\t\t\t}\r\n\t\t\tthis.__internal.divLoader.appendChild(divText);\r\n\t\t\tthis.__setLoaderVisibility(false);\r\n\t\t\tthis.__config.scrollElement.appendChild(this.__internal.divLoader);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__setLoaderVisibility = function(isShow)\r\n\t{\r\n\t\tif(this.__internal.divLoader)\r\n\t\t{\r\n\t\t\tthis.__internal.divLoader.style.display = isShow ? \"\" : \"none\";\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__convertArrayToString = function(arrItem,separator)\r\n\t{\r\n\t\tif(arrItem)\r\n\t\t{\r\n\t\t\tseparator = separator ? separator : \"\";\r\n\t\t\treturn this.util.isArray(arrItem) ? arrItem.join(separator) : arrItem;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\t\r\n\tNSVirtualScroll.prototype.__getInt = function(value)\r\n\t{\r\n\t\treturn parseInt(value,10) || 0;\r\n\t};\r\n\t\r\n\tNSVirtualScroll.DIRECTION_VERTICAL = \"vertical\";\r\n\tNSVirtualScroll.DIRECTION_HORIZONTAL = \"horizontal\";\r\n\t\r\n\treturn NSVirtualScroll;\r\n})();\r\nnsModuleExport(this,\"NSVirtualScroll\",NSVirtualScroll);\r\n\"use strict\"; \r\nvar NSFlatGrid = (function()\r\n{\r\n\tfunction NSFlatGrid(nsGrid,nsUtil) \r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = nsUtil;\r\n\t}\r\n\t/********************************Common Functions for Grid ****************************************/\r\n\tNSFlatGrid.prototype.__initialize = function ()\r\n\t{\r\n\t\t\r\n\t};\r\n\t\r\n\t\r\n\tNSFlatGrid.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty) \r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t\tif(attributeName === \"pagesize\" && parseInt(newVal) > 0)\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__pageSize = parseInt(newVal);\r\n\t\t\tthis.__nsGrid.dataSource(this.__nsGrid.__dataSource,true);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.dataSource = function(source)\r\n\t{\r\n\t\tthis.__nsGrid.__arrWrapper = this.__nsGrid.__dataSource.slice(0);\r\n\t\tthis.__nsGrid.__arrFilteredGroupedSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true);\r\n\t\tif(this.__nsGrid.__enablePagination)\r\n\t\t{\r\n\t\t\t/*if(!this.__nsGrid.__isPaginationTypeScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__createPaginationControl(this.__nsGrid.__divOuterContainer);\r\n\t\t\t}*/\r\n\t\t\tif(this.__nsGrid.__isPaginationModeAuto)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__updateTotalRecords(this.__nsGrid.__arrWrapper.length);\r\n\t\t\t\tif(this.__nsGrid.__isPaginationTypeScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);//this.__nsGrid.__arrWrapper.slice(0,this.__nsGrid.__INFINITE_SCROLL_INITIAL_LOAD);\r\n\t\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforScrollPagination.bind(this);\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforPagePagination.bind(this);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\t\tthis.__nsGrid.__updateTotalRecords();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\tthis.__nsGrid.__updateTotalRecords();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.afterGridRendered = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.arrowClickHandler = function(parentItem,isCollapse) \r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.expandCollapseHandler = function(item,isCollapse)\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__createBody = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__createBodyBody= function(dataSet,startIndex,endIndex)\r\n\t{\r\n\t    if(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \t for (var rowIndex = startIndex; rowIndex < endIndex; rowIndex++)\r\n\t\t     {\r\n\t    \t\tvar item = dataSet[rowIndex];\r\n\t    \t\tthis.__createRow(item);\r\n\t\t     }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__setSourceForAsync= function()\r\n\t{\r\n\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__createRowAsync= function(item,index,array)\r\n\t{\r\n\t\tthis.__createRow(item);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__createBodyBodyVirtual= function(dataSet,totalRows)\r\n\t{\r\n\t\tif(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tif(totalRows > dataSet.length)\r\n\t    \t{\r\n\t    \t\ttotalRows = dataSet.length;\r\n\t    \t}\r\n\t    \telse if(this.__nsGrid.__enableVariableRowHeight)\r\n\t    \t{\r\n\t    \t\ttotalRows = totalRows + this.__nsGrid.__extraRowCountForVariableHeight;\r\n\t    \t}\r\n\t    \tthis.__createBodyBody(dataSet,0,totalRows);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__checkForAdditionalColumns = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__addSVGInPage = function(objSVG)\r\n\t{\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__setMeasurement = function()\r\n\t{\r\n\t\t\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__resetDataInBody= function(fromIndex,toIndex)\r\n\t{\r\n\t\tvar row = null;\r\n\t\tvar item = null;\r\n\t\tvar arrRows = this.__nsGrid.__tblCenterBodyBody.rows;\r\n\t\tvar rowLength = arrRows.length;\r\n\t\tvar length = this.__nsGrid.__arrInternalSource.length;\r\n\t\tvar rowCount = 0;\r\n\t\tfor(var count = fromIndex; count < length; count++)\r\n\t    {\r\n\t\t\tif(rowLength <= rowCount) \r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\trow = arrRows[rowCount];\r\n\t\t\titem = this.__nsGrid.__arrInternalSource[count];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__resetRow(row,item[this.__nsGrid.__fieldIndex],item);\r\n\t\t\t\trowCount++;\r\n\t\t\t}\r\n\t    }\r\n\t\tfor(var rowIndex = rowCount;rowIndex < rowLength;rowIndex++)\r\n\t\t{\r\n\t\t\trow = arrRows[rowIndex];\r\n\t\t\trow.style.display = \"none\";\r\n\t\t\trow.setAttribute(\"ns-index\",null);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tif(!offset)\r\n\t\t\t{\r\n\t\t\t\toffset = 0;\r\n\t\t\t}\r\n\t\t\tvar length = source.length;;\r\n\t\t\tvar count = 0;\r\n\t\t\tvar item = null;\r\n\t\t\tvar index = -1; \r\n\t\t\tif(this.__nsGrid.__renderInCachedMode)\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tindex = offset + count;\r\n\t\t\t\t\tthis.__setRowItemProperty(item,index,setFieldIndex);\r\n\t\t\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\t\t\tvar arrCellsText = [];\r\n\t\t\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t            var cellDiv = this.util.createDiv(null);\r\n\t\t\t            this.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t\t\t            this.__nsGrid.__addCellText(null,item,cellDiv,colItem,colIndex);\r\n\t\t\t            arrCellsText.push(cellDiv);\r\n\t\t\t        }\r\n\t\t\t\t\titem[this.__nsGrid.__fieldCellText] = arrCellsText;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tindex = offset + count;\r\n\t\t\t\t\tthis.__setRowItemProperty(item,index,setFieldIndex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__updateCellText = function(row,cell,item,colItem,rowIndex,colIndex)\r\n\t{\r\n\t\tif(cell && item && colItem)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(cell);\r\n\t\t\tif(this.__nsGrid.__renderInCachedMode)\r\n\t    \t{\r\n\t    \t\tthis.__renderCellHTML(row,cell,item,colItem,colIndex);\r\n\t    \t}\r\n\t    \telse\r\n\t    \t{\r\n\t    \t\t this.__renderCellNormal(row,cell,item,colItem,colIndex);\r\n\t    \t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__getFlatSource = function(onlySource)\r\n\t{\r\n\t\treturn this.__nsGrid.__arrWrapper;\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t{\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__handleOnDemandClick = function(item,event)\r\n\t{\r\n\t};\r\n\t\r\n\t/********************************Common Functions for Grid ****************************************/\r\n\tNSFlatGrid.prototype.__createRow = function(item,itemIndex,isAdd)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tisAdd = this.util.isUndefinedOrNull(isAdd) ? true : Boolean.parse(isAdd);\r\n\t\t\tvar row = document.createElement(\"TR\");\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\t\tthis.__nsGrid.__setBodyRowProperty(row,item,index);\r\n\t\t\tthis.__nsGrid.__applyCustomClass(row,\"bodyRow\");\r\n\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t    \tvar cell =  this.__nsGrid.__createBodyRowCell(row,colIndex,false);\r\n\t\t    \tif(this.__nsGrid.__renderInCachedMode)\r\n\t\t    \t{\r\n\t\t    \t\tthis.__renderCellHTML(row,cell,item,colItem,colIndex);\r\n\t\t    \t}\r\n\t\t    \telse\r\n\t\t    \t{\r\n\t\t    \t\t this.__renderCellNormal(row,cell,item,colItem,colIndex);\r\n\t\t    \t}\r\n\t\t    \tthis.__nsGrid.__setBodyCellProperties.bind(this.__nsGrid)(cell);\r\n\t\t    }\r\n\t\t\tif(isAdd)\r\n\t\t\t{\r\n\t\t\t\tvar addRow = true;\r\n\t\t\t\tif(!this.util.isUndefinedOrNull(itemIndex) && itemIndex > -1 && this.__nsGrid.__tblCenterBodyBody.children \r\n\t\t\t\t\t\t&& this.__nsGrid.__tblCenterBodyBody.children.length > itemIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar prevRow = this.__nsGrid.__tblCenterBodyBody.children[itemIndex]; //this.__nsGrid.__getRowByIndex(itemIndex);\r\n\t\t\t\t\tif(prevRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.insertBefore(row,prevRow);\r\n\t\t\t\t\t\taddRow = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(addRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.appendChild(row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__createFixedBodyRow(row);\r\n\t\t\treturn row;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__renderCellNormal = function(row,cell,item,colItem,colIndex)\r\n\t{\r\n\t\t var cellDiv = this.util.createDiv(null);\r\n\t     this.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t     this.__nsGrid.__addCellText(row,item,cellDiv,colItem,colIndex);\r\n\t     //this.__nsGrid.__highlightDiv(cellDiv,colIndex);\r\n\t     cell.appendChild(cellDiv);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__renderCellHTML = function(row,cell,item,colItem,colIndex)\r\n\t{\r\n\t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t\tcell.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t\t//this.__nsGrid.__highlightDiv(cell.firstChild,colIndex);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__updateRow = function(row,item)\r\n\t{\r\n\t\tif(row && item)\r\n\t\t{\r\n\t\t\tif(item[this.__nsGrid.__fieldSelected])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar cells = row.cells;\r\n\t\t\tfor (var colIndex = 0; colIndex < this.__nsGrid.__columns.length; colIndex++)\r\n\t        {\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t        \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t        \tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__setRowItemProperty = function(item,rowIndex,setFieldIndex)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tif(setFieldIndex)\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIndex] = rowIndex;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldVisibleIndex] = rowIndex + 1;\r\n\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__resetRow = function(row,index,item)\r\n\t{\r\n\t\trow.style.display = \"\";\r\n\t\trow.setAttribute(\"ns-index\",index);\r\n\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\tthis.__updateRow(row,item);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__addRowsforScrollPagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//console.log(\"In __addRowsforScrollPagination \" + fromRecord + \",\" + toRecord + \",\" + pageSize);\r\n\t\tvar arrArray = this.__nsGrid.__arrInternalSource.slice(fromRecord,toRecord + 1); \r\n\t\tthis.__nsGrid.__addRemoveRowCallInternal = true;\r\n\t\tthis.__nsGrid.addRows(arrArray);\r\n\t};\r\n\t\r\n\tNSFlatGrid.prototype.__addRowsforPagePagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//slice returns index range from fromRecord to toRecord - 1 hence adding 1 \r\n\t\t//this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(fromRecord,toRecord + 1);\r\n\t\tthis.__nsGrid.__resetDataInBody(fromRecord,toRecord);\r\n\t};\r\n\t\r\n\treturn NSFlatGrid;\r\n})();\r\nnsModuleExport(this,\"NSFlatGrid\",NSFlatGrid);\r\n \"use strict\"; \r\nvar NSHierarchicalGrid = (function()\r\n{\r\n\tfunction NSHierarchicalGrid(nsGrid,nsUtil) \r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = nsUtil;\r\n\t\t\r\n\t\tthis.__ARROW_COLLAPSE_PATH = \"M 0 9.99994L 6.10352e-005 -3.05176e-005L 5 5.00006L 0 9.99994 Z\";\r\n\t\tthis.__ARROW_EXPANDED_PATH = \"M 0 3.05176e-005L 9.99994 9.15527e-005L 4.99988 5.00003L 0 3.05176e-005 Z\";\r\n\t\tthis.__CLASS_ARROW = \"nsGridArrowFill\";\r\n\t\tthis.__rowCounter = -1;\r\n\t\tthis.__enableOnDemandHierarchy = false;\r\n\t\tthis.__onDemandChildDetectionField = \"hasChildren\";\r\n\t\tthis.__onDemandChildFetchCallback = null;\r\n\t}\r\n\t/********************************Common Functions for Grid ****************************************/\r\n\tNSHierarchicalGrid.prototype.__initialize = function ()\r\n\t{\r\n\t\tvar setting = this.__nsGrid.__setting;\r\n\t\tif(setting.hasOwnProperty(\"enableOnDemandHierarchy\"))\r\n\t\t{\r\n\t\t\tthis.__enableOnDemandHierarchy = Boolean.parse(setting[\"enableOnDemandHierarchy\"]);\r\n\t\t}\r\n\t\tif(this.__enableOnDemandHierarchy)\r\n\t\t{\r\n\t\t\tif(setting.hasOwnProperty(\"onDemandChildDetectionField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__onDemandChildDetectionField = setting[\"onDemandChildDetectionField\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"onDemandChildFetchCallback\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__onDemandChildFetchCallback = setting[\"onDemandChildFetchCallback\"];\r\n\t\t\t\tthis.__onDemandChildFetchCallback = this.util.getFunction(this.__onDemandChildFetchCallback);\r\n\t\t\t}\r\n\t\t\tif(!this.__onDemandChildDetectionField)\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSGrid\",\"Value for onDemandChildDetectionField is not valid\");\r\n\t\t\t}\r\n\t\t\tif(!this.__onDemandChildFetchCallback)\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSGrid\",\"Value for onDemandChildFetchCallback is not valid\");\r\n\t\t\t}\r\n\t\t\tif(this.__enableVirtualScroll || (this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto))\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"As VirtualScroll or Pagination Mode is true so OnDemandHierarchy will have no impact.\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty) \r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.dataSource = function(source)\r\n\t{\r\n\t\tthis.__nsGrid.__arrWrapper = this.__nsGrid.__dataSource.slice(0);\r\n\t\tthis.__nsGrid.__arrFilteredGroupedSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true,true,true);\r\n\t\tthis.__nsGrid.__updateTotalRecords(this.__rowCounter);\r\n\t\tif(this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__isPaginationTypeScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__INFINITE_SCROLL_INITIAL_LOAD);\r\n\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforScrollPagination.bind(this);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__pageSize);\r\n\t\t\t\tthis.__nsGrid.__createPaginationControl(this.__nsGrid.__divOuterContainer);\r\n\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforPagePagination.bind(this);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t\tif(item && arrChildren && arrChildren.length > 0)\r\n\t\t{\r\n\t\t\tif(!item[this.__nsGrid.__childField])\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__childField] = [];\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__childField].push.apply(item[this.__nsGrid.__childField], arrChildren);\r\n\t\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true,false,false);\r\n\t\t\tthis.__nsGrid.__updateTotalRecords(this.__rowCounter);\r\n\t\t\tif(!(this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto))\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t\t\titem[this.__nsGrid.__fieldIsCollapsed] = false;\r\n\t\t   \t\tvar row = this.__nsGrid.__getRowFromItem(item);\r\n\t\t   \t\tvar rowIndex = this.__nsGrid.__getIndexByItem(item);\r\n\t\t   \t\tthis.__nsGrid.__showHideRow(rowIndex,null,false);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.afterGridRendered = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.arrowClickHandler = function(parentItem,isCollapse) \r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.expandCollapseHandler = function(item,isCollapse)\r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__createBodyBody= function(dataSet,startIndex,endIndex)\r\n\t{\r\n\t    if(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tfor (var rowIndex = startIndex; rowIndex < endIndex; rowIndex++)\r\n\t\t    {\r\n\t    \t\tvar item = dataSet[rowIndex];\r\n\t    \t\tthis.__createRow(item);\r\n\t\t    }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setSourceForAsync= function()\r\n\t{\r\n\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__createRowAsync= function(item,index,array)\r\n\t{\r\n\t\tthis.__createRow(item);\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__createBodyBodyVirtual= function(dataSet,totalRows,level)\r\n\t{\r\n\t\tif(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tif(totalRows > dataSet.length)\r\n\t    \t{\r\n\t    \t\ttotalRows = dataSet.length;\r\n\t    \t}\r\n\t    \telse if(this.__nsGrid.__enableVariableRowHeight)\r\n\t    \t{\r\n\t    \t\ttotalRows = totalRows + this.__nsGrid.__extraRowCountForVariableHeight;\r\n\t    \t}\r\n\t    \tthis.__createBodyBody(dataSet,0,totalRows);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__createBody = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__checkForAdditionalColumns = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setMeasurement = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__addSVGInPage = function(objSVG)\r\n\t{\r\n\t\tobjSVG.addPath(\"svgArrowDown\",this.__ARROW_EXPANDED_PATH,\"0 0 16 16\");\r\n\t\tobjSVG.addPath(\"svgArrowRight\",this.__ARROW_COLLAPSE_PATH,\"0 0 16 16\");\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tif(level === 0)\r\n\t\t\t{\r\n\t\t\t\tif(!offset)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = 0;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource = [];\r\n\t\t\t\tthis.__rowCounter = offset;\r\n\t\t\t}\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar count = 0;\r\n\t\t\tvar item = null;\r\n\t\t\tif(this.__nsGrid.__renderInCachedMode)\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\t\t\tvar arrCellsText = [];\r\n\t\t\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t            var cellDiv = this.util.createDiv(null);\r\n\t\t\t            this.__nsGrid.__addCellText(null,item,cellDiv,colItem,colIndex);\r\n\t\t\t            arrCellsText.push(cellDiv);\r\n\t\t\t        }\r\n\t\t\t\t\titem[this.__nsGrid.__fieldCellText] = arrCellsText;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*useVisibleIndex flag is used when we want to use visible index,generally true for all cases except for expandCollapse all due to performance issues*/  \r\n\tNSHierarchicalGrid.prototype.__resetDataInBody= function(fromIndex,toIndex,fromRowIndex,useVisibleIndex)\r\n\t{\r\n\t\tif(!fromRowIndex)\r\n\t\t{\r\n\t\t\tfromRowIndex = 0;\r\n\t\t}\r\n\t\tvar row = null;\r\n\t\tvar item = null;\r\n\t\tvar arrRows = this.__nsGrid.__tblCenterBodyBody.rows;\r\n\t\tvar rowLength = arrRows.length;\r\n\t\tvar length = this.__nsGrid.__arrFlatHierarchicalSource.length;\r\n\t\tvar indexCount = fromIndex;\r\n\t\tvar rowCount = fromRowIndex;\r\n\t\tfor(var count = fromIndex; count < length; count++)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll && useVisibleIndex)\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__getVisibleItemByIndex(this.__nsGrid.__arrFlatHierarchicalSource,count);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__arrFlatHierarchicalSource[count];\r\n\t\t\t}\r\n\t\t\t//breaking if item not found as if large data set is rendered and after collapse all the while scrolling after a while item is null still it goes to end of data set which are hidden\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(item[this.__nsGrid.__fieldRowVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLength <= rowCount) // || indexCount > toIndex\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trow = arrRows[rowCount];\r\n\t\t\t\t\tthis.__resetRow(row,item);\r\n\t\t\t\t\tindexCount++;\r\n\t\t\t\t\trowCount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(var rowIndex = rowCount;rowIndex < rowLength;rowIndex++)\r\n\t\t{\r\n\t\t\trow = arrRows[rowIndex];\r\n\t\t\trow.style.display = \"none\";\r\n\t\t\trow.setAttribute(\"ns-index\",null);\r\n\t\t\trow.setAttribute(\"ns-level\",null);\r\n\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__updateCellText = function(row,cell,item,colItem,rowIndex,colIndex)\r\n\t{\r\n\t\tif(cell && item && colItem)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(cell);\r\n\t\t\tvar cellDiv = this.util.createDiv(null);\r\n\t\t\tvar divText = this.__setBodyCellProperty(row,cell,cellDiv,item,rowIndex,colItem,colIndex,item[this.__nsGrid.__fieldParentIndex],item[this.__nsGrid.__fieldRowLevel]);\r\n\t\t\t//this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t\t\tcell.appendChild(cellDiv);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__getFlatSource = function()\r\n\t{\r\n\t\treturn this.__nsGrid.__arrFlatHierarchicalSource;\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t{\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__isOnDemandHasChildren = function(item)\r\n\t{\r\n\t\treturn (this.__enableOnDemandHierarchy && item[this.__onDemandChildDetectionField]);\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__handleOnDemandClick = function(item,event)\r\n\t{\r\n\t\tif(item && this.__isOnDemandHasChildren(item))\r\n\t\t{\r\n\t\t\tif(this.__onDemandChildFetchCallback)\r\n\t\t\t{\r\n\t\t\t\tevent = this.util.getEvent(event);\r\n\t\t\t\tvar rowLevel = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\t\tvar rowIndex = this.__nsGrid.__getIndexByItem(item);\r\n\t\t\t\tthis.__onDemandChildFetchCallback(item,rowIndex,rowLevel,event);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t/********************************End of Common Functions for Grid ****************************************/\r\n\tNSHierarchicalGrid.prototype.__createRow = function(item,itemIndex,isAdd)\r\n\t{\r\n\t\tif(item && item[this.__nsGrid.__fieldRowVisible])\r\n\t\t{\r\n\t\t\tisAdd = this.util.isUndefinedOrNull(isAdd) ? true : Boolean.parse(isAdd);\r\n\t\t\tvar row = document.createElement(\"TR\");\r\n\t\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\tthis.__nsGrid.__setBodyRowProperty(row,item,index);\r\n\t\t\tthis.__nsGrid.__applyCustomClass(row,\"bodyRow\");\r\n\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t    {\r\n\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\tvar cell =  this.__nsGrid.__createBodyRowCell(row,colIndex,true);\r\n\t            var cellDiv = cell.firstChild;\r\n\t            var divText = this.__setBodyCellProperty(row,cell,cellDiv,item,index,colItem,colIndex,parentIndex,level);\r\n\t            //this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t            cell.appendChild(cellDiv);\r\n\t            this.__nsGrid.__setBodyCellProperties.bind(this.__nsGrid)(cell);\r\n\t\t    }\r\n\t\t\tif(isAdd)\r\n\t\t\t{\r\n\t\t\t\tvar addRow = true;\r\n\t\t\t\tif(!this.util.isUndefinedOrNull(itemIndex) && itemIndex > 0 && this.__nsGrid.__tblCenterBodyBody.children \r\n\t\t\t\t\t\t&& this.__nsGrid.__tblCenterBodyBody.children.length >= itemIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar prevRow = this.__nsGrid.__tblCenterBodyBody.children[itemIndex - 1]; //this.__nsGrid.__getRowByIndex(itemIndex);\r\n\t\t\t\t\tif(prevRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.insertBefore(row,prevRow);\r\n\t\t\t\t\t\taddRow = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(addRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.appendChild(row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__createFixedBodyRow(row);\r\n\t\t\treturn row;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__updateRow = function(row,item)\r\n\t{\r\n\t\tif(row && item)\r\n\t\t{\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t\t}\r\n\t\t\tif(item[this.__nsGrid.__fieldSelected])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\tvar cells = row.cells;\r\n\t\t\tfor (var colIndex = 0; colIndex < this.__nsGrid.__columns.length; colIndex++)\r\n\t        {\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setRowItemProperty = function(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar totalRowCount = this.__rowCounter;\r\n\t\t\tif(setFieldIndex || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldIndex]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIndex] = totalRowCount;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldVisibleIndex] = totalRowCount;\r\n\t\t\titem[this.__nsGrid.__fieldRowLevel] = level;\r\n\t\t\tvar hasChild = false;\r\n\t\t\tif((item[this.__nsGrid.__childField] && item[this.__nsGrid.__childField].length > 0)  || (this.__isOnDemandHasChildren(item)))\r\n\t\t    {\r\n\t\t    \thasChild = true;\r\n\t\t    \tthis.__setWrapperSource(item[this.__nsGrid.__childField],0,totalRowCount,level + 1,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t    }\r\n\t\t\titem[this.__nsGrid.__fieldParentIndex] = parentIndex;\r\n\t\t\tif(parentIndex > -1)\r\n\t\t    {\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = true;\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = false;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldHasChild] = hasChild;\r\n\t\t\tif(setItemVisible || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldRowVisible]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t\t}\r\n\t\t\tif(setIsCollapsed || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldIsCollapsed]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIsCollapsed] = this.__isOnDemandHasChildren(item);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setBodyCellProperty = function(row,cell,cellDiv,item,currentIndex,colItem,colIndex,parentIndex,level)\r\n\t{\r\n\t\tvar hierarchicalPadding = 0;\r\n\t\tvar divText = null;\r\n\t\tif(colItem && colItem.hasOwnProperty(\"dataField\") && colItem[\"dataField\"])\r\n\t\t{\r\n\t        if(colIndex == 0 && ((item[this.__nsGrid.__childField]  && item[this.__nsGrid.__childField].length > 0) || (this.__isOnDemandHasChildren(item))))\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_GROUP_CELL);\r\n\t        \tthis.__nsGrid.__createArrow(item,currentIndex,cellDiv,item[this.__nsGrid.__fieldIsCollapsed],colItem);\r\n\t        \tvar cellText = this.util.createDiv(null,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tcellText.style.verticalAlign = \"top\";\r\n\t        \tdivText = cellText;\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellText.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellText,colItem,colIndex);\r\n\t        \t}\r\n\t        \tthis.util.addStyleClass(cellText,\"nsGroupCellText\");\r\n\t        \tcellDiv.appendChild(cellText);\r\n\t        }\r\n\t        else\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellDiv.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellDiv,colItem,colIndex);\r\n\t        \t}\r\n\t        \tdivText = cellDiv;\r\n\t        \t//24 = 16(Arrow Width) + 6(Arrow Parent Padding) + 2(cellDiv horizontalGap between elements shown in debugger)\r\n\t        \thierarchicalPadding = 24;\r\n\t        }\r\n\t        if(colIndex == 0)\r\n\t        {\r\n\t        \tif(level === 0 || !this.__nsGrid.__showExpandCollapseIcon)\r\n\t        \t{\r\n\t        \t\tcell.style.paddingLeft = \"1px\";\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tvar paddingLeft = (10 * level) + hierarchicalPadding;\r\n\t        \t\tcell.style.paddingLeft = paddingLeft + \"px\";\r\n\t        \t}\r\n\t        }\r\n\t\t}\r\n\t\tthis.__nsGrid.__addPriorityClassInCell(cell,colItem);\r\n\t\treturn divText;\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__createArrow = function(compArrow,objSVG,arrowID,isCollapsed,item,colItem)\r\n\t{\r\n\t\t if(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t {\r\n\t\t\t this.__setArrowDirection(compArrow,isCollapsed,colItem);\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t var svg = objSVG.addSVG(compArrow,arrowID + \"svg\",this.__CLASS_ARROW,null,null,null,null,null,null,true);\r\n\t\t\t this.util.addStyleClass(svg,this.__CLASS_ARROW + \"Theme\");\r\n\t\t\t if(isCollapsed)\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgArrowRight\");\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgArrowDown\");\r\n\t\t\t }\r\n\t\t }\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__setArrowDirection = function(compArrow,isCollapsed,colItem)\r\n\t{\r\n\t\tif(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t{\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowCollapsed\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowExpanded\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tvar useID = compArrow.getAttribute(\"id\") + \"use\";\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgArrowRight\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgArrowDown\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__resetRow = function(row,item)\r\n\t{\r\n\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\trow.style.display = \"\";\r\n\t\trow.setAttribute(\"ns-index\",index);\r\n\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\tthis.__updateRow(row,item);\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__addRowsforScrollPagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//console.log(\"In __addRowsforScrollPagination \" + fromRecord + \",\" + toRecord + \",\" + pageSize);\r\n\t\tvar arrArray = this.__nsGrid.__arrFlatHierarchicalSource.slice(fromRecord,toRecord + 1); \r\n\t\tthis.__nsGrid.__addRemoveRowCallInternal = true;\r\n\t\tthis.__nsGrid.addRows(arrArray);\r\n\t};\r\n\t\r\n\tNSHierarchicalGrid.prototype.__addRowsforPagePagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//slice returns index range from fromRecord to toRecord - 1 hence adding 1 \r\n\t\t//this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(fromRecord,toRecord + 1);\r\n\t\tthis.__nsGrid.__resetDataInBody(fromRecord,toRecord);\r\n\t};\r\n\t\r\n\treturn NSHierarchicalGrid;\r\n})();\r\nnsModuleExport(this,\"NSHierarchicalGrid\",NSHierarchicalGrid); \"use strict\";\r\nvar NSGroupingGrid = (function()\r\n{\r\n\tfunction NSGroupingGrid(nsGrid,nsUtil) \r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = nsUtil;\r\n\t\t\r\n\t\tthis.__ARROW_COLLAPSE_PATH = \"M 10,5.99994L 6,5.99994L 6,9.99994L 4,9.99994L 4,5.99994L 0,5.99994L 0,3.99994L 4,3.99994L 4,-6.10352e-005L 6,-6.10352e-005L 6,3.99994L 10,3.99994L 10,5.99994 Z\";\r\n\t\t\r\n\t\tthis.__isSingleLevelMode = true; \r\n\t\tthis.__groupSource = null;\r\n\t\tthis.__fieldColNameArrow = this.__nsGrid.getID() + \"_arrow_field\";\r\n\t\tthis.__groupColumnFieldName = this.__nsGrid.getID() + \"_group_field\";\r\n\t\tthis.__childrenCountField = this.__nsGrid.getID() + \"_children_count_field\";\r\n\t\tthis.__rowCounter = -1;\r\n\t}\r\n\t /********************************Common Functions for Grid ****************************************/\r\n\tNSGroupingGrid.prototype.__initialize = function ()\r\n\t{\r\n\t\tvar setGroupColumn = false;\r\n\t\tif(this.__nsGrid.hasAttribute(\"isSingleLevelGrouping\"))\r\n\t\t{\r\n\t\t\tthis.__isSingleLevelMode =  Boolean.parse(this.__nsGrid.getAttribute(\"isSingleLevelGrouping\"));\r\n\t\t}\r\n\t\tif(this.__nsGrid.hasAttribute(\"multiLevelGroupColumn\"))\r\n\t\t{\r\n\t\t\tthis.__multiLevelGroupColumn = this.__nsGrid.getAttribute(\"multiLevelGroupColumn\");\r\n\t\t\tif(this.__multiLevelGroupColumn)\r\n\t\t\t{\r\n\t\t\t\tif(this.__multiLevelGroupColumn.dataField)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__groupColumnFieldName = this.__multiLevelGroupColumn.dataField;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__multiLevelGroupColumn.dataField = this.__groupColumnFieldName;\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__multiLevelGroupColumn.groupRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__multiLevelGroupColumn.groupRenderer = this.__groupTextRenderer.bind(this);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tsetGroupColumn = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tsetGroupColumn = true;\r\n\t\t}\r\n\t\tif(setGroupColumn)\r\n\t\t{\r\n\t\t\tthis.__multiLevelGroupColumn = {headerText:\"Group\",dataField:this.__groupColumnFieldName,width:\"100px\",enableFilter:true,groupRenderer:this.__groupTextRenderer.bind(this)};\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty) \r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t\tif(attributeName === \"groupbyfield\")\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__groupByField = newVal;\r\n\t\t\tthis.__nsGrid.dataSource(this.__nsGrid.__dataSource,true);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.dataSource = function(source)\r\n\t{\r\n\t\tif(this.__nsGrid.__groupByField && this.__nsGrid.__groupByField.length > 0)\r\n\t\t{\r\n\t\t\tvar arrGroupField = this.__nsGrid.__groupByField.split(\",\");\r\n\t\t\tvar setting = {childField:this.__nsGrid.__childField,parentLevelIndicatorField:this.__nsGrid.__isParentRowField,isSingleLevel:this.__isSingleLevelMode,groupField:this.__multiLevelGroupColumn.dataField,childrenCountField:this.__childrenCountField};\r\n\t\t\tvar groupCollection = new this.util.groupCollection(this.__nsGrid.__dataSource,setting);\r\n\t\t\tthis.__groupSource = groupCollection.groupBy(arrGroupField);\r\n\t\t\tif(this.__groupSource)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrWrapper = this.__groupSource.slice(0);\r\n\t\t\t\tthis.__nsGrid.__arrFilteredGroupedSource =  this.__groupSource.slice(0);\r\n\t\t\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrWrapper = [];\r\n\t\t\t\tthis.__nsGrid.__arrFilteredGroupedSource =  [];\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__updateTotalRecords(this.__rowCounter);\r\n\t\t\tif(this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__isPaginationTypeScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__INFINITE_SCROLL_INITIAL_LOAD);\r\n\t\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforScrollPagination.bind(this);\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__pageSize);\r\n\t\t\t\t\tthis.__nsGrid.__createPaginationControl(this.__nsGrid.__divOuterContainer);\r\n\t\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforPagePagination.bind(this);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.afterGridRendered = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.arrowClickHandler = function(parentItem,isCollapse) \r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.expandCollapseHandler = function(item,isCollapse)\r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__createBody = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__createBodyBody= function(dataSet,startIndex,endIndex)\r\n\t{\r\n\t    if(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tfor (var rowIndex = startIndex; rowIndex < endIndex; rowIndex++)\r\n\t\t    {\r\n\t    \t\tvar item = dataSet[rowIndex];\r\n\t    \t\tthis.__createRow(item);\r\n\t\t    }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setSourceForAsync= function()\r\n\t{\r\n\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__createRowAsync= function(item,index,array)\r\n\t{\r\n\t\tthis.__createRow(item);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__createBodyBodyVirtual= function(dataSet,totalRows,level)\r\n\t{\r\n\t\tif(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tif(totalRows > dataSet.length)\r\n\t    \t{\r\n\t    \t\ttotalRows = dataSet.length;\r\n\t    \t}\r\n\t    \telse if(this.__nsGrid.__enableVariableRowHeight)\r\n\t    \t{\r\n\t    \t\ttotalRows = totalRows + this.__nsGrid.__extraRowCountForVariableHeight;\r\n\t    \t}\r\n\t    \tthis.__createBodyBody(dataSet,0,totalRows);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__checkForAdditionalColumns = function()\r\n\t{\r\n\t\tvar colArrow = {};\r\n\t\tif(this.__isSingleLevelMode)\r\n\t\t{\r\n\t\t\tcolArrow.headerText = \"\";\r\n\t\t\tcolArrow.dataField = this.__fieldColNameArrow;\r\n\t\t\tcolArrow.width = \"50px\";\r\n\t\t\tcolArrow.enableFilter = false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcolArrow = this.__multiLevelGroupColumn;\r\n\t\t\tvar arrGroupField = this.__nsGrid.__groupByField.split(\",\");\r\n\t\t\tfor(var count = 0;count < arrGroupField.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar field = arrGroupField[count];\r\n\t\t\t\tvar objField = this.__nsGrid.__getColumnObjectByDataField(field,this.__nsGrid.__orignalColumns);\r\n\t\t\t\tif(objField)\r\n\t\t\t\t{\r\n\t\t\t\t\tobjField[this.__nsGrid.__fieldColVisible] = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tcolArrow.sortable = false;\r\n\t\tcolArrow.sortDescending = true;\r\n\t\tcolArrow.draggable = false;\r\n\t\tcolArrow.resizable = true;\r\n\t\tcolArrow.isExportable = false;\r\n\t\tcolArrow.enableEditable = false;\r\n\t\t\r\n\t\tthis.__nsGrid.__orignalColumns.splice(0, 0, colArrow);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setMeasurement = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__addSVGInPage = function(objSVG)\r\n\t{\r\n\t\tvar minusID = \"svgMinus\";\r\n\t\tvar minusRect = objSVG.createRect(minusID + \"Rect\",0,0,10,2,null);\r\n\t\tobjSVG.addElementInSymbol(minusID,\"0 0 16 16\",minusRect);\r\n\t\tvar plusID = \"svgPlus\";\r\n\t\tobjSVG.addPath(plusID,this.__ARROW_COLLAPSE_PATH,\"0 0 16 16\");\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tif(level === 0)\r\n\t\t\t{\r\n\t\t\t\tif(!offset)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = 0;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource = [];\r\n\t\t\t\tthis.__rowCounter = offset;\r\n\t\t\t}\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar count = 0;\r\n\t\t\tvar item = null;\r\n\t\t\tif(this.__nsGrid.__renderInCachedMode)\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex);\r\n\t\t\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\t\t\tvar arrCellsText = [];\r\n\t\t\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t            var cellDiv = this.util.createDiv(null);\r\n\t\t\t            this.__nsGrid.__addCellText(null,item,cellDiv,colItem,colIndex);\r\n\t\t\t            arrCellsText.push(cellDiv);\r\n\t\t\t        }\r\n\t\t\t\t\titem[this.__nsGrid.__fieldCellText] = arrCellsText;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*useVisibleIndex flag is used when we want to use visible index,generally true for all cases except for expandCollapse all due to performance issues*/  \r\n\tNSGroupingGrid.prototype.__resetDataInBody= function(fromIndex,toIndex,fromRowIndex,useVisibleIndex)\r\n\t{\r\n\t\tif(!fromRowIndex)\r\n\t\t{\r\n\t\t\tfromRowIndex = 0;\r\n\t\t}\r\n\t\tif(!useVisibleIndex)\r\n\t\t{\r\n\t\t\tuseVisibleIndex = false;\r\n\t\t}\r\n\t\tvar row = null;\r\n\t\tvar item = null;\r\n\t\tvar arrRows = this.__nsGrid.__tblCenterBodyBody.rows;\r\n\t\tvar rowLength = arrRows.length;\r\n\t\tvar length = this.__nsGrid.__arrFlatHierarchicalSource.length;\r\n\t\tvar indexCount = fromIndex;\r\n\t\tvar rowCount = fromRowIndex;\r\n\t\tfor(var count = fromIndex; count < length; count++)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll && useVisibleIndex)\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__getVisibleItemByIndex(this.__nsGrid.__arrFlatHierarchicalSource,count);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__arrFlatHierarchicalSource[count];\r\n\t\t\t}\r\n\t\t\t//breaking if item not found as if large data set is rendered and after collapse all the while scrolling after a while item is null still it goes to end of data set which are hidden\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(item[this.__nsGrid.__fieldRowVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLength <= rowCount) // || indexCount > toIndex\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trow = arrRows[rowCount];\r\n\t\t\t\t\tthis.__resetRow(row,item);\r\n\t\t\t\t\tindexCount++;\r\n\t\t\t\t\trowCount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(var rowIndex = rowCount;rowIndex < rowLength;rowIndex++)\r\n\t\t{\r\n\t\t\trow = arrRows[rowIndex];\r\n\t\t\trow.style.display = \"none\";\r\n\t\t\trow.setAttribute(\"ns-index\",null);\r\n\t\t\trow.setAttribute(\"ns-level\",null);\r\n\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__updateCellText = function(row,cell,item,colItem,rowIndex,colIndex)\r\n\t{\r\n\t\tif(cell && item && colItem)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(cell);\r\n\t\t\tvar cellDiv = this.util.createDiv(null);\r\n\t\t\tvar divText = this.__setBodyCellProperty(row,cell,cellDiv,item,rowIndex,colItem,colIndex,item[this.__nsGrid.__fieldParentIndex],item[this.__nsGrid.__fieldRowLevel]);\r\n\t\t\t//this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t\t\tcell.appendChild(cellDiv);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__getFlatSource = function()\r\n\t{\r\n\t\treturn this.__nsGrid.__arrFlatHierarchicalSource;\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t{\r\n\t\tif(item && item[this.__nsGrid.__fieldHasChild] > 0)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__handleOnDemandClick = function(item,event)\r\n\t{\r\n\t};\r\n\t\r\n\t/********************************End of Common Functions for Grid ****************************************/\r\n\tNSGroupingGrid.prototype.__createRow = function(item,itemIndex,isAdd)\r\n\t{\r\n\t\tif(item && item[this.__nsGrid.__fieldRowVisible])\r\n\t\t{\r\n\t\t\tisAdd = this.util.isUndefinedOrNull(isAdd) ? true : Boolean.parse(isAdd);\r\n\t\t\tvar row = document.createElement(\"TR\");\r\n\t\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\tthis.__nsGrid.__setBodyRowProperty(row,item,index);\r\n\t\t\tthis.__nsGrid.__applyCustomClass(row,\"bodyRow\");\r\n\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t    {\r\n\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\tvar cell =  this.__nsGrid.__createBodyRowCell(row,colIndex,true);\r\n\t            var cellDiv = cell.firstChild;\r\n\t            var divText = this.__setBodyCellProperty(row,cell,cellDiv,item,index,colItem,colIndex,parentIndex,level);\r\n\t            //this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t            cell.appendChild(cellDiv);\r\n\t            this.__nsGrid.__setBodyCellProperties.bind(this.__nsGrid)(cell);\r\n\t\t    }\r\n\t\t\tif(isAdd)\r\n\t\t\t{\r\n\t\t\t\tvar addRow = true;\r\n\t\t\t\tif(!this.util.isUndefinedOrNull(itemIndex) && itemIndex > 0 && this.__nsGrid.__tblCenterBodyBody.children \r\n\t\t\t\t\t\t&& this.__nsGrid.__tblCenterBodyBody.children.length >= itemIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar prevRow = this.__nsGrid.__tblCenterBodyBody.children[itemIndex - 1]; //this.__nsGrid.__getRowByIndex(itemIndex);\r\n\t\t\t\t\tif(prevRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.insertBefore(row,prevRow);\r\n\t\t\t\t\t\taddRow = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(addRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.appendChild(row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__createFixedBodyRow(row);\r\n\t\t\treturn row;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__updateRow = function(row,item)\r\n\t{\r\n\t\tif(row && item)\r\n\t\t{\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t\t}\r\n\t\t\tif(item[this.__nsGrid.__fieldSelected])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\tvar cells = row.cells;\r\n\t\t\tfor (var colIndex = 0; colIndex < this.__nsGrid.__columns.length; colIndex++)\r\n\t        {\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setRowItemProperty = function(item,parentIndex,level,setFieldIndex)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar totalRowCount = this.__rowCounter;\r\n\t\t\tif(setFieldIndex)\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIndex] = totalRowCount;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldVisibleIndex] = totalRowCount;\r\n\t\t\titem[this.__nsGrid.__fieldRowLevel] = level;\r\n\t\t\tvar hasChild = false;\r\n\t\t\tif(item.hasOwnProperty(this.__nsGrid.__childField) && item[this.__nsGrid.__childField] && item[this.__nsGrid.__childField].length > 0)\r\n\t\t    {\r\n\t\t    \thasChild = true;\r\n\t\t    \tthis.__setWrapperSource(item[this.__nsGrid.__childField],0,totalRowCount,level + 1,setFieldIndex);\r\n\t\t    }\r\n\t\t\titem[this.__nsGrid.__fieldParentIndex] = parentIndex;\r\n\t\t\tif(parentIndex > -1)\r\n\t\t    {\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = true;\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = false;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldHasChild] = hasChild;\r\n\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t\titem[this.__nsGrid.__fieldIsCollapsed] = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setBodyCellProperty = function(row,cell,cellDiv,item,currentIndex,colItem,colIndex,parentIndex,level)\r\n\t{\r\n\t\tvar hierarchicalPadding = 0;\r\n\t\tvar divText = null;\r\n\t\tif(colItem && colItem.hasOwnProperty(\"dataField\") && colItem[\"dataField\"])\r\n\t\t{\r\n\t        if(colIndex == 0 && item[this.__nsGrid.__childField]  && item[this.__nsGrid.__childField].length > 0)\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_GROUP_CELL);\r\n\t        \tthis.__nsGrid.__createArrow(item,currentIndex,cellDiv,item[this.__nsGrid.__fieldIsCollapsed],colItem);\r\n\t        \tvar cellText = this.util.createDiv(null,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tcellText.style.verticalAlign = \"top\";\r\n\t        \tdivText = cellText;\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellText.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellText,colItem,colIndex);\r\n\t        \t}\r\n\t        \tif(this.__nsGrid.__showExpandCollapseIcon)\r\n\t        \t{\r\n\t        \t\tthis.util.addStyleClass(cellText,\"nsGroupCellText\");\r\n\t        \t}\r\n\t        \tcellDiv.appendChild(cellText);\r\n\t        }\r\n\t        else\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellDiv.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellDiv,colItem,colIndex);\r\n\t        \t}\r\n\t        \tdivText = cellDiv;\r\n\t        \t//24 = 16(Arrow Width) + 6(Arrow Parent Padding) + 2(cellDiv horizontalGap between elements shown in debugger)\r\n\t        \thierarchicalPadding = 24;\r\n\t        }\r\n\t        if(colIndex == 0)\r\n\t        {\r\n\t        \tif(level === 0 || !this.__nsGrid.__showExpandCollapseIcon)\r\n\t        \t{\r\n\t        \t\tcell.style.paddingLeft = \"1px\";\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tvar paddingLeft = (10 * level) + hierarchicalPadding;\r\n\t        \t\tcell.style.paddingLeft = paddingLeft + \"px\";\r\n\t        \t}\r\n\t        }\r\n\t\t}\r\n\t\tthis.__nsGrid.__addPriorityClassInCell(cell,colItem);\r\n\t\treturn divText;\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__createArrow = function(compArrow,objSVG,arrowID,isCollapsed,item,colItem)\r\n\t{\r\n\t\t compArrow.style.paddingTop = \"0px\";\r\n\t\t if(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t {\r\n\t\t\t this.__setArrowDirection(compArrow,isCollapsed,colItem);\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t var classArrow = \"nsGridGroupIcon\"; \r\n\t\t\t var svg = objSVG.addSVG(compArrow,arrowID + \"svg\",\"nsGridGroupSVG\",null,null,null,null,null,null,true);\r\n\t\t\t this.util.addStyleClass(svg,classArrow);\r\n\t\t\t this.util.addStyleClass(svg,classArrow + \"Theme\");\r\n\t\t\t if(isCollapsed)\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgPlus\");\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgMinus\");\r\n\t\t\t }\r\n\t\t }\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__setArrowDirection = function(compArrow,isCollapsed,colItem)\r\n\t{\r\n\t\tif(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t{\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowCollapsed\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowExpanded\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tvar useID = compArrow.getAttribute(\"id\") + \"use\";\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgPlus\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgMinus\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__resetRow = function(row,item)\r\n\t{\r\n\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\trow.style.display = \"\";\r\n\t\trow.setAttribute(\"ns-index\",index);\r\n\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\tthis.__updateRow(row,item);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__addRowsforScrollPagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//console.log(\"In __addRowsforScrollPagination \" + fromRecord + \",\" + toRecord + \",\" + pageSize);\r\n\t\tvar arrArray = this.__nsGrid.__arrFlatHierarchicalSource.slice(fromRecord,toRecord + 1); \r\n\t\tthis.__nsGrid.__addRemoveRowCallInternal = true;\r\n\t\tthis.__nsGrid.addRows(arrArray);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__addRowsforPagePagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//slice returns index range from fromRecord to toRecord - 1 hence adding 1 \r\n\t\t//this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(fromRecord,toRecord + 1);\r\n\t\tthis.__nsGrid.__resetDataInBody(fromRecord,toRecord);\r\n\t};\r\n\t\r\n\tNSGroupingGrid.prototype.__groupTextRenderer = function(data,dataField,rowIndex,columnIndex,row,arrChildren,childrenCount,arrAllChildItems,groupLevel)\r\n\t{\r\n\t\tif(data && data.hasOwnProperty(dataField))\r\n\t\t{\r\n\t\t\tvar innerHTML = \"<span>\" + data[dataField];\r\n\t\t\tif(childrenCount)\r\n\t\t\t{\r\n\t\t\t\tinnerHTML += \" &#40;\" + childrenCount + \"&#41;\";\r\n\t\t\t}\r\n\t\t\tinnerHTML += \"</span>\";\r\n\t\t\treturn innerHTML;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t};\r\n\t\r\n\treturn NSGroupingGrid;\r\n})();\r\nnsModuleExport(this,\"NSGroupingGrid\",NSGroupingGrid);\r\n \"use strict\"; \r\nvar NSMasterDetailGrid = (function()\r\n{\r\n\tfunction NSMasterDetailGrid(nsGrid,nsUtil) \r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = nsUtil;\r\n\t\t\r\n\t\tthis.__ARROW_COLLAPSE_PATH = \"M 0 9.99994L 6.10352e-005 -3.05176e-005L 5 5.00006L 0 9.99994 Z\";\r\n\t\tthis.__ARROW_EXPANDED_PATH = \"M 0 3.05176e-005L 9.99994 9.15527e-005L 4.99988 5.00003L 0 3.05176e-005 Z\";\r\n\t\tthis.__CLASS_ARROW = \"nsGridArrowFill\";\r\n\t\tthis.__rowCounter = -1;\r\n\t\tthis.__masterDetailHasChildField = \"hasChildren\";\r\n\t\tthis.__masterDetailHasChildCallback = null;\r\n\t\t//Detail Grid Settings\r\n\t\tthis.__masterDetailColumns = null;\r\n\t\tthis.__masterDetailGetDataSourceCallback = null;\r\n\t\tthis.__masterDetailGridSetting = null;\r\n\t\tthis.__masterDetailDoesGridRefreshEverytimeCallback = null;\r\n\t\tthis.__masterDetailGridDetailHtmlCallback = null;\r\n\t\t//End of Detail Grid Settings\r\n\t\t//Custom Detail Renderer\r\n\t\tthis.__masterDetailDetailRenderer = null;\r\n\t\tthis.__masterDetailDetailRendererParam = null;\r\n\t\t//End of Custom Detail Renderer\r\n\t\tthis.__masterDetailHeight = -1;\r\n\t\tthis.__filteringRendering = false;//flag which stops the Detail Component being Rendered while filtering id going on \r\n\t\t\r\n\t\tthis.__detailCell = this.__nsGrid.__fieldPrefix + \"_detail_cell\";\r\n\t\tthis.__detailIndicatorField = this.__nsGrid.__fieldPrefix + \"_detail_indicator_field\";\r\n\t\tthis.__detailCompInstance = this.__nsGrid.__fieldPrefix + \"_detail_component_instance\";\r\n\t\tthis.__detailCompParentItem = this.__nsGrid.__fieldPrefix + \"_detail_parent_item\";\r\n\t\tthis.__detailCompElement = this.__nsGrid.__fieldPrefix + \"_detail_element\";\r\n\t\tthis.__detailCompGridIns = this.__nsGrid.__fieldPrefix + \"_grid_instance\";\r\n\t}\r\n\t/********************************Common Functions for Grid ****************************************/\r\n\tNSMasterDetailGrid.prototype.__initialize = function ()\r\n\t{\r\n\t\tvar gridSetting = this.__nsGrid.__setting;\r\n\t\tvar setting = gridSetting.masterDetailSetting;\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(setting.hasOwnProperty(\"hasChildField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailHasChildField = setting[\"hasChildField\"];\r\n\t\t\t}\r\n\t\t\telse if(setting.hasOwnProperty(\"hasChildCallback\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailHasChildCallback = setting[\"hasChildCallback\"];\r\n\t\t\t\tthis.__masterDetailHasChildCallback = this.util.getFunction(this.__masterDetailHasChildCallback);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailColumns\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailColumns = setting[\"detailColumns\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailDataSourceCallback\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailGetDataSourceCallback = setting[\"detailDataSourceCallback\"];\r\n\t\t\t\tthis.__masterDetailGetDataSourceCallback = this.util.getFunction(this.__masterDetailGetDataSourceCallback);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailGridSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailGridSetting = setting[\"detailGridSetting\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"gridRefreshEverytimeCallback\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailDoesGridRefreshEverytimeCallback = setting[\"gridRefreshEverytimeCallback\"];\r\n\t\t\t\tthis.__masterDetailDoesGridRefreshEverytimeCallback = this.util.getFunction(this.__masterDetailDoesGridRefreshEverytimeCallback);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"gridHtmlCallback\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailGridDetailHtmlCallback = setting[\"gridHtmlCallback\"];\r\n\t\t\t\tthis.__masterDetailGridDetailHtmlCallback = this.util.getFunction(this.__masterDetailGridDetailHtmlCallback);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailDetailRenderer = setting[\"detailRenderer\"];\r\n\t\t\t\tthis.__masterDetailDetailRenderer = this.util.getFunction(this.__masterDetailDetailRenderer);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailRendererParam\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailDetailRendererParam = setting[\"detailRendererParam\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"detailHeight\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__masterDetailHeight = parseInt(setting[\"detailHeight\"]);\r\n\t\t\t}\r\n\t\t\tif(!this.__masterDetailHasChildField && !this.__masterDetailHasChildCallback)\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSGrid\",\"Enter either childDetectionField or childDetectionCallback value in masterDetailSetting.\");\r\n\t\t\t}\r\n\t\t\tif(!(((this.__masterDetailColumns && this.__masterDetailColumns.length) && this.__masterDetailGetDataSourceCallback) || this.__masterDetailDetailRenderer))\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSGrid\",\"Enter either detailColumns and detailDataSourceCallback or detailRenderer value in masterDetailSetting.\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty) \r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.dataSource = function(source)\r\n\t{\r\n\t\tthis.__addChildrenToSource(this.__nsGrid.__dataSource);\r\n\t\tthis.__nsGrid.__arrWrapper = this.__nsGrid.__dataSource.slice(0);\r\n\t\tthis.__nsGrid.__arrFilteredGroupedSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true,true,true);\r\n\t\tthis.__nsGrid.__updateTotalRecords(this.__rowCounter);\r\n\t\tif(this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__isPaginationTypeScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__INFINITE_SCROLL_INITIAL_LOAD);\r\n\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforScrollPagination.bind(this);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0,this.__nsGrid.__pageSize);\r\n\t\t\t\tthis.__nsGrid.__createPaginationControl(this.__nsGrid.__divOuterContainer);\r\n\t\t\t\tthis.__nsGrid.__paginationFetchRecordCallBack = this.__addRowsforPagePagination.bind(this);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);//this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t\tif(item && arrChildren && arrChildren.length > 0)\r\n\t\t{\r\n\t\t\tif(!item[this.__nsGrid.__childField])\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__childField] = [];\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__childField].push.apply(item[this.__nsGrid.__childField], arrChildren);\r\n\t\t\tthis.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,true,false,false);\r\n\t\t\tthis.__nsGrid.__updateTotalRecords(this.__rowCounter);\r\n\t\t\tif(!(this.__nsGrid.__enablePagination && this.__nsGrid.__isPaginationModeAuto))\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t\t\titem[this.__nsGrid.__fieldIsCollapsed] = false;\r\n\t\t   \t\tvar row = this.__nsGrid.__getRowFromItem(item);\r\n\t\t   \t\tvar rowIndex = this.__nsGrid.__getIndexByItem(item);\r\n\t\t   \t\tthis.__nsGrid.__showHideRow(rowIndex,null,false);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.afterGridRendered = function()\r\n\t{\r\n\t\tthis.__nsGrid.__expandCollapseAll(true);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.afterFiltering = function(isReset)\r\n\t{\r\n\t\tvar self = this;\r\n\t\t//first expand all the rows so that the indexes of detail items are valid and then collapse the rows after 0 sec.\r\n\t\t//while this collapsing and expanding happens .. disable the detail component to be called/created for performance.\r\n\t\tthis.__filteringRendering = true;\r\n\t\tthis.__nsGrid.__expandCollapseAll(false);\r\n\t\tsetTimeout(function() {\r\n\t\t\tself.__nsGrid.__expandCollapseAll(true);\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t//reset the flag so that the detail compoent can be created again\r\n\t\t\t\tself.__filteringRendering = false;\r\n\t\t\t}, 50);\r\n\t\t},0);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.arrowClickHandler = function(parentItem,isCollapse)\r\n\t{\r\n\t\tif(!isCollapse && parentItem && parentItem[this.__nsGrid.__fieldHasChild]) \r\n\t\t{\r\n\t\t\tvar childIndex = parentItem[this.__nsGrid.__fieldIndex] + 1;\r\n\t\t\tvar childItem = this.__nsGrid.__getItemByIndex(childIndex);\r\n\t\t\tif(childItem) {\r\n\t\t\t\t/*var childRow = childItem[this.__nsGrid.__fieldRow];\r\n\t\t\t\tif(childRow) {\r\n\t\t\t\t\tvar childCell = childRow.firstChild;\r\n\t\t\t\t\tthis.__renderDetailCell(childCell,childItem,item,childRow);\r\n\t\t\t\t}*/\r\n\t\t\t\tthis.expandCollapseHandler(childItem,isCollapse);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.expandCollapseHandler = function(item,isCollapse)\r\n\t{\r\n\t\tif(!isCollapse && item && item[this.__detailIndicatorField]) \r\n\t\t{\r\n\t\t\tvar row = item[this.__nsGrid.__fieldRow];\r\n\t\t\tif(row) \r\n\t\t\t{\r\n\t\t\t\tvar cell = row.firstChild;\r\n\t\t\t\tthis.__renderDetailCell(cell,item,null,row);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__createBodyBody = function(dataSet,startIndex,endIndex)\r\n\t{\r\n\t    if(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tfor (var rowIndex = startIndex; rowIndex < endIndex; rowIndex++)\r\n\t\t    {\r\n\t    \t\tvar item = dataSet[rowIndex];\r\n\t    \t\tthis.__createRow(item);\r\n\t\t    }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setSourceForAsync = function()\r\n\t{\r\n\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__createRowAsync = function(item,index,array)\r\n\t{\r\n\t\tthis.__createRow(item);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__createBodyBodyVirtual = function(dataSet,totalRows,level)\r\n\t{\r\n\t\tif(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tif(totalRows > dataSet.length)\r\n\t    \t{\r\n\t    \t\ttotalRows = dataSet.length;\r\n\t    \t}\r\n\t    \telse if(this.__nsGrid.__enableVariableRowHeight)\r\n\t    \t{\r\n\t    \t\ttotalRows = totalRows + this.__nsGrid.__extraRowCountForVariableHeight;\r\n\t    \t}\r\n\t    \tthis.__createBodyBody(dataSet,0,totalRows);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__createBody = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__checkForAdditionalColumns = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setMeasurement = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__addSVGInPage = function(objSVG)\r\n\t{\r\n\t\tobjSVG.addPath(\"svgArrowDown\",this.__ARROW_EXPANDED_PATH,\"0 0 16 16\");\r\n\t\tobjSVG.addPath(\"svgArrowRight\",this.__ARROW_COLLAPSE_PATH,\"0 0 16 16\");\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tif(level === 0)\r\n\t\t\t{\r\n\t\t\t\tif(!offset)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = 0;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource = [];\r\n\t\t\t\tthis.__rowCounter = offset;\r\n\t\t\t}\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar count = 0;\r\n\t\t\tvar item = null;\r\n\t\t\t/*if(this.__nsGrid.__renderInCachedMode)\r\n\t\t\t{\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\t\t\tvar arrCellsText = [];\r\n\t\t\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t\t        {\r\n\t\t\t        \tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t            var cellDiv = this.util.createDiv(null);\r\n\t\t\t            this.__nsGrid.__addCellText(null,item,cellDiv,colItem,colIndex);\r\n\t\t\t            arrCellsText.push(cellDiv);\r\n\t\t\t        }\r\n\t\t\t\t\titem[this.__nsGrid.__fieldCellText] = arrCellsText;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{*/\r\n\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t{\r\n\t\t\t\titem = source[count];\r\n\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\tthis.__nsGrid.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\tthis.__setRowItemProperty(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t}\r\n\t\t\t//}\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*useVisibleIndex flag is used when we want to use visible index,generally true for all cases except for expandCollapse all due to performance issues*/  \r\n\tNSMasterDetailGrid.prototype.__resetDataInBody = function(fromIndex,toIndex,fromRowIndex,useVisibleIndex)\r\n\t{\r\n\t\tif(!fromRowIndex)\r\n\t\t{\r\n\t\t\tfromRowIndex = 0;\r\n\t\t}\r\n\t\tvar row = null;\r\n\t\tvar item = null;\r\n\t\tvar arrRows = this.__nsGrid.__tblCenterBodyBody.rows;\r\n\t\tvar rowLength = arrRows.length;\r\n\t\tvar length = this.__nsGrid.__arrFlatHierarchicalSource.length;\r\n\t\tvar indexCount = fromIndex;\r\n\t\tvar rowCount = fromRowIndex;\r\n\t\tfor(var count = fromIndex; count < length; count++)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll && useVisibleIndex)\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__getVisibleItemByIndex(this.__nsGrid.__arrFlatHierarchicalSource,count);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem = this.__nsGrid.__arrFlatHierarchicalSource[count];\r\n\t\t\t}\r\n\t\t\t//breaking if item not found as if large data set is rendered and after collapse all the while scrolling after a while item is null still it goes to end of data set which are hidden\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(item[this.__nsGrid.__fieldRowVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLength <= rowCount) // || indexCount > toIndex\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trow = arrRows[rowCount];\r\n\t\t\t\t\tthis.__resetRow(row,item);\r\n\t\t\t\t\tindexCount++;\r\n\t\t\t\t\trowCount++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(var rowIndex = rowCount;rowIndex < rowLength;rowIndex++)\r\n\t\t{\r\n\t\t\trow = arrRows[rowIndex];\r\n\t\t\trow.style.display = \"none\";\r\n\t\t\trow.setAttribute(\"ns-index\",null);\r\n\t\t\trow.setAttribute(\"ns-level\",null);\r\n\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__updateCellText = function(row,cell,item,colItem,rowIndex,colIndex)\r\n\t{\r\n\t\tif(cell && item && colItem)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(cell);\r\n\t\t\tvar cellDiv = this.util.createDiv(null);\r\n\t\t\tvar divText = this.__setBodyCellProperty(row,cell,cellDiv,item,rowIndex,colItem,colIndex,item[this.__nsGrid.__fieldParentIndex],item[this.__nsGrid.__fieldRowLevel]);\r\n\t\t\t//this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t\t\tcell.appendChild(cellDiv);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__getFlatSource = function()\r\n\t{\r\n\t\treturn this.__nsGrid.__arrFlatHierarchicalSource;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t{\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__handleOnDemandClick = function(item,event)\r\n\t{\r\n\t};\r\n\tNSMasterDetailGrid.prototype.__ignoreFieldsForDeepCopy = function()\r\n\t{\r\n\t\treturn [this.__detailCompInstance, this.__detailCompParentItem];\r\n\t};\r\n\t/********************************End of Common Functions for Grid ****************************************/\r\n\tNSMasterDetailGrid.prototype.__createRow = function(item,itemIndex,isAdd)\r\n\t{\r\n\t\t// && (!item[this.__detailCompParentItem] || item[this.__detailCompParentItem][this.__nsGrid.__fieldIsCollapsed])\r\n\t\tif(item && item[this.__nsGrid.__fieldRowVisible])\r\n\t\t{\r\n\t\t\tisAdd = this.util.isUndefinedOrNull(isAdd) ? true : Boolean.parse(isAdd);\r\n\t\t\tvar row = this.util.createElement(\"TR\");\r\n\t\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\tthis.__nsGrid.__setBodyRowProperty(row,item,index);\r\n\t\t\tthis.__nsGrid.__applyCustomClass(row,\"bodyRow\");\r\n\t\t\tvar colLength = this.__nsGrid.__columns.length;\r\n\t\t\tif(item[this.__detailIndicatorField]) {\r\n\t\t\t\tif(!item[this.__detailCell]) {\r\n\t\t\t\t\tvar cell =  this.__nsGrid.__createBodyRowCell(row,0,true);\r\n\t\t\t\t\tcell.setAttribute(\"colspan\",this.__nsGrid.__columns.length);\r\n\t\t\t\t\tvar cellDiv = cell.firstChild;\r\n\t\t\t\t\tif(this.__masterDetailHeight > 0) {\r\n\t\t\t\t\t\tcell.style.height = this.__masterDetailHeight + \"px\";\r\n\t\t\t\t\t\tcellDiv.style.height = \"100%\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tcell.style.height = \"auto\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(item[this.__detailCompElement]) {\r\n\t\t\t\t\t\tcellDiv.appendChild(item[this.__detailCompElement]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t//this.__renderDetailCell(cell,item,null,row);\r\n\t\t\t\t\t}\r\n\t\t\t\t\titem[this.__detailCell] = cell;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\trow.appendChild(item[this.__detailCell]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tfor (var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t\t    {\r\n\t\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\t\tvar cell =  this.__nsGrid.__createBodyRowCell(row,colIndex,true);\r\n\t\t            var cellDiv = cell.firstChild;\r\n\t\t            var divText = this.__setBodyCellProperty(row,cell,cellDiv,item,index,colItem,colIndex,parentIndex,level);\r\n\t\t            //this.__nsGrid.__highlightDiv(divText,colIndex);\r\n\t\t            cell.appendChild(cellDiv);\r\n\t\t            this.__nsGrid.__setBodyCellProperties.bind(this.__nsGrid)(cell);\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\tif(isAdd)\r\n\t\t\t{\r\n\t\t\t\tvar addRow = true;\r\n\t\t\t\tif(!this.util.isUndefinedOrNull(itemIndex) && itemIndex > 0 && this.__nsGrid.__tblCenterBodyBody.children \r\n\t\t\t\t\t\t&& this.__nsGrid.__tblCenterBodyBody.children.length >= itemIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar prevRow = this.__nsGrid.__tblCenterBodyBody.children[itemIndex - 1]; //this.__nsGrid.__getRowByIndex(itemIndex);\r\n\t\t\t\t\tif(prevRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.insertBefore(row,prevRow);\r\n\t\t\t\t\t\taddRow = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(addRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__tblCenterBodyBody.appendChild(row);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__createFixedBodyRow(row);\r\n\t\t\treturn row;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__updateRow = function(row,item)\r\n\t{\r\n\t\tif(row && item)\r\n\t\t{\r\n\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\tvar level = item[this.__nsGrid.__fieldRowLevel];\r\n\t\t\tvar parentIndex = item[this.__nsGrid.__fieldParentIndex];\r\n\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\trow.setAttribute(\"ns-level\",level);\r\n\t\t\tif(item[this.__nsGrid.__fieldHasParent])\r\n\t\t    {\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\trow.setAttribute(\"ns-parent-index\",null);\r\n\t\t\t}\r\n\t\t\tif(item[this.__nsGrid.__fieldSelected])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(row,this.__nsGrid.__CLASS_SELECTED_ROW);\r\n\t\t\t}\r\n\t\t\tvar cells = row.cells;\r\n\t\t\tfor (var colIndex = 0; colIndex < this.__nsGrid.__columns.length; colIndex++)\r\n\t        {\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\tvar colItem = this.__nsGrid.__columns[colIndex];\r\n\t\t\t\tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setRowItemProperty = function(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar totalRowCount = this.__rowCounter;\r\n\t\t\tif(setFieldIndex || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldIndex]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIndex] = totalRowCount;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldVisibleIndex] = totalRowCount;\r\n\t\t\titem[this.__nsGrid.__fieldRowLevel] = level;\r\n\t\t\tvar hasChild = false;\r\n\t\t\tif((item[this.__nsGrid.__childField] && item[this.__nsGrid.__childField].length > 0))\r\n\t\t    {\r\n\t\t    \thasChild = true;\r\n\t\t    \tthis.__setWrapperSource(item[this.__nsGrid.__childField],0,totalRowCount,level + 1,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t    }\r\n\t\t\titem[this.__nsGrid.__fieldParentIndex] = parentIndex;\r\n\t\t\tif(parentIndex > -1)\r\n\t\t    {\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = true;\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldHasParent] = false;\r\n\t\t\t}\r\n\t\t\titem[this.__nsGrid.__fieldHasChild] = hasChild;\r\n\t\t\tif(setItemVisible || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldRowVisible]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldRowVisible] = true;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tif(setIsCollapsed || this.util.isUndefinedOrNull(item[this.__nsGrid.__fieldIsCollapsed]))\r\n\t\t\t{\r\n\t\t\t\titem[this.__nsGrid.__fieldIsCollapsed] = true;//Boolean.parse(item[this.__detailIndicatorField]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setBodyCellProperty = function(row,cell,cellDiv,item,currentIndex,colItem,colIndex,parentIndex,level)\r\n\t{\r\n\t\tvar hierarchicalPadding = 0;\r\n\t\tvar divText = null;\r\n\t\tif(colItem && colItem.hasOwnProperty(\"dataField\") && colItem[\"dataField\"])\r\n\t\t{\r\n\t\t\tif(colIndex == 0 && item[this.__nsGrid.__childField]  && item[this.__nsGrid.__childField].length > 0)\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_GROUP_CELL);\r\n\t        \tthis.__nsGrid.__createArrow(item,currentIndex,cellDiv,item[this.__nsGrid.__fieldIsCollapsed],colItem);\r\n\t        \tvar cellText = this.util.createDiv(null,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tcellText.style.verticalAlign = \"top\";\r\n\t        \tdivText = cellText;\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellText.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellText,colItem,colIndex);\r\n\t        \t}\r\n\t        \tthis.util.addStyleClass(cellText,\"nsGroupCellText\");\r\n\t        \tcellDiv.appendChild(cellText);\r\n\t        }\r\n\t        else\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t        \tif(this.__nsGrid.__renderInCachedMode)\r\n\t        \t{\r\n\t        \t\tvar arrCellsText = item[this.__nsGrid.__fieldCellText];\r\n\t        \t\tcellDiv.innerHTML = arrCellsText[colIndex].outerHTML;\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tthis.__nsGrid.__addCellText(row,item,cellDiv,colItem,colIndex);\r\n\t        \t}\r\n\t        \tdivText = cellDiv;\r\n\t        \t//24 = 16(Arrow Width) + 6(Arrow Parent Padding) + 2(cellDiv horizontalGap between elements shown in debugger)\r\n\t        \thierarchicalPadding = 24;\r\n\t        }\r\n\t        if(colIndex == 0)\r\n\t        {\r\n\t        \tvar paddingLeft = (10 * level) + hierarchicalPadding;\r\n\t        \tif(level === 0 || !this.__nsGrid.__showExpandCollapseIcon)\r\n\t        \t{\r\n\t        \t\tpaddingLeft += 2;\r\n\t        \t}\r\n\t        \tcell.style.paddingLeft = paddingLeft + \"px\";\r\n\t        }\r\n\t\t}\r\n\t\tthis.__nsGrid.__addPriorityClassInCell(cell,colItem);\r\n\t\treturn divText;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__createArrow = function(compArrow,objSVG,arrowID,isCollapsed,item,colItem)\r\n\t{\r\n\t\t if(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t {\r\n\t\t\t this.__setArrowDirection(compArrow,isCollapsed,colItem);\r\n\t\t }\r\n\t\t else\r\n\t\t {\r\n\t\t\t var svg = objSVG.addSVG(compArrow,arrowID + \"svg\",this.__CLASS_ARROW,null,null,null,null,null,null,true);\r\n\t\t\t this.util.addStyleClass(svg,this.__CLASS_ARROW + \"Theme\");\r\n\t\t\t if(isCollapsed)\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgArrowRight\");\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgArrowDown\");\r\n\t\t\t }\r\n\t\t }\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__setArrowDirection = function(compArrow,isCollapsed,colItem)\r\n\t{\r\n\t\tif(this.__nsGrid.__isRowExpansionIconCustom())\r\n\t\t{\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowCollapsed\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tcompArrow.innerHTML = this.__nsGrid.__getCustomIcon(\"rowExpanded\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tvar useID = compArrow.getAttribute(\"id\") + \"use\";\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgArrowRight\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgArrowDown\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__resetRow = function(row,item)\r\n\t{\r\n\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\trow.style.display = \"\";\r\n\t\trow.setAttribute(\"ns-index\",index);\r\n\t\titem[this.__nsGrid.__fieldRowHtml] = row;\r\n\t\tthis.__updateRow(row,item);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__addRowsforScrollPagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\tvar arrArray = this.__nsGrid.__arrFlatHierarchicalSource.slice(fromRecord,toRecord + 1); \r\n\t\tthis.__nsGrid.__addRemoveRowCallInternal = true;\r\n\t\tthis.__nsGrid.addRows(arrArray);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__addRowsforPagePagination = function(fromRecord,toRecord,pageSize)\r\n\t{\r\n\t\t//slice returns index range from fromRecord to toRecord - 1 hence adding 1 \r\n\t\t//this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(fromRecord,toRecord + 1);\r\n\t\tthis.__nsGrid.__resetDataInBody(fromRecord,toRecord);\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__addChildrenToSource = function(arrSource)\r\n\t{\r\n\t\tif(arrSource) {\r\n\t\t\tfor(var count = 0;count < arrSource.length;count++) {\r\n\t\t\t\tvar item = arrSource[count];\r\n\t\t\t\tif(!item[this.__nsGrid.__childField] || !item[this.__nsGrid.__childField].length) {\r\n\t\t\t\t\tvar hasChildren = this.__hasChildren(item);\r\n\t\t\t\t\tif(hasChildren) {\r\n\t\t\t\t\t\tvar childItem = this.util.cloneObject(item, true);\r\n\t\t\t\t\t\tchildItem[this.__detailIndicatorField] = true;\r\n\t\t\t\t\t\t//only call detail component when its not between filtering\r\n\t\t\t\t\t\tif(!this.__filteringRendering) {\r\n\t\t\t\t\t\t\tchildItem[this.__detailCompInstance] = this.__getRendererInstance(item);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tchildItem[this.__detailCompParentItem] = item;\r\n\t\t\t\t\t\titem[this.__nsGrid.__childField] = [childItem];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__getRendererInstance = function(parentItem)\r\n\t{\r\n\t\tvar objRenderer = null;\r\n\t\tif(this.__masterDetailColumns && this.__masterDetailColumns.length) \r\n\t\t{\r\n\t\t\tobjRenderer = this.__getGridRenderer(this,this.__masterDetailColumns,this.__masterDetailGridSetting);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tobjRenderer = new this.__masterDetailDetailRenderer();\r\n\t\t}\r\n\t\treturn objRenderer;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__hasChildren = function(item)\r\n\t{\r\n\t\tif(item) {\r\n\t\t\tif(item.hasOwnProperty(this.__masterDetailHasChildField)) {\r\n\t\t\t\treturn Boolean.parse(item[this.__masterDetailHasChildField]);\r\n\t\t\t}\r\n\t\t\tif(this.__masterDetailHasChildCallback) {\r\n\t\t\t\treturn this.__masterDetailHasChildCallback(item);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__renderDetailCell = function(cell,item,parentItem,row)\r\n\t{\r\n\t\tif(cell && item) {\r\n\t\t\tif(!parentItem) {\r\n\t\t\t\tparentItem = item[this.__detailCompParentItem];\r\n\t\t\t}\r\n\t\t\tvar compInstance = item[this.__detailCompInstance];\r\n\t\t\tvar cellDiv = cell.firstChild;\r\n\t        this.util.addStyleClass(cellDiv,\"nsBodyDataGridCellMasterDetailCon\");\r\n\t        var params = {};\r\n\t        if(this.__masterDetailDetailRendererParam) {\r\n\t        \tparams = this.util.cloneObject(this.__masterDetailDetailRendererParam,true);\r\n\t        }\r\n\t        params.masterData = parentItem;\r\n\t        params.container = cellDiv;\r\n\t        params.cell = cell;\r\n\t        params.row = row;\r\n\t        params.rowIndex = item[this.__nsGrid.__fieldIndex];\r\n\t        //only call detail component when its not between filtering\r\n\t        if(compInstance && !this.__filteringRendering) {\r\n\t\t        if(!item[this.__detailCompElement] || !compInstance.renderEverytime || compInstance.renderEverytime(params)) {\r\n\t\t        \tvar callback = function() {\r\n\t\t        \t\tvar childComp = this.__callComponentFunction(compInstance,\"getElement\",null,null,true);\r\n\t\t\t\t        //var childComp = compInstance.getElement();\r\n\t\t\t\t        cellDiv.innerHTML = \"\";\r\n\t\t\t\t        cellDiv.appendChild(childComp);\r\n\t\t\t\t        item[this.__detailCompElement] = childComp;\r\n\t\t\t\t        this.__callComponentFunction(compInstance,\"elementAdded\",params,null,false);\r\n\t\t        \t};\r\n\t\t        \tvar res = this.__callComponentFunction(compInstance,\"init\",params,null,true);\r\n\t\t        \tthis.util.resolveFunctionOrPromise(res,callback.bind(this));\r\n\t\t        }\r\n\t\t    }\r\n\t\t}\r\n\t}\r\n\t\r\n\tNSMasterDetailGrid.prototype.__callComponentFunction = function(compIns,functionRef,param,defaultValue,throwError)\r\n\t{\r\n\t\tif(compIns && compIns[functionRef] && this.util.isFunction(compIns[functionRef]))\r\n\t\t{\r\n\t\t\tvar retValue = null;\r\n\t\t\tvar retValue = null;\r\n\t\t\tif(param && this.util.isArray(param) && param.length > 0)\r\n\t\t\t{\r\n\t\t\t\tretValue = compIns[functionRef].apply(null,param);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tretValue = compIns[functionRef](param);\r\n\t\t\t}\r\n\t\t\tif(!this.util.isUndefinedOrNull(retValue))\r\n\t\t\t{\r\n\t\t\t\treturn retValue;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(throwError) {\r\n\t\t\tthis.util.throwNSError(\"NSGrid\",\"Function \" + functionRef + \" should be present in detail renderer.\");\r\n\t\t}\r\n\t\treturn defaultValue;\r\n\t};\r\n\t\r\n\tNSMasterDetailGrid.prototype.__getGridRenderer = function(parent,columns,setting) \r\n\t{\r\n\t\tfunction GridRenderer() {\r\n\t\t  this.con = null;\r\n\t\t  this.gridCon = null;\r\n\t\t  this.params = null;\r\n\t\t  this.item = null;\r\n\t\t  this.objGrid = null;\r\n\t\t  this.arrSource = [];\r\n\t\t}\r\n\t\t\r\n\t\tGridRenderer.prototype.init = function(params) {\r\n\t\t\tthis.params = parent.util.cloneObject(params);\r\n\t\t\tthis.item = params.masterData;\r\n\t\t\tif(parent.__masterDetailGridDetailHtmlCallback) \r\n\t\t\t{\r\n\t\t\t\tvar html = parent.__masterDetailGridDetailHtmlCallback(params);\r\n\t\t\t\tif(html) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar objComp = parent.util.getReferenceFromHtml(html);\r\n\t\t\t\t\tif(objComp.refs && objComp.refs[\"detailGrid\"]) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.con = objComp.element;\r\n\t\t\t\t\t\tthis.gridCon = objComp.refs[\"detailGrid\"];\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.con = parent.util.createElement(\"div\");\r\n\t\t\tthis.con.style.height = \"100%\";\r\n\t\t\tthis.gridCon = this.con;\r\n\t\t\tvar container = params.container;\r\n\t\t\tparent.util.addStyleClass(container,\"nsMasterDetailGridContainer\");\r\n\t\t};\r\n\t\t\r\n\t\tGridRenderer.prototype.getElement = function() {\r\n\t\t  \treturn this.con;\r\n\t\t};\r\n\t\t\r\n\t\tGridRenderer.prototype.elementAdded = function(params) {\r\n\t\t\tthis.__getGridObject();\r\n\t\t};\r\n\t\t\r\n\t\tGridRenderer.prototype.renderEverytime = function(params) {\r\n\t\t\tif(parent.__masterDetailDoesGridRefreshEverytimeCallback) {\r\n\t\t\t\treturn parent.__masterDetailDoesGridRefreshEverytimeCallback(params);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\t//private function\r\n\t\tGridRenderer.prototype.__setGridSource = function(arrSource)\r\n\t\t{\r\n\t\t\tthis.arrSource = arrSource;\r\n\t\t\tthis.objGrid.dataSource.call(this.objGrid,this.arrSource);\r\n\t\t};\r\n\t\t\r\n\t\tGridRenderer.prototype.__getGridObject = function(arrSource) {\r\n\t\t\t\r\n\t\t\tvar masterItem = this.item;\r\n\t\t\tthis.objGrid = new NSGrid(this.gridCon,setting);\r\n\t\t\tthis.objGrid.setColumn(columns);\r\n\t\t\tthis.params.gridContainer = this.gridCon;\r\n\t\t\tthis.params.setDataSource = this.__setGridSource.bind(this);\r\n\t\t\tparent.__masterDetailGetDataSourceCallback(this.params);\r\n\t\t\treturn this.objGrid;\r\n\t\t};\r\n\t\treturn new GridRenderer();\r\n\t};\r\n\t\r\n\treturn NSMasterDetailGrid;\r\n})();\r\nnsModuleExport(this,\"NSMasterDetailGrid\",NSMasterDetailGrid);\"use strict\";\r\nvar NSGridEditor = (function()\r\n{\r\n\tvar NSGridEditor = function(nsGrid)\r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = this.__nsGrid.util;\r\n\t\t\r\n\t\tthis.__config = {editType:NSGrid.EDITOR_EDITTYPE_CELL,clickType:NSGrid.EDITOR_EDITING_DOUBLECLICK,stopEditingOnGridFocusOut:false,enableMultipleEdit:false};\r\n\t\tthis.__defaultCellSetting = {type:NSGrid.EDITOR_TYPE_TEXT,params:null,customEditor:null,validator:null,isCellEditableCallback:null};\r\n\t\t\r\n\t\tthis.__table = null;\r\n\t\t\r\n\t\tthis.__objEditor = {};\r\n\t\tthis.__tblClickRef = null;\r\n\t\tthis.__tblEventRef = null;\r\n\t\t\r\n\t\tthis.initialize = function()\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableEditable)\r\n\t\t\t{\r\n\t\t\t\tvar editorSetting = this.__nsGrid.__editorSetting;\r\n\t\t\t\tif(!editorSetting)\r\n\t\t\t\t{\r\n\t\t\t\t\teditorSetting = {};\r\n\t\t\t\t}\r\n\t\t\t\tthis.__config = {\r\n\t\t\t\t\t\teditType:editorSetting.editType || this.__config.editType,\r\n\t\t\t\t\t\tclickType:editorSetting.clickType || this.__config.clickType,\r\n\t\t\t\t\t\tstopEditingOnGridFocusOut: Boolean.parse(editorSetting.stopEditingOnGridFocusOut),\r\n\t\t\t\t\t\tenableMultipleEdit: Boolean.parse(editorSetting.enableMultipleEdit)\r\n\t\t\t\t};\r\n\t\t\t\tthis.__table = this.__nsGrid.__tblCenterBody;\r\n\t\t\t\tif(this.__config.editType != NSGrid.EDITOR_EDITING_NOCLICK)\r\n\t\t\t\t{\r\n\t\t\t\t\t//if(!this.__tblClickRef)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\tthis.__tblClickRef = this.__tblClickHandler.bind(this);\r\n\t\t\t\t\t\tthis.util.addEvent(this.__table,\"click\", this.__tblClickRef);\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//if(!this.__tblEventRef)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\tvar mouseEvent = this.__getMouseEventType();\r\n\t\t\t\t\t\tthis.__tblEventRef = this.__tblEventHandler.bind(this);\r\n\t\t\t\t\t\tthis.util.addEvent(this.__table,mouseEvent, this.__tblEventRef);\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__documentKeyEventRef)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__documentKeyEventRef = this.__documentKeyEventHandler.bind(this);\r\n\t\t\t\t\tthis.util.addEvent(document,\"keydown\", this.__documentKeyEventRef);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__config.stopEditingOnGridFocusOut)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__listenInternalEvent(\"blur\",this.__tblBlurHandler.bind(this));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.edit = function(element,rowIndex)\r\n\t\t{\r\n\t\t\telement = this.__getElement(element,rowIndex);\r\n\t\t\tif(element)\r\n\t\t\t{\r\n\t\t\t\tthis.__handleEditors(element);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.cancelEdit = function(element,rowIndex)\r\n\t\t{\r\n\t\t\telement = this.__getElement(element,rowIndex);\r\n\t\t\tthis.__callCancelForEditors(element);\r\n\t\t};\r\n\t\t\r\n\t\tthis.saveEdit = function(element,rowIndex)\r\n\t\t{\r\n\t\t\telement = this.__getElement(element,rowIndex);\r\n\t\t\tthis.__callSaveForEditors(element);\r\n\t\t};\r\n\t\t\r\n\t\t/*\r\n\t\t * returns array of key and value\r\n\t\t * if element is null then it returns all editor instances\r\n\t\t */\r\n\t\tthis.getEditorInstances = function(element,rowIndex)\r\n\t\t{\r\n\t\t\telement = this.__getElement(element,rowIndex);\r\n\t\t\treturn this.__getAllEditors(element);\r\n\t\t};\r\n\t\t\r\n\t\tthis.processColumnObject = function(objColumn)\r\n\t\t{\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tif(!objColumn.hasOwnProperty(\"enableEditable\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn.enableEditable = this.__nsGrid.__enableEditable;\r\n\t\t\t\t}\r\n\t\t\t\tif(objColumn[\"editorSetting\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!objColumn[\"editorSetting\"].hasOwnProperty(\"type\") || !objColumn[\"editorSetting\"][\"type\"])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tobjColumn[\"editorSetting\"][\"type\"] = this.__defaultCellSetting.type;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(objColumn[\"editorSetting\"].hasOwnProperty(\"customEditor\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar customEditor = objColumn[\"editorSetting\"][\"customEditor\"];\r\n\t\t\t\t\t\tif (typeof customEditor === \"string\" || customEditor instanceof String)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(this.util.isFunction(customEditor))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tobjColumn[\"editorSetting\"][\"customEditor\"] = this.__nsGrid.__context[customEditor];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.isOtherKeyNavigationValid = function(event,cell)\r\n\t\t{\r\n\t\t\tvar hasFocus = false;\r\n\t\t\tif(this.__config.editType == NSGrid.EDITOR_EDITTYPE_CELL)\r\n\t\t\t{\r\n\t\t\t\thasFocus = this.__hasCellFocus(cell);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar row = this.util.findParent(cell,\"TR\");\r\n\t\t\t\thasFocus = this.__hasRowFocus(row);\r\n\t\t\t}\r\n\t\t\treturn !hasFocus;\r\n\t\t};\r\n\t\t\r\n\t\tthis.resetVariables = function() \r\n\t\t{\r\n\t\t\tthis.__objEditor = {};\r\n\t\t};\r\n\t\t\r\n\t\tthis.__documentKeyEventHandler = function(event)\r\n\t\t{\r\n\t\t\tif(this.__hasEditor())\r\n\t\t\t{\r\n\t\t\t\tevent = this.util.getEvent(event);\r\n\t\t    \tvar keyCode = this.util.KEYCODE;\r\n\t\t    \tif (event.keyCode == keyCode.ENTER) \r\n\t\t      \t{\r\n\t\t    \t\tthis.__callSaveForEditors();\r\n\t\t      \t}\r\n\t\t      \telse if (event.keyCode == keyCode.TAB) \r\n\t\t      \t{\r\n\t\t      \t\tthis.__callSaveForEditors();\r\n\t\t      \t\tevent.preventDefault();\r\n\t\t      \t}\r\n\t\t      \telse if (event.keyCode == keyCode.ESC) \r\n\t\t      \t{\r\n\t\t      \t\tthis.__callCancelForEditors();\r\n\t\t      \t\tthis.__callDestroyForRowEditors();\r\n\t\t        \tevent.preventDefault();\r\n\t\t      \t}\r\n\t\t    \tthis.__callRowEditorsFunction(\"handleKeyDown\",[event,event.keyCode]);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\t/*\r\n\t\t * for editType = cell \r\n\t\t * combination can be this.__getElement(cellIndex,rowIndex),this.__getElement(cell),this.__getElement(dataField,rowIndex)\r\n\t\t * \r\n\t\t * for editType = row \r\n\t\t * combination can be this.__getElement(rowIndex),this.__getElement(row)\r\n\t\t * \r\n\t\t */\r\n\t\t\r\n\t\tthis.__getElement = function(element,rowIndex)\r\n\t\t{\r\n\t\t\tvar retValue = null;\r\n\t\t\tif(!this.util.isUndefinedOrNull(element))\r\n\t\t\t{\r\n\t\t\t\tif(this.__config.editType == NSGrid.EDITOR_EDITTYPE_CELL)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.util.isNumber(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isUndefinedOrNull(rowIndex))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar row = this.__nsGrid.__getRowByIndex(parseInt(rowIndex));\r\n\t\t\t\t\t\tif(row && row.cells && row.cells.length > element)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tretValue = row.cells[element];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.util.isElement(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(element.nodeName == \"TD\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tretValue = element;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.util.isString(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isUndefinedOrNull(rowIndex))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar cellIndex = this.__nsGrid.__getColumnIndexByObject(this.__nsGrid.__getColumnObjectByDataField(element));\r\n\t\t\t\t\t\tif(!this.util.isUndefinedOrNull(cellIndex))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar row = this.__nsGrid.__getRowByIndex(parseInt(rowIndex));\r\n\t\t\t\t\t\t\tif(row && row.cells && row.cells.length > cellIndex)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tretValue = row.cells[cellIndex];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.util.isNumber(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tretValue = this.__nsGrid.__getRowByIndex(element);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.util.isElement(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(element.nodeName == \"TR\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tretValue = element;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tretValue = this.util.findParent(element,\"TR\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//in this case row will be blank as through dataField we cannot fetch row \r\n\t\t\t\t\telse if(this.util.isString(element))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__tblClickHandler = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\tvar parentType = this.__getTargetType();\r\n\t\t\tvar parent = this.util.findParent(target,parentType);\r\n\t\t\tif(parent)\r\n\t\t\t{\r\n\t\t\t\tvar arrRowIndexes = Object.keys(this.__objEditor);\r\n\t\t\t\tif(arrRowIndexes && arrRowIndexes.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!this.__config.enableMultipleEdit)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(parentType == \"TR\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//same row clicked so just return;\r\n\t\t\t\t\t\t\tvar objEditors = this.__getEditorsForRow(parent);\r\n\t\t\t\t\t\t\tif(objEditors)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar arrCellIndex = Object.keys(objEditors);\r\n\t\t\t\t\t\t\t\tif(arrCellIndex && arrCellIndex.length > 0)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t/*var cellIndex = arrCellIndex[0];\r\n\t\t\t\t\t\t\t\t\tvar cellItem = objEditors[cellIndex];\r\n\t\t\t\t\t\t\t\t\tcellItem.editor.setFocus();*/\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tthis.__commitRowEditorChanges();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//same cell clicked so just return;\r\n\t\t\t\t\t\t\tvar editor = this.__getEditor(null,parent);\r\n\t\t\t\t\t\t\tif(editor)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\teditor.setFocus();\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tthis.__commitRowEditorChanges();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__tblEventHandler = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\tvar parentType = this.__getTargetType();\r\n\t\t\tvar parent = this.util.findParent(target,parentType);\r\n\t\t\tif(parent)\r\n\t\t\t{\r\n\t\t\t\tthis.__handleEditors(parent);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__tblBlurHandler = function(event,detail)\r\n\t\t{\r\n\t\t\tthis.__callSaveForEditors();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__popUpWrapperMouseDownHandler = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tevent.stopPropagation();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__hasCellFocus = function(cell,editor)\r\n\t\t{\r\n\t\t\tvar hasFocus = false;\r\n\t\t\teditor = cell ? this.__getEditor(null,cell) : editor;\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tvar element = editor.getElement();\r\n\t\t\t\tvar hasFocusFunction = editor.hasFocus;\r\n\t\t\t\tif(hasFocusFunction && this.util.isFunction(hasFocusFunction))\r\n\t\t\t\t{\r\n\t\t\t\t\thasFocus = hasFocusFunction(); \r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\thasFocus = (element === document.activeElement);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn hasFocus;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__hasRowFocus = function(row)\r\n\t\t{\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar hasFocus = this.__hasCellFocus(null,arrEditor[count]);\r\n\t\t\t\t\t\tif(hasFocus)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar activeElement = document.activeElement;\r\n\t\t\t\t\tif(activeElement)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar activeRow = this.util.findParent(activeElement,\"TR\");\r\n\t\t\t\t\t\tif(activeRow && activeRow == row)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleEditors = function(element)\r\n\t\t{\r\n\t\t\tif(element.nodeName == \"TD\")\r\n\t\t\t{\r\n\t\t\t\tthis.__handleCellEditor(element);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__handleRowEditors(element);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callSaveForEditors = function(element)\r\n\t\t{\r\n\t\t\tif(element && element.nodeName == \"TD\")\r\n\t\t\t{\r\n\t\t\t\tthis.__callSaveForEditor(element);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__callSaveForRowEditors(element);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callCancelForEditors = function(element)\r\n\t\t{\r\n\t\t\tif(element && element.nodeName == \"TD\")\r\n\t\t\t{\r\n\t\t\t\tthis.__callCancelForEditor(element);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__callCancelForRowEditors(element);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleRowEditors = function(row)\r\n\t\t{\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar arrCells = row.cells;\r\n\t\t\t\tif(arrCells && arrCells.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrCells.length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__handleCellEditor(arrCells[count]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__commitRowEditorChanges = function(row)\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__commitEditorChanges(null,arrEditor[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callSaveForRowEditors = function(row)\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__callSaveForEditor(null,arrEditor[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callCancelForRowEditors = function(row)\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__callCancelForEditor(null,arrEditor[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callDestroyForRowEditors = function(row)\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__callDestroyForEditor(null,arrEditor[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callRowEditorsFunction = function(functionRef,param,defaultValue,row)\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors(row);\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__callEditorFunction(arrEditor[count],functionRef,param,defaultValue,true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__hasEditor = function()\r\n\t\t{\r\n\t\t\tvar arrEditor = this.__getOnlyEditors();\r\n\t\t\tif(arrEditor && arrEditor.length > 0)\r\n\t\t\t{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getOnlyEditors = function(row)\r\n\t\t{\r\n\t\t\tvar arrRet = [];\r\n\t\t\tif(this.util.isUndefinedOrNull(row))\r\n\t\t\t{\r\n\t\t\t\tvar arrEditor = this.__getAllEditors();\r\n\t\t\t\tfor(var count = 0;count < arrEditor.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar cellItem = arrEditor[count];\r\n\t\t\t\t\tarrRet.push(cellItem.editor);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isNumber(row))\r\n\t\t\t\t{\r\n\t\t\t\t\trow = this.__nsGrid.__getRowByIndex(row);\r\n\t\t\t\t}\r\n\t\t\t\tvar objEditors = this.__getEditorsForRow(row);\r\n\t\t\t\tif(objEditors)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var cellIndex in objEditors)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar cellItem = objEditors[cellIndex];\r\n\t\t\t\t\t\tarrRet.push(cellItem.editor);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn arrRet;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getAllEditors = function(element)\r\n\t\t{\r\n\t\t\tvar arrRet = [];\r\n\t\t\tif(this.__objEditor)\r\n\t\t\t{\r\n\t\t\t\tif(element)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(element.nodeName == \"TD\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\telement = this.util.findParent(element,\"TR\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(element)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar objEditors = this.__getEditorsForRow(element);\r\n\t\t\t\t\t\tif(objEditors)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar rowIndex = parseInt(element.getAttribute(\"ns-index\"));\r\n\t\t\t\t\t\t\tvar itemInfo = this.__nsGrid.__getItemByIndex(rowIndex);\r\n\t\t\t\t\t\t\tfor(var cellIndex in objEditors)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar cellItem = rowItem[cellIndex];\r\n\t\t\t\t\t\t\t\tvar colInfo = this.__nsGrid.__getColumnObject(cellIndex);\r\n\t\t\t\t\t\t\t\tarrRet.push({rowIndex: rowIndex,item: itemInfo,cellIndex: cellIndex,colInfo: colInfo,cellItem: cellItem,editor: cellItem.editor});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var rowIndex in this.__objEditor)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar rowItem = this.__objEditor[rowIndex];\r\n\t\t\t\t\t\tvar itemInfo = this.__nsGrid.__getItemByIndex(rowIndex);\r\n\t\t\t\t\t\tfor(var cellIndex in rowItem)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar cellItem = rowItem[cellIndex];\r\n\t\t\t\t\t\t\tvar colInfo = this.__nsGrid.__getColumnObject(cellIndex);\r\n\t\t\t\t\t\t\tarrRet.push({rowIndex: rowIndex,item: itemInfo,cellIndex: cellIndex,colInfo: colInfo,cellItem: cellItem,editor: cellItem.editor});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn arrRet;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleCellEditor = function(cell,event,item)\r\n\t\t{\r\n\t\t\tif(cell)\r\n\t\t\t{\r\n\t\t\t\tvar editor = this.__getEditor(null,cell);\r\n\t\t\t\tif(!editor)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar colIndex = cell.cellIndex;\r\n\t\t\t\t\tvar objColumn = this.__nsGrid.__getColumnObject(colIndex);\r\n\t\t\t\t\tif(objColumn && objColumn.enableEditable)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar row = cell.parentNode;\r\n\t\t\t\t\t\tvar rowIndex = this.__nsGrid.__getIndexFromRow(row);\r\n\t\t\t\t\t\tif(!item)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\titem = this.__nsGrid.__getItemByIndex(rowIndex);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(item)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(this.__isCellEditable(objColumn,item,cell,colIndex,row,rowIndex))\r\n\t\t\t\t\t\t    {\r\n\t\t\t\t\t\t\t\tvar callback = function(row,cell,editor)\r\n\t\t\t\t\t\t    \t{\r\n\t\t\t\t\t\t    \t\tthis.__insertEditorInObj(editor,row,cell);\r\n\t\t\t\t\t\t    \t};\r\n\t\t\t\t\t\t    \tthis.__createEditor(cell,objColumn,row,rowIndex,item,callback.bind(this,row,cell));\r\n\t\t\t\t\t\t    \t\r\n\t\t\t\t\t\t\t\tif(event)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t    }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createEditor = function(cell,objColumn,row,rowIndex,item,paramCallback)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar createPopUpWrapper = function()\r\n\t\t\t{\r\n\t\t\t\tvar container = document.body;\r\n\t\t      \tvar wrapper = self.util.createDiv(null,\"nsGridEditorPopUp\");\r\n\t\t      \tcontainer.appendChild(wrapper);\r\n\t\t      \treturn wrapper;\r\n\t\t\t};\r\n\t\t\tvar addChildInPopUp = function(element,parent)\r\n\t\t\t{\r\n\t\t\t\tparent.appendChild(element);\r\n\t\t\t};\r\n\t\t\tvar addChild = function(element)\r\n\t\t\t{\r\n\t\t\t\tdivChild.innerHTML = \"\";\r\n\t\t\t\tdivChild.appendChild(element);\r\n\t\t\t};\r\n\t\t\tvar commitChanges = function()\r\n\t\t\t{\r\n\t\t\t\tself.__callSaveForEditor.call(self,cell,editor);\r\n\t\t\t};\r\n\t\t\tvar cancelChanges = function()\r\n\t\t\t{\r\n\t\t\t\tself.__callCancelForEditor.call(self,cell,editor);\r\n\t\t\t};\r\n\t\t\tvar position = this.__getPosition(cell);\r\n\t\t\tvar editorSetting = this.__getEditorSetting(objColumn);\r\n\t\t\tvar divChild = cell.querySelector(\".\" + this.__nsGrid.__CLASS_CELL_CHILD);\r\n\t\t    var currentValue = item[objColumn.dataField];\r\n\t\t\tvar editorFunction = this.__getEditorFunction(editorSetting);\r\n\t\t\tvar setting = {cell:cell,row:row,item:item,rowIndex:rowIndex,cellIndex:cell.cellIndex,position:position,defaultValue:currentValue,\r\n\t\t\t\t\tcommitChanges:commitChanges,cancelChanges:cancelChanges,validator:editorSetting.validator,setting:editorSetting,column:objColumn,api:this.__nsGrid};\r\n\t\t\tvar callback = function(editorFunction)\r\n\t\t\t{\r\n\t\t\t\tvar editor = new editorFunction();\r\n\t\t\t\tvar retVal = editor.init(setting);\r\n\t\t\t\tvar initCallback = function(bodyCompInstance)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar element = editor.getElement();\r\n\t\t\t\t\tvar isPopUp = editor.isPopUp();\r\n\t\t\t\t\tvar popUpWrapper = null;\r\n\t\t\t\t\tif(isPopUp)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tpopUpWrapper = createPopUpWrapper();\r\n\t\t\t\t\t\tpopUpWrapper.style.top = (position.top - 5) + \"px\";\r\n\t\t\t\t\t\tpopUpWrapper.style.left = (position.left - 5) + \"px\";\r\n\t\t\t\t\t\tthis.__callEditorFunction(editor,\"setPopUpWrapper\",popUpWrapper,null,false);\r\n\t\t\t\t\t\taddChildInPopUp(element,popUpWrapper);\r\n\t\t\t\t\t\tif(this.__config.stopEditingOnGridFocusOut)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//stop propagation of event on document level so that pop up is not closed\r\n\t\t\t\t\t\t\tthis.util.addEvent(popUpWrapper,\"mousedown\", this.__popUpWrapperMouseDownHandler.bind(this));\r\n\t\t\t\t\t\t\tthis.__nsGrid.__addTouchEvent(popUpWrapper);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\taddChild(element);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__callEditorFunction(editor,\"elementAdded\",null,null,false);\r\n\t\t\t\t\tvar config = {cell:cell,row:row,divChild:divChild,setting:editorSetting,column:objColumn,item:item,isPopUp:isPopUp,element:element,popUpWrapper:popUpWrapper};\r\n\t\t\t\t\teditor[this.__getAttributeKey(\"config\")] = config;\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(retVal,initCallback.bind(this));\r\n\t\t\t\tparamCallback && paramCallback(editor);\r\n\t\t\t};\r\n\t\t\tthis.util.resolveFunctionOrPromise(editorFunction,callback.bind(this));\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__isCellEditable(objColumn,item,cell,cellIndex,row,rowIndex))\r\n\t\t\t{\r\n\t\t\t\tvar editorSetting = this.__getEditorSetting(objColumn);\r\n\t\t\t\tif(editorSetting && editorSetting.isCellEditableCallback)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn editorSetting.isCellEditableCallback(objColumn,item,cell,cellIndex,row,rowIndex,item[this.__nsGrid.__fieldRowLevel]);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callSaveForEditor = function(cell,editor)\r\n\t\t{\r\n\t\t\teditor = cell ? this.__getEditor(null,cell) : editor;\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tthis.__callEditorFunction(editor,\"save\",null,null,false);\r\n\t\t\t\tthis.__commitEditorChanges(cell,editor);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"Editor For cell could not be found\");\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callCancelForEditor = function(cell,editor)\r\n\t\t{\r\n\t\t\teditor = cell ? this.__getEditor(null,cell) : editor;\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tthis.__callEditorFunction(editor,\"cancel\",null,null,false);\r\n\t\t\t\tvar config = editor[this.__getAttributeKey(\"config\")];\r\n\t\t\t\tvar cell = config.cell;\r\n\t\t\t\tvar row = config.row;\r\n\t\t\t\tvar objColumn = config.column;\r\n\t\t\t\tvar item = config.item;\r\n\t\t\t\tvar editorSetting = config.setting;\r\n\t\t\t\tvar setValue = item[objColumn.dataField];\r\n\t\t\t\tthis.__setCellValue(cell,setValue,item,row,objColumn,editorSetting);\r\n\t\t\t\tthis.__callDestroyForEditor(cell,editor);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"Editor For cell could not be found\");\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callDestroyForEditor = function(cell,editor)\r\n\t\t{\r\n\t\t\teditor = cell ? this.__getEditor(null,cell) : editor;\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tthis.__callEditorFunction(editor,\"destroy\",null,null,false);\r\n\t\t\t\tvar config = editor[this.__getAttributeKey(\"config\")];\r\n\t\t\t\tvar element = null;\r\n\t\t\t\tif(config.isPopUp)\r\n\t\t\t\t{\r\n\t\t\t\t\telement = config.popUpWrapper;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\telement = editor.getElement();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif(element && element.parentNode)\r\n\t\t    \t{\r\n\t\t\t\t\telement.parentNode.removeChild(element);\r\n\t\t    \t}\r\n\t\t\t\tthis.__deleteEditor(null,cell,editor);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"Editor For cell could not be found\");\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__commitEditorChanges = function(cell,editor)\r\n\t\t{\r\n\t\t\teditor = cell ? this.__getEditor(null,cell) : editor;\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar destroyEditor = function()\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__callDestroyForEditor.call(self,cell);\r\n\t\t\t\t};\r\n\t\t\t\tvar config = editor[this.__getAttributeKey(\"config\")];\r\n\t\t\t\tvar cell = config.cell;\r\n\t\t\t\tvar row = config.row;\r\n\t\t\t\tvar objColumn = config.column;\r\n\t\t\t\tvar item = config.item;\r\n\t\t\t\tvar editorSetting = config.setting;\r\n\t\t\t\tvar value = editor.getValue();\r\n\t\t\t\tvar isValid = this.__callEditorFunction(editor,\"validate\",null,true,false);\r\n\t\t\t\tif(isValid)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar setValue = item[objColumn.dataField];\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar hasValueChanged = this.__callEditorFunction(editor,\"hasValueChanged\",setValue,null,null,false);\r\n\t\t\t\t\tif(hasValueChanged == null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thasValueChanged = !(setValue === value);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdestroyEditor();\r\n\t\t\t\t\tif(hasValueChanged)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetValue = value;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__setCellValue(cell,setValue,item,row,objColumn,editorSetting);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t//this.util.warning(\"NSGrid\",\"Editor For cell could not be found\");\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__callEditorFunction = function(editor,functionRef,param,defaultValue,checkCellFocus)\r\n\t\t{\r\n\t\t\tif(editor && editor[functionRef] && this.util.isFunction(editor[functionRef]))\r\n\t\t\t{\r\n\t\t\t\tcheckCellFocus = Boolean.parse(checkCellFocus);\r\n\t\t\t\tif(!checkCellFocus || this.__hasCellFocus(null,editor))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar retValue = null;\r\n\t\t\t\t\t/*var config = editor[this.__getAttributeKey(\"config\")];\r\n\t\t\t\t\tif(config)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tconsole.log(config.column.dataField + \" :: \" + config.item[config.column.dataField]);\r\n\t\t\t\t\t}*/\r\n\t\t\t\t\tvar retValue = null;\r\n\t\t\t\t\tif(param && this.util.isArray(param) && param.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tretValue = editor[functionRef].apply(null,param);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tretValue = editor[functionRef](param);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!this.util.isUndefinedOrNull(retValue))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn retValue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn defaultValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setCellValue = function(cell,newValue,item,row,objColumn,editorSetting)\r\n\t\t{\r\n\t\t\tif(cell)\r\n\t\t\t{\r\n\t\t\t\tvar colIndex = cell.cellIndex;\r\n\t\t\t\tvar rowIndex = this.__nsGrid.__getIndexFromRow(row);\r\n\t\t\t\tvar currentValue = item[objColumn.dataField];\r\n\t\t\t\titem[objColumn.dataField] = newValue;\r\n\t\t\t\tthis.__nsGrid.updateItemInDataSource(item);\r\n\t\t\t\tthis.__nsGrid.updateRowByIndex(rowIndex);\r\n\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.EDITOR_CELL_VALUE_CHANGED,cell,{cellIndex:colIndex,rowIndex:rowIndex,cell:cell,row:row,newValue:newValue,oldValue:currentValue,item:item});\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getAttributeKey = function(key)\r\n\t\t{\r\n\t\t\treturn \"__\" + this.__nsGrid.__fieldPrefix + \"_\" + key;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getPosition = function(element) \r\n\t\t{\r\n\t\t      var position = {\r\n\t\t        top: element.offsetTop,\r\n\t\t        left: element.offsetLeft,\r\n\t\t        bottom: 0,\r\n\t\t        right: 0,\r\n\t\t        width: this.util.getOuterWidth(element),\r\n\t\t        height: this.util.getOuterHeight(element),\r\n\t\t        visible: true};\r\n\t\t      position.bottom = position.top + position.height;\r\n\t\t      position.right = position.left + position.width;\r\n\t\r\n\t\t      // walk up the tree\r\n\t\t      var offsetParent = element.offsetParent;\r\n\t\t      while ((element = element.parentNode) != document.body) \r\n\t\t      {\r\n\t\t        if (position.visible && element.scrollHeight != element.offsetHeight && this.util.getStyleValue(element,\"overflowY\",false) != \"visible\") \r\n\t\t        {\r\n\t\t          \tposition.visible = position.bottom > element.scrollTop && position.top < element.scrollTop + element.clientHeight;\r\n\t\t        }\r\n\t\t        if (position.visible && element.scrollWidth != element.offsetWidth && this.util.getStyleValue(element,\"overflowX\",false) != \"visible\") \r\n\t\t        {\r\n\t\t          \tposition.visible = position.right > element.scrollLeft && position.left < element.scrollLeft + element.clientWidth;\r\n\t\t        }\r\n\t\t        position.left -= element.scrollLeft;\r\n\t\t        position.top -= element.scrollTop;\r\n\t\t        if (element === offsetParent) \r\n\t\t        {\r\n\t\t          \tposition.left += element.offsetLeft;\r\n\t\t          \tposition.top += element.offsetTop;\r\n\t\t          \toffsetParent = element.offsetParent;\r\n\t\t        }\r\n\t\t        position.bottom = position.top + position.height;\r\n\t\t        position.right = position.left + position.width;\r\n\t\t      }\r\n\t\r\n\t\t      return position;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getMouseEventType = function()\r\n\t\t{\r\n\t\t\tvar retValue = \"dblclick\";\r\n\t\t\tswitch(this.__config.clickType)\r\n\t\t\t{\r\n\t\t\t\tcase NSGrid.EDITOR_EDITING_SINGLECLICK:\r\n\t\t\t\t\tretValue = \"click\";\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase NSGrid.EDITOR_EDITING_DOUBLECLICK:\r\n\t\t\t\t\tretValue = \"dblclick\";\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase NSGrid.EDITOR_EDITING_NOCLICK:\r\n\t\t\t\t\tretValue = \"\";\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getEditorSetting = function(objColumn)\r\n\t\t{\r\n\t\t\tvar editorSetting = objColumn.editorSetting;\r\n\t\t\tif(!editorSetting)\r\n\t\t\t{\r\n\t\t\t\teditorSetting = this.__defaultCellSetting;\r\n\t\t\t}\r\n\t\t\treturn editorSetting;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getEditorFunction = function(editorSetting)\r\n\t\t{\r\n\t\t\tvar retFunction = null;\r\n\t\t\tif(editorSetting)\r\n\t\t\t{\r\n\t\t\t\tswitch(editorSetting.type)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase NSGrid.EDITOR_TYPE_TEXT:\r\n\t\t\t\t\t\tretFunction = this.__nsTextEditor;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase NSGrid.EDITOR_TYPE_TEXTAREA:\r\n\t\t\t\t\t\tretFunction = this.__nsTextAreaEditor;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase NSGrid.EDITOR_TYPE_CUSTOM:\r\n\t\t\t\t\t\tretFunction = editorSetting.customEditor;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn retFunction;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getTargetType = function()\r\n\t\t{\r\n\t\t\tif(this.__config.editType == NSGrid.EDITOR_EDITTYPE_ROW)\r\n\t\t\t{\r\n\t\t\t\treturn \"TR\";\r\n\t\t\t}\r\n\t\t\treturn \"TD\";\r\n\t\t};\r\n\t\t\r\n\t\tthis.__insertEditorInObj = function(editor,row,cell)\r\n\t\t{\r\n\t\t\tvar item = this.__getRowCellInfo(row,cell);\r\n\t\t\tif(item && item.cellIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tif(!this.__config.enableMultipleEdit)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar parentType = this.__getTargetType();\r\n\t\t\t\t\tif(parentType == \"TR\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.__objEditor[item.rowIndex] && this.__objEditor[item.rowIndex][item.cellIndex])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__objEditor[item.rowIndex][item.cellIndex] = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__objEditor = {};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__objEditor[item.rowIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__objEditor[item.rowIndex] = {};\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__objEditor[item.rowIndex][item.cellIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__objEditor[item.rowIndex][item.cellIndex] = {};\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__objEditor[item.rowIndex][item.cellIndex].editor)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__objEditor[item.rowIndex][item.cellIndex].editor = editor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getEditor = function(row,cell)\r\n\t\t{\r\n\t\t\tvar item = this.__getRowCellInfo(row,cell);\r\n\t\t\tif(item && item.cellIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tif(this.__objEditor && this.__objEditor[item.rowIndex] && this.__objEditor[item.rowIndex][item.cellIndex] && this.__objEditor[item.rowIndex][item.cellIndex].editor)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__objEditor[item.rowIndex][item.cellIndex].editor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getEditorsForRow = function(row)\r\n\t\t{\r\n\t\t\tvar item = this.__getRowCellInfo(row,null);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.__objEditor && this.__objEditor[item.rowIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__objEditor[item.rowIndex];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__deleteEditor = function(row,cell,editor)\r\n\t\t{\r\n\t\t\tif(editor)\r\n\t\t\t{\r\n\t\t\t\tcell = cell ? cell : this.util.findParent(editor.getElement(),\"TD\");\r\n\t\t\t}\r\n\t\t\tvar item = this.__getRowCellInfo(row,cell);\r\n\t\t\tif(item && item.cellIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tif(this.__objEditor && this.__objEditor[item.rowIndex] && this.__objEditor[item.rowIndex][item.cellIndex] && this.__objEditor[item.rowIndex][item.cellIndex].editor)\r\n\t\t\t\t{\r\n\t\t\t\t\tdelete this.__objEditor[item.rowIndex][item.cellIndex];\r\n\t\t\t\t\tvar objKeys = Object.keys(this.__objEditor[item.rowIndex]);\r\n\t\t\t\t\tif(!objKeys || objKeys.length == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdelete this.__objEditor[item.rowIndex];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__deleteEditorsForRow = function(row)\r\n\t\t{\r\n\t\t\tvar item = this.__getRowCellInfo(row,null);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.__objEditor && this.__objEditor[item.rowIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\tvar rowEditors = this.__objEditor[item.rowIndex];\r\n\t\t\t\t\tfor(var cellIndex in rowEditors)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(rowEditors[cellIndex].editor)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdelete rowEditors[cellIndex].editor;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getRowCellInfo = function(row,cell)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar getInfo = function(rowIndex,cellIndex,rowRet,cellRet)\r\n\t\t\t{\r\n\t\t\t\tvar itemInfo = self.__nsGrid.__getItemByIndex(rowIndex);\r\n\t\t\t\tvar colInfo = self.__nsGrid.__getColumnObject(cellIndex);\r\n\t\t\t\treturn {rowIndex: rowIndex,cellIndex: cellIndex,rowInfo: itemInfo,colInfo: colInfo,row: rowRet,cell: cellRet};\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(!this.util.isUndefinedOrNull(row) && !this.util.isUndefinedOrNull(cell))\r\n\t\t\t{\r\n\t\t\t\tvar rowIndex = -1;\r\n\t\t\t\tvar cellIndex = -1;\r\n\t\t\t\tvar rowRet = null;\r\n\t\t\t\tvar cellRet = null;\r\n\t\t\t\tif(this.util.isElement(row))\r\n\t\t\t\t{\r\n\t\t\t\t\trowIndex = parseInt(row.getAttribute(\"ns-index\"));\r\n\t\t\t\t\trowRet = row;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isNumber(row))\r\n\t\t\t\t{\r\n\t\t\t\t\trowIndex = parseInt(row);\r\n\t\t\t\t\trowRet = this.__nsGrid.__getRowByIndex(rowIndex);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isElement(cell))\r\n\t\t\t\t{\r\n\t\t\t\t\tcellIndex = parseInt(cell.cellIndex);\r\n\t\t\t\t\tcellRet = cell;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isNumber(cell))\r\n\t\t\t\t{\r\n\t\t\t\t\tcellIndex = parseInt(cell);\r\n\t\t\t\t\tcellRet = rowRet.cells[cellIndex];\r\n\t\t\t\t}\r\n\t\t\t\tvar retItem = getInfo(rowIndex,cellIndex,rowRet,cellRet);\r\n\t\t\t\treturn retItem;\r\n\t\t\t}\r\n\t\t\telse if(!this.util.isUndefinedOrNull(cell))\r\n\t\t\t{\r\n\t\t\t\tvar rowIndex = -1;\r\n\t\t\t\tvar cellIndex = -1;\r\n\t\t\t\tvar rowRet = null;\r\n\t\t\t\tvar cellRet = null;\r\n\t\t\t\tif(this.util.isElement(cell))\r\n\t\t\t\t{\r\n\t\t\t\t\tcellIndex = parseInt(cell.cellIndex);\r\n\t\t\t\t\tcellRet = cell;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isNumber(cell))\r\n\t\t\t\t{\r\n\t\t\t\t\tcellIndex = parseInt(cell);\r\n\t\t\t\t\tcellRet = rowRet.cells[cellIndex];\r\n\t\t\t\t}\r\n\t\t\t\trowRet = cellRet.parentElement;\r\n\t\t\t\trowIndex = parseInt(rowRet.getAttribute(\"ns-index\"));\r\n\t\t\t\tvar retItem = getInfo(rowIndex,cellIndex,rowRet,cellRet);\r\n\t\t\t\treturn retItem;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse if(!this.util.isUndefinedOrNull(row))\r\n\t\t\t{\r\n\t\t\t\tvar rowIndex = -1;\r\n\t\t\t\tvar rowRet = null;\r\n\t\t\t\t\r\n\t\t\t\tif(this.util.isElement(row))\r\n\t\t\t\t{\r\n\t\t\t\t\trowIndex = parseInt(row.getAttribute(\"ns-index\"));\r\n\t\t\t\t\trowRet = row;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isNumber(row))\r\n\t\t\t\t{\r\n\t\t\t\t\trowIndex = parseInt(row);\r\n\t\t\t\t\trowRet = this.__nsGrid.__getRowByIndex(rowIndex);\r\n\t\t\t\t}\r\n\t\t\t\tvar itemInfo = this.__nsGrid.__getItemByIndex(rowIndex);\r\n\t\t\t\treturn {rowIndex: rowIndex,cellIndex: -1,rowInfo: itemInfo,colInfo: null,row: rowRet,cell: null};\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn null;\r\n\t\t};\r\n    \r\n\t\tthis.__destroy = function()\r\n\t\t{\r\n\t\t\tif(this.__tblClickRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__removeTouchEvent(this.__table);\r\n\t\t\t\tthis.util.removeEvent(this.__table,\"click\", this.__tblClickRef);\r\n\t\t\t\tthis.__tblClickRef = null;\r\n\t\t\t}\r\n\t\t\tif(this.__tblEventRef)\r\n\t\t\t{\r\n\t\t\t\tvar mouseEvent = this.__getMouseEventType();\r\n\t\t\t\tthis.util.removeEvent(this.__table,mouseEvent, this.__tblEventRef);\r\n\t\t\t\tthis.__tblEventRef = null;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(this.__documentKeyEventRef)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeEvent(document,\"keydown\", this.__documentKeyEventRef);\r\n\t\t\t\tthis.__documentKeyEventRef = null;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__nsTextEditor = function() \r\n\t\t{\r\n\t\t    var input;\r\n\t\t    var defaultValue;\r\n\t\t    var setting = null;\r\n\t\t    var self = this;\r\n\t\t    var util = new NSUtil();\r\n\t\t    \r\n\t\t    this.init = function(config) \r\n\t\t    {\r\n\t\t    \tsetting = config;\r\n\t\t    \tvar editorSetting = setting.setting;\r\n\t\t    \tvar params = this.__getParams(editorSetting.params);\r\n\t\t    \tinput = util.createElement(\"input\",null,\"nsTextEditor\"); \r\n\t\t    \tdefaultValue = setting.defaultValue;\r\n\t\t      \tinput.value = defaultValue;\r\n\t\t      \tinput.style.width = \"98%\";\r\n\t\t      \tif(params.cssClass)\r\n\t\t      \t{\r\n\t\t      \t\tutil.addStyleClass(input,params.cssClass);\r\n\t\t      \t}\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.getElement = function()\r\n\t\t    {\r\n\t\t    \treturn input;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.elementAdded = function()\r\n\t\t    {\r\n\t\t    \tutil.addEvent(input,\"click\",function(event){\r\n\t\t    \t\tevent = util.getEvent(event);\r\n\t\t    \t\tself.setFocus();\r\n\t\t    \t\t//the below line stops propagation and hence document click handler is not fired in handleCellSelector\r\n\t\t    \t\t//event.stopPropagation();\r\n\t\t    \t\t//event.stopImmediatePropagation();\r\n\t\t    \t\tevent.preventDefault();\r\n\t\t    \t});\r\n\t\t    \tinput.focus();\r\n\t\t      \tinput.select();\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.handleKeyDown = function(event,keyCode) \r\n\t\t    {\r\n\t\t    \tvar objKeyCode = util.KEYCODE;\r\n\t\t    \tif (keyCode == objKeyCode.LEFT && keyCode == objKeyCode.RIGHT) \r\n\t\t      \t{\r\n\t\t    \t\tevent.stopImmediatePropagation();\r\n\t\t      \t} \r\n\t\t    };\r\n\t\t    \r\n\t\t    this.getValue = function() \r\n\t\t    {\r\n\t\t      \treturn input.value;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.destroy = function() \r\n\t\t    {\r\n\t\t    \t\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.setFocus = function()\r\n\t\t    {\r\n\t\t    \tinput.focus();\r\n\t\t    \t//setTimeout(function(){input.selectionStart = input.selectionEnd = 10000; }, 0);\r\n\t\t    \tinput.selectionEnd = input.selectionStart = input.value.length;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.hasValueChanged = function(currentValue) \r\n\t\t    {\r\n\t\t      \treturn (!(input.value == \"\" && currentValue == null)) && (input.value != currentValue);\r\n\t\t    };\r\n\t\t\t\r\n\t\t    this.validate = function() \r\n\t\t    {\r\n\t\t    \tif(setting.validator)\r\n\t\t    \t{\r\n\t\t    \t\treturn setting.validator(input,input.value);\r\n\t\t    \t}\r\n\t\t      \treturn true;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.isPopUp = function()\r\n\t\t    {\r\n\t\t    \treturn false;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.save = function() \r\n\t\t    {\r\n\t\t    \t\r\n\t\t    };\r\n\t\r\n\t\t    this.cancel = function() \r\n\t\t    {\r\n\t\t      \tinput.value = defaultValue;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.setPopUpWrapper = function(popUpWrapper) \r\n\t\t    {\r\n\t\t    \t\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.__getParams = function(params)\r\n\t\t    {\r\n\t\t    \tif(!params)\r\n\t\t    \t{\r\n\t\t    \t\tparams = {};\r\n\t\t    \t}\r\n\t\t    \tparams = {\r\n\t\t    \t\tcssClass: params.cssClass || null,\r\n\t\t    \t};\r\n\t\t    \t\r\n\t\t    \treturn params;\r\n\t\t    };\r\n\t\r\n\t\t};\r\n\t\r\n\t\tthis.__nsTextAreaEditor = function() \r\n\t\t{\r\n\t\t    var input, wrapper, parentWrapper;\r\n\t\t    var defaultValue;\r\n\t\t    var util = new NSUtil();\r\n\t\t    var setting = null;\r\n\t\t    var self = this;\r\n\t\t\t\r\n\t\t    this.init = function (config) \r\n\t\t    {\r\n\t\t    \tsetting = config;\r\n\t\t    \tvar editorSetting = setting.setting;\r\n\t\t    \tvar params = this.__getParams(editorSetting.params);\r\n\t\t      \twrapper = util.createDiv(null,\"nsGridTextAreaEditor\");\r\n\t\t      \tinput = util.createElement(\"textarea\",null,\"nsGridTextArea\"); \r\n\t\t      \tif(params.cssClass.textArea)\r\n\t\t      \t{\r\n\t\t      \t\tutil.addStyleClass(input,params.cssClass.textArea);\r\n\t\t      \t}\r\n\t\t      \tinput.setAttribute(\"hidefocus\",true);\r\n\t\t      \tinput.setAttribute(\"rows\",params.rows);\r\n\t\t      \twrapper.appendChild(input);\r\n\t\t      \twrapper.appendChild(document.createElement(\"br\"));\r\n\t\t      \tvar buttonWrapper = util.createDiv(null);\r\n\t\t      \tbuttonWrapper.style.textAlign = \"right\";\r\n\t\t      \twrapper.appendChild(buttonWrapper);\r\n\t\t      \tvar btnSave = util.createElement(\"button\",null,params.cssClass.saveButton);\r\n\t\t      \tbtnSave.appendChild(document.createTextNode(params.saveButtonText));\r\n\t\t      \tutil.addEvent(btnSave,\"click\",this.__saveHandler);\r\n\t\t      \tbuttonWrapper.appendChild(btnSave);\r\n\t\t      \tbuttonWrapper.appendChild(document.createTextNode(\" \"));\r\n\t\t      \tvar btnCancel = util.createElement(\"button\",null,params.cssClass.cancelButton);\r\n\t\t      \tbtnCancel.appendChild(document.createTextNode(params.cancelButtonText));\r\n\t\t      \tbuttonWrapper.appendChild(btnCancel);\r\n\t\t      \tutil.addEvent(btnCancel,\"click\",this.__cancelHandler);\r\n\t\t      \tdefaultValue = setting.defaultValue;\r\n\t\t      \tinput.value = defaultValue;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.getElement = function()\r\n\t\t    {\r\n\t\t    \treturn wrapper;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.elementAdded = function()\r\n\t\t    {\r\n\t\t    \tinput.focus();\r\n\t\t      \tinput.select();\r\n\t\t    };\r\n\t\r\n\t\t    this.handleKeyDown = function(event,keyCode) \r\n\t\t    {\r\n\t\t    \tevent = util.getEvent(event);\r\n\t\t    \tvar objKeyCode = util.KEYCODE;\r\n\t\t      \tif (keyCode == objKeyCode.ENTER && event.ctrlKey) \r\n\t\t      \t{\r\n\t\t        \tself.save();\r\n\t\t      \t} \r\n\t\t    };\r\n\t\t    \r\n\t\t    this.getValue = function() \r\n\t\t    {\r\n\t\t      \treturn input.value;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.destroy = function() \r\n\t\t    {\r\n\t\t    \t\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.setFocus = function()\r\n\t\t    {\r\n\t\t    \tinput.focus();\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.hasFocus = function()\r\n\t\t    {\r\n\t\t    \treturn input === document.activeElement;\r\n\t\t    };\r\n\t\r\n\t\t    this.hasValueChanged = function(currentValue) \r\n\t\t    {\r\n\t\t      \treturn (!(input.value == \"\" && currentValue == null)) && (input.value != currentValue);\r\n\t\t    };\r\n\t\r\n\t\t    this.validate = function() \r\n\t\t    {\r\n\t\t    \tif(setting.validator)\r\n\t\t    \t{\r\n\t\t    \t\treturn setting.validator(input,input.value);\r\n\t\t    \t}\r\n\t\t      \treturn true;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.isPopUp = function()\r\n\t\t    {\r\n\t\t    \treturn true;\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.save = function () \r\n\t\t    {\r\n\t\t    \t\r\n\t\t    };\r\n\t\r\n\t\t    this.cancel = function () \r\n\t\t    {\r\n\t\t      \tinput.value = defaultValue;\r\n\t\t      \t\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.setPopUpWrapper = function(popUpWrapper) \r\n\t\t    {\r\n\t\t    \tparentWrapper = popUpWrapper;\r\n\t\t    };\r\n\t\t    \r\n\t\t    //non framework function\r\n\t\t    this.__saveHandler = function(event)\r\n\t\t    {\r\n\t\t    \tsetting.commitChanges();\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.__cancelHandler = function(event)\r\n\t\t    {\r\n\t\t    \tsetting.cancelChanges();\r\n\t\t    };\r\n\t\t    \r\n\t\t    this.__getParams = function(params)\r\n\t\t    {\r\n\t\t    \tif(!params)\r\n\t\t    \t{\r\n\t\t    \t\tparams = {};\r\n\t\t    \t}\r\n\t\t    \tif(!params.cssClass)\r\n\t\t    \t{\r\n\t\t    \t\t params.cssClass = {};\r\n\t\t    \t}\r\n\t\t    \tvar cssClass = {\r\n\t\t    \t\t\ttextArea: params.cssClass[\"textArea\"] || null,\r\n\t\t    \t\t\tsaveButton: params.cssClass[\"saveButton\"] || null,\r\n\t\t    \t\t\tcancelButton: params.cssClass[\"cancelButton\"] || null\r\n\t\t    \t};\r\n\t\t    \tparams = {\r\n\t\t    \t\trows: params.rows || 5,\r\n\t\t    \t\tcssClass: cssClass,\r\n\t\t    \t\tsaveButtonText: params.saveButtonText || \"Save\",\r\n\t\t    \t\tcancelButtonText: params.cancelButtonText || \"Cancel\",\r\n\t\t    \t};\r\n\t\t    \t\r\n\t\t    \treturn params;\r\n\t\t    };\r\n\t\t    \r\n\t\t};\r\n\t\t\r\n\t};\r\n\treturn NSGridEditor;\r\n})();\r\nnsModuleExport(this,\"NSGridEditor\",NSGridEditor);\r\n\r\nvar NSGridKeyboard = (function()\r\n{\r\n\tvar NSGridKeyboard = function(nsGrid)\r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = this.__nsGrid.util;\r\n\t\t\r\n\t\tvar self = this;\r\n\t\t\r\n\t\tthis.keyDownHandler = function(event,keyCode)\r\n\t\t{\r\n\t\t\tvar isShiftCtrlPressed = this.__nsGrid.__isShiftPressed || this.__nsGrid.__isCtrlPressed;\r\n\t\t\tvar source = this.__nsGrid.__objGrid.__getFlatSource();\r\n\t\t\t//key Up\r\n\t\t\tif(keyCode === this.util.KEYCODE.UP && isShiftCtrlPressed && this.__enableMultipleSelection)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__lastNavigationDirection && this.__nsGrid.__lastNavigationDirection === this.__nsGrid.NAVIGATION_DOWN)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.__nsGrid.NAVIGATION_UP);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__nsGrid.__selectedIndex != 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__selectedIndex--;\r\n\t\t\t\t\tthis.__nsGrid.__navigationIndex--;\r\n\t\t\t\t\twhile(!this.__nsGrid.__isMouseHoverAllowed(this.__nsGrid.__selectedIndex))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__selectedIndex--;\r\n\t\t\t\t\t\tthis.__nsGrid.__navigationIndex--;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.__nsGrid.NAVIGATION_UP);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//key down\r\n\t\t\telse if(keyCode === this.util.KEYCODE.DOWN && isShiftCtrlPressed && this.__nsGrid.__enableMultipleSelection)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__lastNavigationDirection && this.__nsGrid.__lastNavigationDirection === this.__nsGrid.NAVIGATION_UP)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.__nsGrid.NAVIGATION_DOWN);\r\n\t\t\t\t}\r\n\t\t\t\tif(source && this.__nsGrid.__selectedIndex != source.length - 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__selectedIndex++;\r\n\t\t\t\t\tthis.__nsGrid.__navigationIndex++;\r\n\t\t\t\t\twhile(!this.__nsGrid.__isMouseHoverAllowed(this.__nsGrid.__selectedIndex))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__selectedIndex++;\r\n\t\t\t\t\t\tthis.__nsGrid.__navigationIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.__nsGrid.NAVIGATION_DOWN);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(keyCode === this.__nsGrid.util.KEYCODE.UP)\r\n\t\t\t{\r\n\t\t\t\tif(source && this.__nsGrid.__navigationIndex === -1)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__navigationIndex = source.length - 1;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__nsGrid.__navigationIndex > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__keyBoardNavigationHandler(event,this.__nsGrid.NAVIGATION_UP);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(keyCode === this.util.KEYCODE.DOWN)\r\n\t\t\t{\r\n\t\t\t\tif(source)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__keyBoardNavigationHandler(event,this.__nsGrid.NAVIGATION_DOWN);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(keyCode === this.util.KEYCODE.ENTER)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__clearAllRowSelection(false);\r\n\t\t\t\tvar row = this.__getkeyboardNavigationRow();\r\n\t\t\t\tif(row)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__markRowSelected(this.__nsGrid.__getIndexFromRow(row));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__keyBoardNavigationHandler = function(event,direction)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar lastIndex = this.__nsGrid.__navigationIndex;\r\n\t\t\tvar currentIndex = this.__nsGrid.__navigationIndex;\r\n\t\t\t(direction === this.__nsGrid.NAVIGATION_UP) ? currentIndex--:currentIndex++;\r\n\t\t\twhile(!this.__nsGrid.__isMouseHoverAllowed(currentIndex))\r\n\t\t\t{\r\n\t\t\t\t(direction === this.__nsGrid.NAVIGATION_UP) ? currentIndex--:currentIndex++;\r\n\t\t\t}\r\n\t\t\tvar endHandler = function()\r\n\t\t\t{\r\n\t\t\t\tself.__nsGrid.__navigationIndex = currentIndex;\r\n\t\t\t\tvar row = self.__getkeyboardNavigationRow();\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tif(row)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar source = self.__nsGrid.__objGrid.__getFlatSource();\r\n\t\t\t\t\tindex = self.__nsGrid.__getIndexFromRow(row);\r\n\t\t\t\t\titem = self.__nsGrid.__getItemByIndex(index, source);\r\n\t\t\t\t}\r\n\t\t\t\tself.__nsGrid.__dispatchEvent(NSGrid.ROW_NAVIGATED,item,{rowIndex:index,item:item,row:row});\r\n\t\t\t\tself.__nsGrid.__lastNavigationDirection = null;\r\n\t\t\t};\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tvar virtualHandler = function()\r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = self.__nsGrid.__getVisibleItemByIndex.call(self.__nsGrid,null,currentIndex);\r\n\t\t\t\t\tif(item)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar index = item[self.__nsGrid.__fieldIndex];\r\n\t\t\t\t\t\tself.__setVirtualRowHoverField.call(self,index);\r\n\t\t\t\t\t\tself.__virtualRowHover.call(self);\r\n\t\t\t\t\t\tendHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.__nsGrid.scrollToIndex(currentIndex,false);\r\n\t\t\t\t\r\n\t\t\t\tsetTimeout(function()\r\n\t\t\t\t{ \r\n\t\t\t\t\tvirtualHandler();\r\n\t\t\t\t},0);\r\n\t\t\t\t//this.__setVirtualRowHover(currentIndex);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar row = this.__nsGrid.__getRowFromContainer(lastIndex);\r\n\t\t\t\tvar currentRow = this.__nsGrid.__getRowFromContainer(currentIndex);\r\n\t\t\t\tif(currentRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.removeStyleClass(row,\"nsRowHover\");\r\n\t\t\t\t\tthis.util.addStyleClass(currentRow,\"nsRowHover\");\r\n\t\t\t\t\tthis.__refreshScrollPosition(currentRow,direction);\r\n\t\t\t\t\tendHandler();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tevent.preventDefault();\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\r\n\t\tthis.__keyBoardSelectionHandler = function(event,direction)\r\n\t\t{\r\n\t\t\tvar selectedIndex = this.__nsGrid.__selectedIndex;\r\n\t\t\tif(this.__nsGrid.__isRowSelected(selectedIndex))\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__markRowUnselected(selectedIndex);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__markRowSelected(selectedIndex);\r\n\t\t\t}\r\n\t\t\tif(direction === this.__nsGrid.NAVIGATION_DOWN)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.scrollToIndex(selectedIndex,false);\r\n\t\t\t\t}\r\n\t\t\t\telse if(Math.floor(selectedIndex % this.__nsGrid.__pageSize) === 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar row = this.__nsGrid.__getRowByIndex(selectedIndex);\r\n\t\t\t\t\tthis.__refreshScrollPosition(row,this.__nsGrid.NAVIGATION_DOWN);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(direction === this.__nsGrid.NAVIGATION_UP)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.scrollToIndex(selectedIndex,false);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar row = this.__nsGrid.__getRowByIndex(selectedIndex);\r\n\t\t\t\t\tthis.__refreshScrollPosition(row,this.__nsGrid.NAVIGATION_UP);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__lastNavigationDirection = direction;\r\n\t\t\tevent.preventDefault();\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\r\n\t\tthis.__refreshScrollPosition = function(row,direction)\r\n\t\t{\r\n\t\t\tif(!this.__isElementInView(row))\r\n\t\t\t{\r\n\t\t\t\tthis.__scrollToRow(row,direction);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isElementInView = function(row)\r\n\t\t{\r\n\t\t\tvar cellBottom = 0;\r\n\t\t    var parentBottom = 0;\r\n\t\t    var cellTop = 0;\r\n\t\t    var parentTop = 0;\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar scrollParent = this.__nsGrid.__divCenterTableBodyContainer;\r\n\t\t\t\tvar listChild = row;//.querySelector(\".nsListChild\");\r\n\t\t\t\tif(scrollParent && listChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar cellRect = listChild.getBoundingClientRect();\r\n\t\t            parentTop = 0;\r\n\t\t            var rectScrollParent = scrollParent.getBoundingClientRect();\r\n\t\t            parentBottom = rectScrollParent.height;\r\n\t\t            cellTop =  cellRect.top - rectScrollParent.top;\r\n\t\t            cellBottom = cellTop + cellRect.height;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn cellBottom <= parentBottom && cellTop >= parentTop;\r\n\t\t};\r\n\t\r\n\t\tthis.__scrollToRow = function(row,direction)\r\n\t\t{\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar scrollParent = this.__nsGrid.__divCenterTableBodyContainer;\r\n\t\t\t\tvar rowRect = row.getBoundingClientRect();\r\n\t\t\t\tvar currentScroll = scrollParent.scrollTop;\r\n\t\t\t\tscrollParent.scrollTop = (direction === this.__nsGrid.NAVIGATION_UP) ? (currentScroll - rowRect.height) : (currentScroll + rowRect.height);\r\n\t\t\t}\r\n\t\t\t/*if(row)\r\n\t\t\t{\r\n\t\t\t\tvar scrollParent = this.__nsGrid.__divCenterTableBodyContainer;\r\n\t\t\t\tvar rowRect = row.getBoundingClientRect();\r\n\t\t\t\tvar rowTop = rowRect.top;\r\n\t\t\t\tvar rowBottom = rowTop + rowRect.height;\r\n\t\t\t\tvar scrollParentHeight = scrollParent.getBoundingClientRect().height;\r\n\t\t\t\tvar currentScroll = scrollParent.scrollTop;\r\n\t\t\t\t// scroll up\r\n\t\t\t\tif (rowTop < 0)// && \r\n\t\t\t\t{\r\n\t\t\t\t\tscrollParent.scrollTop = currentScroll + rowTop;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// scroll down\r\n\t\t\t\t//else if (direction === this.__nsGrid.NAVIGATION_UP)//rowBottom  > scrollParentHeight\r\n\t\t\t\t//{\r\n\t\t\t\t\tvar scrollAmount = rowBottom - scrollParentHeight;\r\n\t\t\t\t\tconsole.log(rowBottom + \"-\" + scrollParentHeight + \" = \" + scrollAmount)\r\n\t\t\t\t\tscrollParent.scrollTop = currentScroll + scrollAmount;\r\n\t\t\t\t//}\r\n\t\t\t}*/\r\n\t\t};\r\n\t\r\n\t\tthis.__getkeyboardNavigationRow = function()\r\n\t\t{\r\n\t\t\tvar row = null;\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\trow = this.__nsGrid.__tblCenterBody.tBodies[0].querySelector(\".nsRowHover\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\trow = this.__nsGrid.__getRowFromContainer(this.__nsGrid.__navigationIndex);\r\n\t\t\t}\r\n\t\t\treturn row;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__virtualRowHover = function()\r\n\t\t{\r\n\t\t\tvar arrRows = this.__nsGrid.__getBodyBodyRow(this.__nsGrid.__tblCenterBody);\r\n\t\t\tif(this.__nsGrid.__hasBodyRows() && arrRows.length > 0 && this.__nsGrid.__arrInternalSource)\r\n\t\t\t{\r\n\t\t\t\tvar row = null;\r\n\t\t\t\tvar index = null;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tfor(var count = 0; count < arrRows.length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\trow = arrRows[count];\r\n\t\t\t\t\tindex = this.__nsGrid.__getIndexFromRow(row);\r\n\t\t\t\t\titem = this.__nsGrid.__getItemByIndex(index);\r\n\t\t\t\t\t(item && item[this.__nsGrid.__fieldHover]) ? this.util.addStyleClass(row,\"nsRowHover\") : this.util.removeStyleClass(row,\"nsRowHover\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setVirtualRowHoverField = function(indexToSet)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t{\r\n\t\t\t\tindexToSet = -1;\r\n\t\t\t}\r\n\t\t\tvar source = this.__nsGrid.__objGrid.__getFlatSource();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tfor(var count = 0; count < source.length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = source[count];\r\n\t\t\t\t\tif(item)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__nsGrid.__fieldHover] = (item[this.__nsGrid.__fieldIndex] === indexToSet); \r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setVirtualRowHover = function(indexToSet)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t\t{\r\n\t\t\t\t\tindexToSet = 0;\r\n\t\t\t\t}\r\n\t\t\t\tvar item = this.__nsGrid.__getVisibleItemByIndex(null,indexToSet);\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__navigationIndex = indexToSet;\r\n\t\t\t\t\tvar index = item[this.__nsGrid.__fieldIndex];\r\n\t\t\t\t\tthis.__setVirtualRowHoverField(index);\r\n\t\t\t\t\tthis.__virtualRowHover();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setRowHover = function(indexToSet)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t{\r\n\t\t\t\tindexToSet = 0;\r\n\t\t\t}\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__setVirtualRowHover(indexToSet);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t\t{\r\n\t\t\t\t\tindexToSet = 0;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsGrid.__navigationIndex = indexToSet;\r\n\t\t\t\tvar row = this.__nsGrid.__getRowFromContainer(this.__nsGrid.__navigationIndex);\r\n\t\t\t\tthis.util.addStyleClass(row,\"nsRowHover\");\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\treturn NSGridKeyboard;\r\n})();\r\nnsModuleExport(this,\"NSGridKeyboard\",NSGridKeyboard);\r\n\r\nvar NSGridSort = (function()\r\n{\r\n\tvar NSGridSort = function(nsGrid)\r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = this.__nsGrid.util;\r\n\t\tthis.__arrFields = [];\r\n\t\t\r\n\t\tthis.__CLASS_SORTING_ASC = \"nsSortedAsc\";\r\n\t\tthis.__CLASS_SORTING_DESC = \"nsSortedDesc\";\r\n\t\t\r\n\t\tthis.determineSortFunction = function(item,colItem)\r\n\t\t{\r\n\t\t\treturn this.__determineSortFunction(item,colItem);\r\n\t\t};\r\n\t\t\r\n\t\tthis.handle = function(header,columnDetail,isMultiColumnSort,customIsAscending)\r\n\t\t{\r\n\t\t\tthis.__handleSorting(header,columnDetail,isMultiColumnSort,customIsAscending);\r\n\t\t};\r\n\t\t\r\n\t\tthis.reset = function()\r\n\t\t{\r\n\t\t\tthis.__resetColumnHeaders(false);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleSorting= function(header,columnDetail,isMultiColumnSort,customIsAscending)\r\n\t\t{\r\n\t\t\tif(header && columnDetail && columnDetail.sortable)\r\n\t\t    {\r\n\t\t\t\tvar sortAscending = true;\r\n\t\t\t\tvar isCustomSort = !this.util.isUndefined(customIsAscending);\r\n\t\t\t\tisMultiColumnSort = Boolean.parse(isMultiColumnSort);\r\n\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.SORT_CHANGING,columnDetail,{columnDetail:columnDetail});\r\n\t\t\t\tif (this.util.hasStyleClass(header,this.__CLASS_SORTING_ASC) || this.util.hasStyleClass(header,this.__CLASS_SORTING_DESC))\r\n\t\t\t\t{\r\n\t\t\t        if(this.util.hasStyleClass(header,this.__CLASS_SORTING_ASC))\r\n\t\t\t        {\r\n\t\t\t             this.__removeAscendingIndicator(header,columnDetail);\r\n\t\t\t             sortAscending = false;\r\n\t\t\t        }\r\n\t\t\t        else if(this.util.hasStyleClass(header,this.__CLASS_SORTING_DESC))\r\n\t\t\t        {\r\n\t\t\t        \tthis.__removeDescendingIndicators(header,columnDetail);\r\n\t\t\t\t       \tsortAscending = true;\r\n\t\t\t        }\r\n\t\t\t\t}\r\n\t\t\t   \telse\r\n\t\t\t   \t{\r\n\t\t\t   \t\tsortAscending = !columnDetail.sortDescending;\r\n\t\t\t   \t}\r\n\t\t\t\tif(!isMultiColumnSort)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__arrFields = [];\r\n\t\t\t\t\tthis.__resetColumnHeaders(true);\r\n\t\t\t\t}\r\n\t\t\t\tvar isColumnExisting = false;\r\n\t\t\t\tfor(var count = 0;count < this.__arrFields.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__arrFields[count][\"field\"] === columnDetail[\"sortField\"])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tisColumnExisting = true;\r\n\t\t\t\t\t\tthis.__arrFields[count][\"sortAscending\"] = sortAscending;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!isColumnExisting)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__arrFields.push({field:columnDetail.sortField,sortFunction:columnDetail.sortFunction,sortAscending:sortAscending});\r\n\t\t\t\t}\r\n\t\t\t   \t//customIsAscending is passed it overrides the setting in columnDetail\r\n\t\t\t   \tif(isCustomSort)\r\n\t\t\t   \t{\r\n\t\t\t   \t\tsortAscending = customIsAscending;\r\n\t\t\t   \t}\r\n\t\t\t   \tif(sortAscending)\r\n\t\t\t    {\r\n\t\t\t   \t\tthis.__addAscendingIndicator(header,columnDetail);\r\n\t\t\t    }\r\n\t\t\t   \telse\r\n\t\t\t   \t{\r\n\t\t\t   \t\tthis.__addDescendingIndicator(header,columnDetail);\r\n\t\t\t   \t}\r\n\t\t\t   \tif(this.__nsGrid.__enableHierarchical || this.__nsGrid.__enableGrouping || this.__nsGrid.__enableMasterDetail)\r\n\t\t\t   \t{\r\n\t\t\t   \t\t  this.__sortHierarchicalStructure(this.__nsGrid.__arrWrapper,this.__arrFields); \r\n\t\t\t   \t\t  this.__nsGrid.__objGrid.__setWrapperSource(this.__nsGrid.__arrWrapper,0,-1,0,false);\r\n\t\t\t   \t\t  this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0);\r\n\t\t\t   \t}\r\n\t\t\t   \telse\r\n\t\t\t   \t{\r\n\t\t\t   \t\t  this.__sortArrOfObjectsByParam(this.__nsGrid.__arrWrapper,this.__arrFields);\r\n\t\t\t   \t\t  this.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\t   \t}\r\n\t\t\t   \t//to stop error of horizontal scrollbar position getting reset when sorting\r\n\t\t\t   \tvar horScrollPos = 0;\r\n\t\t\t   \tif(this.__nsGrid.__divCenterTableBodyContainer)\r\n\t\t\t   \t{\r\n\t\t\t\t\thorScrollPos = this.__nsGrid.__divCenterTableBodyContainer.scrollLeft;\r\n\t\t\t   \t}\r\n\t\t\t   \tthis.__nsGrid.resetFilters();\r\n\t\t\t   \tthis.__nsGrid.__renderBody(true,false);\r\n\t\t\t   \tcolumnDetail[this.__nsGrid.__fieldColSortedAsc] = sortAscending;\r\n\t\t\t   \tif(this.__nsGrid.__divCenterTableBodyContainer && horScrollPos > 0)\r\n\t\t\t   \t{\r\n\t\t\t   \t\tthis.__nsGrid.__divCenterTableBodyContainer.scrollLeft = horScrollPos;\r\n\t\t\t   \t}\r\n\t\t\t   \tthis.__nsGrid.__dispatchEvent(NSGrid.SORT_CHANGED,this.__arrFields,{fieldDetails:this.__arrFields});\r\n\t\t    }\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"This column is not sortable.\");\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__sortHierarchicalStructure= function(dataSource,arrFields)\r\n\t\t{\r\n\t\t\tif(dataSource && dataSource.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = dataSource[count];\r\n\t\t\t\t\tif(this.__nsGrid.__isNodeLastParent(item))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__sortArrOfObjectsByParam(item[this.__nsGrid.__childField],arrFields);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(item[this.__nsGrid.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__sortHierarchicalStructure(item[this.__nsGrid.__childField],arrFields);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\t//This method is based on Stuart Langridge's \"sorttable\" code\r\n\t\tthis.__determineSortFunction= function(item,colItem)\r\n\t\t{\r\n\t\t\t  var sortType = colItem.sortType;\r\n\t\t\t  var sortFunction = \"__sortCaseInsensitive\";\r\n\t\t\t  if(sortType == null)\r\n\t\t\t  {\r\n\t\t\t\t  var value = item.toString();\r\n\t\t\t      if(this.__isDate(item) || value.match(/^\\d\\d[\\/-]\\d\\d[\\/-]\\d\\d\\d\\d$/) || value.match(/^\\d\\d[\\/-]\\d\\d[\\/-]\\d\\d$/))\r\n\t\t\t      {\r\n\t\t\t          sortFunction = \"__sortDate\";\r\n\t\t\t      }\r\n\t\t\t      if (value.match(/^[$]/))\r\n\t\t\t      {\r\n\t\t\t          sortFunction = \"__sortCurrency\";\r\n\t\t\t      }\r\n\t\t\t      if (value.match(/^[\\d\\.]+$/) || value.match(/^[+-]?\\d*\\.?\\d+([eE]-?\\d+)?$/) || !isNaN(value))\r\n\t\t\t      {\r\n\t\t\t          sortFunction = \"__sortNumeric\";\r\n\t\t\t      }\r\n\t\t\t  }\r\n\t\t\t  else\r\n\t\t\t  {\r\n\t\t\t\t  var objVal = {\"date\": {func: \"__sortDate\"},\"currency\": {func: \"__sortCurrency\"},\"number\": {func: \"__sortNumeric\"},\"string\": {func: \"__sortCaseInsensitive\"}};\r\n\t\t\t\t  if(objVal[sortType.toLowerCase()])\r\n\t\t\t\t  {\r\n\t\t\t\t\t  sortFunction = objVal[sortType.toLowerCase()].func;\r\n\t\t\t\t  }\r\n\t\t\t  }\r\n\t\t      return sortFunction;\r\n\t\t};\r\n\t\r\n\t\tthis.__sortArrOfObjectsByParam= function(arrToSort,arrFields)\r\n\t\t{\r\n\t\t    arrToSort.sort(function (item1, item2)\r\n\t\t    {\r\n\t\t        var retValue = 0;\r\n\t\t        var objField = null;\r\n\t\t        for (var count = 0; count < arrFields.length; count++) \r\n\t\t        {\r\n\t\t        \tobjField = arrFields[count];\r\n\t\t        \tif(objField[\"sortAscending\"] == null || objField[\"sortAscending\"] == undefined)\r\n\t\t     \t    {\r\n\t\t        \t\tobjField[\"sortAscending\"] = true;  // default to true\r\n\t\t     \t    }\r\n\t\t        \tif (typeof this[objField[\"sortFunction\"]] === \"function\")\r\n\t\t\t        {\r\n\t\t        \t\tretValue = this[objField[\"sortFunction\"]](item1,item2,objField[\"field\"],objField[\"sortAscending\"]);\r\n\t\t\t        }\r\n\t\t        \tif (retValue !== 0) \r\n\t\t        \t{\r\n\t\t        \t\tbreak;\r\n\t\t        \t}\r\n\t\t        }\r\n\t\t        return retValue;\r\n\t\t    }.bind(this));\r\n\t\t};\r\n\t\t\r\n\t\tthis.__sortCaseInsensitive= function(item1, item2 , sortField, sortAscending)\r\n\t\t{\r\n\t\t\tif(!item1[sortField] && !item2[sortField])\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\tvar retValue = -1;\r\n\t\t\tif(!item1[sortField])\r\n\t\t\t{\r\n\t\t\t\tretValue = -1;\r\n\t\t\t}\r\n\t\t\telse if(!item2[sortField])\r\n\t\t\t{\r\n\t\t\t\tretValue = 1;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar firstString = item1[sortField].toLowerCase();\r\n\t\t\t    var secondString = item2[sortField].toLowerCase();\r\n\t\t\t      \r\n\t\t\t    if(firstString == secondString)\r\n\t\t\t    {\r\n\t\t\t    \treturn 0;\r\n\t\t\t    }\r\n\t\t\t    if (firstString < secondString)\r\n\t\t\t    {\r\n\t\t\t        retValue = -1;\r\n\t\t\t    }\r\n\t\t\t    else\r\n\t\t\t    {\r\n\t\t\t        retValue = 1;\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\t\r\n\t\t    if(sortAscending)\r\n\t\t    {\r\n\t\t        return retValue; \r\n\t\t    }\r\n\t\t    return (retValue * -1);\r\n\t\t};\r\n\t\t \r\n\t\tthis.__sortDate= function(item1, item2 , sortField, sortAscending)\r\n\t\t{\r\n\t\t      // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX\r\n\t\t      var firstDateString = item1[sortField];\r\n\t\t      var secondDateString = item2[sortField];\r\n\t\t      var firstDate, secondDate, year = -1;\r\n\t\t      if(this.util.isUndefinedOrNull(firstDateString) || this.util.isUndefinedOrNull(secondDateString))\r\n\t\t      {\r\n\t\t    \t  var retValue = -1;\r\n\t\t    \t  if(this.util.isUndefinedOrNull(firstDateString) && this.util.isUndefinedOrNull(secondDateString))\r\n\t\t\t      {\r\n\t\t\t    \t  retValue = 0;\r\n\t\t\t      }\r\n\t\t    \t  if(this.util.isUndefinedOrNull(firstDateString))\r\n\t\t    \t  {\r\n\t\t    \t\t  retValue = -1;\r\n\t\t\t\t  }\r\n\t\t\t\t  else if(this.util.isUndefinedOrNull(secondDateString))\r\n\t\t\t\t  {\r\n\t\t\t\t\t  retValue = 1;\r\n\t\t\t\t  }\r\n\t\t    \t  if(sortAscending)\r\n\t\t\t\t  {\r\n\t\t    \t\t  return retValue; \r\n\t\t\t\t  }\r\n\t\t\t\t  return (retValue * -1);\r\n\t\t      }\r\n\t\t      if(this.__isDate(firstDateString) && this.__isDate(secondDateString))\r\n\t\t      {\r\n\t\t    \t  firstDate = this.__convertToDate(firstDateString);\r\n\t\t    \t  secondDate = this.__convertToDate(secondDateString);\r\n\t\t    \t  if(sortAscending)\r\n\t\t    \t  {\r\n\t\t    \t\t  if (firstDate > secondDate) \r\n\t\t    \t\t  {\r\n\t\t    \t\t\t  return 1;\r\n\t\t    \t\t  }\r\n\t\t    \t\t  if (firstDate < secondDate)\r\n\t\t    \t\t  {\r\n\t\t    \t\t\t  return -1;\r\n\t\t    \t\t  }\r\n\t\t    \t\t  return 0;\r\n\t\t    \t  }\r\n\t\t    \t  else\r\n\t\t    \t  {\r\n\t\t    \t\t  if (firstDate > secondDate) \r\n\t\t    \t\t  {\r\n\t\t    \t\t\t  return -1;\r\n\t\t    \t\t  }\r\n\t\t    \t\t  if (firstDate < secondDate)\r\n\t\t    \t\t  {\r\n\t\t    \t\t\t  return 1;\r\n\t\t    \t\t  }\r\n\t\t    \t\t  return 0;\r\n\t\t    \t  }\r\n\t\t      }\r\n\t\t     \r\n\t\t      if (firstDateString.length == 10)\r\n\t\t      {\r\n\t\t           firstDate = firstDateString.substr(6,4) + firstDateString.substr(3,2) + firstDateString.substr(0,2);\r\n\t\t      }\r\n\t\t      else\r\n\t\t      {\r\n\t\t           year = firstDateString.substr(6,2);\r\n\t\t           if (parseInt(year) < 50)\r\n\t\t           {\r\n\t\t                year = \"20\" + year;\r\n\t\t           }\r\n\t\t           else\r\n\t\t           {\r\n\t\t                year = \"19\" + year;\r\n\t\t           }\r\n\t\t           firstDate = year + firstDateString.substr(3,2) + firstDateString.substr(0,2);\r\n\t\t      }\r\n\t\t     \r\n\t\t      if (secondDateString.length == 10)\r\n\t\t      {\r\n\t\t           secondDate = secondDateString.substr(6,4)+secondDateString.substr(3,2)+secondDateString.substr(0,2);\r\n\t\t      }\r\n\t\t      else\r\n\t\t      {\r\n\t\t           year = secondDateString.substr(6,2);\r\n\t\t           if (parseInt(year) < 50)\r\n\t\t           {\r\n\t\t                year = \"20\" + year;\r\n\t\t           }\r\n\t\t           else\r\n\t\t           {\r\n\t\t                year = \"19\" + year;\r\n\t\t           }\r\n\t\t           secondDate = year + secondDateString.substr(3,2) + secondDateString.substr(0,2);\r\n\t\t      }\r\n\t\t     \r\n\t\t      if (firstDate == secondDate)\r\n\t\t      {\r\n\t\t          return 0;\r\n\t\t      }\r\n\t\t      var retValue = -1;\r\n\t\t      if (firstDate < secondDate)\r\n\t\t      {\r\n\t\t          retValue = -1;\r\n\t\t      }\r\n\t\t      else\r\n\t\t      {\r\n\t\t          retValue = 1;\r\n\t\t      }\r\n\t\t      if(sortAscending)\r\n\t\t      {\r\n\t\t          return retValue; \r\n\t\t      }\r\n\t\t      return (retValue * -1);\r\n\t\t};\r\n\t\r\n\t\tthis.__sortCurrency= function(item1, item2 , sortField, sortAscending)\r\n\t\t{\r\n\t\t      var firstCurrency = item1[sortField].replace(/[^0-9.]/g,\"\");\r\n\t\t      var secondCurrency = item2[sortField].replace(/[^0-9.]/g,\"\");\r\n\t\t      if(sortAscending)\r\n\t\t      {\r\n\t\t          return parseFloat(firstCurrency) - parseFloat(secondCurrency); \r\n\t\t      }\r\n\t\t      return parseFloat(secondCurrency) - parseFloat(firstCurrency);\r\n\t\t};\r\n\t\r\n\t\tthis.__sortNumeric= function(item1, item2 , sortField, sortAscending)\r\n\t\t{\r\n\t\t      var firstNumber = parseFloat(item1[sortField]);\r\n\t\t      if (isNaN(firstNumber))\r\n\t\t      {\r\n\t\t          firstNumber = 0;\r\n\t\t      }\r\n\t\t      var secondNumber = parseFloat(item2[sortField]);\r\n\t\t      if (isNaN(secondNumber))\r\n\t\t      {\r\n\t\t          secondNumber = 0;\r\n\t\t      }\r\n\t\t      if(sortAscending)\r\n\t\t      {\r\n\t\t          return (firstNumber - secondNumber);\r\n\t\t      }\r\n\t\t      return (secondNumber - firstNumber);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isDate = function(value) \r\n\t\t{\r\n\t\t\tif (Object.prototype.toString.call(value) === '[object Date]') \r\n\t\t\t{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tif (typeof value.replace === 'function') \r\n\t\t\t{\r\n\t\t\t    value.replace(/^\\s+|\\s+$/gm, '');\r\n\t\t\t}\r\n\t\t\tvar dateFormat = /(^\\d{1,4}[\\.|\\\\/|-]\\d{1,2}[\\.|\\\\/|-]\\d{1,4})(\\s*(?:0?[1-9]:[0-5]|1(?=[012])\\d:[0-5])\\d\\s*[ap]m)?$/;\r\n\t\t\tvar retValue = dateFormat.test(value);\r\n\t\t\tif(!retValue)\r\n\t\t\t{\r\n\t\t\t\tvalue = this.__formatDateString(value);\r\n\t\t\t\tvar parsedDate = Date.parse(value);\r\n\t\t\t\tif (isNaN(value) && !isNaN(parsedDate)) \r\n\t\t\t\t{\r\n\t\t\t\t\tretValue = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__convertToDate = function(value) \r\n\t\t{\r\n\t\t\tvar retValue = null;\r\n\t\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t    {\r\n\t\t\t\tvalue = this.__formatDateString(value);\r\n\t\t\t\tretValue = new Date(value);\r\n\t\t    }\r\n\t\t    return retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__formatDateString = function(value)\r\n\t\t{\r\n\t\t\tif(this.util.isString(value))\r\n\t\t    {\r\n\t\t\t\t//For conditions where date comes like (from sqlserver convert(varchar,date,100)) \"May 16 2016  2:25PM\" \r\n\t\t\t\t//then new Date returns nan.It should be like \"May 16 2016  2:25 PM\"\r\n\t\t\t\tvar ampm = null;\r\n\t\t\t\tampm = ((value.indexOf(\"AM\") > -1) ? \"AM\" : ((value.indexOf(\"PM\") > -1) ? \"PM\" : null));\r\n\t\t\t\tif(ampm)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar index = value.indexOf(ampm);\r\n\t\t\t\t\tif(value.charAt(index-1) != \" \")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvalue = value.substring(0,index) + \" \" + ampm;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t\treturn value;\r\n\t\t};\r\n\t\t/******************************Create Sort Components*******************************/\r\n\t\tthis.__addAscendingIndicator = function(target,columnDetail)\r\n\t\t{\r\n\t\t     if(target)\r\n\t\t     {\r\n\t\t    \t this.__setSortIcons(target,true,false,columnDetail);\r\n\t\t         this.util.addStyleClass(target,this.__CLASS_SORTING_ASC);\r\n\t\t     }\r\n\t\t};\r\n\t\r\n\t\tthis.__removeAscendingIndicator= function(target,columnDetail)\r\n\t\t{\r\n\t\t     if(target)\r\n\t\t     {\r\n\t\t          this.util.removeStyleClass(target,this.__CLASS_SORTING_ASC);\r\n\t\t          this.__setSortIcons(target,false,false,columnDetail);\r\n\t\t     }\r\n\t\t};\r\n\t\r\n\t\tthis.__addDescendingIndicator= function(target,columnDetail)\r\n\t\t{\r\n\t\t    if(target)\r\n\t\t    {\r\n\t\t    \tthis.__setSortIcons(target,false,true,columnDetail);\r\n\t\t        this.util.addStyleClass(target,this.__CLASS_SORTING_DESC);\r\n\t\t    }\r\n\t\t};\r\n\t\r\n\t\tthis.__removeDescendingIndicators= function(target,columnDetail)\r\n\t\t{\r\n\t\t     if(target)\r\n\t\t     {\r\n\t\t    \t this.util.removeStyleClass(target,this.__CLASS_SORTING_DESC);\r\n\t\t    \t this.__setSortIcons(target,false,false,columnDetail);\r\n\t\t     }\r\n\t\t};\r\n\t\r\n\t\tthis.__resetIndicators= function(target,columnDetail)\r\n\t\t{\r\n\t\t     if(target)\r\n\t\t     {\r\n\t\t          this.__removeAscendingIndicator(target,columnDetail);\r\n\t\t          this.__removeDescendingIndicators(target,columnDetail);\r\n\t\t          this.__setSortIcons(target,true,true,columnDetail);\r\n\t\t     }\r\n\t\t};\r\n\t\r\n\t\tthis.__resetColumnHeaders= function(isInternal)\r\n\t\t{\r\n\t\t     var headerBodyRow = this.__nsGrid.__getHeaderBodyRow(this.__nsGrid.__tblCenterHeader);\r\n\t\t     if (!headerBodyRow)\r\n\t\t     {\r\n\t\t          return;\r\n\t\t     }\r\n\t\t     var headers = headerBodyRow.cells;\r\n\t\t     for (var colCount = 0; colCount < headers.length; colCount++)\r\n\t\t     {\r\n\t\t          this.__resetIndicators(headers[colCount]);\r\n\t\t     }\r\n\t\t     if(isInternal)\r\n\t\t     {\r\n\t\t    \t for (var colCount = 0; colCount < this.__nsGrid.__columns.length; colCount++)\r\n\t\t\t     {\r\n\t\t\t    \t this.__nsGrid.__columns[colCount][this.__nsGrid.__fieldColSortedAsc] = null;\r\n\t\t\t     }\r\n\t\t     }\r\n\t\t};\r\n\t\r\n\t\tthis.__setSortIcons= function(target,isAscVisible,isDescVisible,columnDetail)\r\n\t\t{\r\n\t\t\tif(target)\r\n\t\t\t{\r\n\t\t\t\tif(!columnDetail)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar columnIndex = parseInt(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t\t\t\tcolumnDetail = this.__nsGrid.__getColumnObject(columnIndex);\r\n\t\t\t\t}\r\n\t\t\t\tif(columnDetail && this.__nsGrid.__isSortingIconCustom(columnDetail))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divSorting = target.querySelector(\".nsGridSortContainer\");\r\n\t\t\t\t\tif(divSorting)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdivSorting.innerHTML = \"\";\r\n\t\t\t\t\t\tif(isAscVisible)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdivSorting.innerHTML += this.__nsGrid.__getColumnCustomIcon(columnDetail,\"sortAscending\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(isDescVisible)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdivSorting.innerHTML += this.__nsGrid.__getColumnCustomIcon(columnDetail,\"sortDescending\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(isAscVisible != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t var divSortAsc = document.getElementById(target.getAttribute(\"id\") + \"SortAsc\");\r\n\t\t\t\t\t\t if(divSortAsc)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t divSortAsc.style.display = isAscVisible ? \"\" : \"none\";\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(isDescVisible != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t var divSortDesc = document.getElementById(target.getAttribute(\"id\") + \"SortDesc\");\r\n\t\t\t\t\t\t if(divSortDesc)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t divSortDesc.style.display = isDescVisible ? \"\" : \"none\";\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t/******************************End of Create Sort Components*******************************/\r\n\t};\r\n\treturn NSGridSort;\r\n})();\r\nnsModuleExport(this,\"NSGridSort\",NSGridSort);\r\n\r\nvar NSGridColumnResize = (function()\r\n{\r\n\tvar NSGridColumnResize = function(nsGrid)\r\n\t{\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = this.__nsGrid.util;\r\n\t\t\r\n\t\t//cell which is being resized\r\n\t\tthis.__resizingHeader = null;\r\n\t\tthis.__resizingHeaderCell = null;\r\n\t\tthis.__resizingBodyCell = null;\r\n\t\tthis.__resizeHandler = null;\r\n\t\tthis.__resizeIndicatorMouseDownInterval = -1;\r\n\t\tthis.__resizeIndicatorMouseDownCount = 0;\r\n\t\t\r\n\t\tthis.__doResizeRef = null;\r\n\t\tthis.__endResizeRef = null;\r\n\t\t\r\n\t\tthis.autoResize = function(index)\r\n\t\t{\r\n\t\t\tif(index > -1)\r\n\t\t\t{\r\n\t\t\t\tvar objColumn = this.__nsGrid.__getColumnObject(index);\r\n\t\t\t\tif(objColumn)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objColumn[\"autoSize\"]) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar preferredWidth = this.__getPreferredWidthForColumn(objColumn);\r\n\t\t\t\t\t\tif(preferredWidth > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar cellIndex = objColumn[this.__nsGrid.__fieldColIndex];\r\n\t\t\t\t\t\t\tvar resizingHeaderCell = this.__getHeaderTopCell(null,cellIndex);\r\n\t\t\t\t\t\t\tvar resizingBodyCell = this.__getBodyTopCell(null,cellIndex);\r\n\t\t\t\t\t\t\tthis.__resize(this.__nsGrid.__tblCenterHeader,resizingHeaderCell,preferredWidth,objColumn);\r\n\t\t\t\t\t\t\tthis.__resize(this.__nsGrid.__tblCenterBody,resizingBodyCell,preferredWidth,objColumn);\r\n\t\t\t\t\t\t\tthis.__handleColumnResize();\r\n\t\t\t\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.COLUMN_RESIZED,objColumn,objColumn);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.util.warning(\"NSGrid\",\"This column with dataField \" + objColumn.dataField + \" is not autosizable.\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tthis.util.warning(\"NSGrid\",\"This column details was not found.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.addResizeIndicator = function(row,cell,divCellContainer,objColumn,colID)\r\n\t\t{\r\n\t\t\t if(objColumn[\"resizable\"])\r\n\t\t\t {\r\n\t\t\t\tvar divResize = this.util.createDiv(null,\"nsColumnResizeIndicator\");\r\n\t\t\t\tthis.util.addStyleClass(divResize,\"nsColumnResizeIndicatorTheme\");\r\n\t\t\t\tdivResize.title = \"Drag to resize the column \" + objColumn.headerText;\r\n\t\t\t\t//divResize.style.height = this.__nsGrid.__getViewportHeight() + \"px\";\r\n\t\t\t\t//divResize.style.borderRight = '2px solid #0000ff';\r\n\t\t\t\tvar resizeEventHandler = this.__resizeEventHandler.bind(this);\r\n\t\t\t\t//this.util.addEvent(divResize,\"mouseover\",resizeEventHandler);\r\n\t\t\t\t//this.util.addEvent(divResize,\"mouseout\",resizeEventHandler);\r\n\t\t\t\tthis.util.addEvent(divResize,\"mousedown\",resizeEventHandler);\r\n\t\t\t\tthis.util.addEvent(divResize,\"click\",resizeEventHandler);\r\n\t\t\t\tthis.util.addEvent(divResize,\"dblclick\",resizeEventHandler);\r\n\t\t\t\tdivCellContainer.appendChild(divResize);\r\n\t\t\t\tthis.__nsGrid.__addTouchEvent(divResize);\r\n\t\t\t }\r\n\t\t};\r\n\t\t\r\n\t\tthis.startResize = function(event,target)\r\n\t\t{\r\n\t\t\t/*if(!this.__nsGrid.__onGridLine)\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}*/\r\n\t\t\tthis.__nsGrid.__isColumnResizing = true;\r\n\t\t\tthis.util.removeEvent(target,\"click\",this.__nsGrid.__headerClickRef);\r\n\t\t\tthis.__nsGrid.__headerClickRef = null;\r\n\t\t    this.util.removeEvent(target,\"mouseover\",this.__nsGrid.__headerMouseOverRef);\r\n\t\t    this.__nsGrid.__headerMouseOverRef = null;\r\n\t\t    this.util.removeEvent(target,\"mouseout\",this.__nsGrid.__headerMouseOutRef);\r\n\t\t    this.__nsGrid.__headerMouseOutRef = null;\r\n\t\t    this.__nsGrid.__removeTouchEvent(target);\r\n\t\t\t\r\n\t\t\tthis.__resizingHeader = target;\r\n\t\t\tthis.__resizingHeaderCell = this.__getHeaderTopCell(target);\r\n\t\t\tthis.__resizingBodyCell = this.__getBodyTopCell(target);\r\n\t\t\tvar objColumn = this.__nsGrid.__getColumnObject(this.__resizingHeader.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.COLUMN_RESIZING,objColumn,objColumn);\r\n\t\t\tthis.__createResizeHandler(event);\r\n\t\t\t\r\n\t\t\tthis.__doResizeRef = this.__doResize.bind(this);\r\n\t\t\tthis.__endResizeRef = this.__endResize.bind(this);\r\n\t\t\tthis.util.addEvent(document,\"mousemove\",this.__doResizeRef);\r\n\t\t\tthis.util.addEvent(document,\"mouseup\",this.__endResizeRef);\r\n\t\t\t\r\n\t\t\tevent.stopImmediatePropagation();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__resize = function(table,cell,desirableWidth,objColumn)\r\n\t\t{\r\n\t\t\tvar cellPaddingLeft = this.util.getDimensionAsNumber(cell,cell.style.paddingLeft);\r\n\t\t\tvar cellPaddingRight = this.util.getDimensionAsNumber(cell,cell.style.paddingRight);\r\n\t\t\tvar pad = parseInt(cellPaddingLeft,10) + parseInt(cellPaddingRight,10);\r\n\t\t\tif(!objColumn && this.__resizingHeader)\r\n\t\t\t{\r\n\t\t\t\tobjColumn = this.__nsGrid.__getColumnObject(this.__resizingHeader.getAttribute(\"currentColumnIndex\"));\r\n\t\t\t}\r\n\t\t\tvar minWidth = this.__nsGrid.__columnMinWidth;\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tminWidth = objColumn[\"minWidth\"];\r\n\t\t\t}\r\n\t\t\tvar setWidth = Math.max((desirableWidth - pad), minWidth);\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"width\"] = setWidth + \"px\";\r\n\t\t\t}\r\n\t\t\tcell.style.width = setWidth + \"px\";\r\n\t\t};\r\n\t\r\n\t\tthis.__doResize = function(event)\r\n\t\t{\r\n\t\t\t//putting this check as somehow the document evenlistener is not getting detached\r\n\t\t\tif(!this.__resizingHeader)\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tthis.util.makeBodyUnselectable();\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tthis.__resizeHandler.style.left = this.__getResizeLeftPos(event) + \"px\";\r\n\t\t\t\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\r\n\t\tthis.__endResize = function(event)\r\n\t\t{\r\n\t\t\t//putting this check as somehow the document evenlistener is not getting detached\r\n\t\t\tif(!this.__resizingHeader)\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tthis.util.removeEvent(document,\"mousemove\",this.__doResizeRef);\r\n\t\t\tthis.__doResizeRef = null;\r\n\t\t\tthis.util.removeEvent(document,\"mouseup\",this.__endResizeRef);\r\n\t\t\tthis.__endResizeRef = null;\r\n\t\t\tthis.util.removeEvent(selectedHeader,\"mouseout\",this.__nsGrid.__headerMouseOutRef);\r\n\t\t\tthis.__nsGrid.__headerMouseOutRef = null;\r\n\t\t\tthis.util.removeEvent(selectedHeader,\"click\",this.__nsGrid.__headerClickRef);\r\n\t\t\tthis.__nsGrid.__headerClickRef = null;\r\n\t\t\tthis.__nsGrid.__removeTouchEvent(selectedHeader);\r\n\t\t\tthis.util.makeBodySelectable();\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar selectedHeader = this.__resizingHeader;\r\n\t\t\tvar tableHeader = this.__nsGrid.__tblCenterHeader;\r\n\t\t\tvar tableBody = this.__nsGrid.__tblCenterBody;\r\n\t\t\tvar posEvent = this.util.getEventPosition(event,this.__nsGrid.__divCenterTableBodyContainer);\r\n\t\t\tvar desiredWidth = posEvent.left - this.util.getCumulativeOffset(selectedHeader).x;\r\n\t\t\tthis.__resize(tableHeader,this.__resizingHeaderCell,desiredWidth);\r\n\t\t\tthis.__resize(tableBody,this.__resizingBodyCell,desiredWidth);\r\n\t\t\tif(this.__resizeHandler)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__divOuterContainer.removeChild(this.__resizeHandler);\r\n\t\t\t}\r\n\t\t\tvar column = this.__resizingHeader;\r\n\t\t\tthis.__resizingHeader = null;\r\n\t\t\tthis.__resizingHeaderCell = null;\r\n\t\t\tthis.__resizingBodyCell = null;\r\n\t\t\tthis.__resizeHandler = null;\r\n\t\t\tevent.stopImmediatePropagation();\r\n\t\t\tthis.__handleColumnResize();\r\n\t\t\tvar objColumn = this.__nsGrid.__getColumnObject(column.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.COLUMN_RESIZED,objColumn,objColumn);\r\n\t\t\tthis.__nsGrid.__isColumnResizing = false;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__resizeEventHandler = function(event)\r\n\t\t{\r\n\t\t\tvar stopEventPropogation = function()\r\n\t\t\t{\r\n\t\t\t\tevent.stopPropagation();\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t\tevent.stopImmediatePropagation();\r\n\t\t\t};\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\tvar resizeIndicator = target;\r\n\t\t    target = this.util.findParent(target,\"TD\");\r\n\t\t    var colIndex = parseInt(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t    //var objColumn = this.__nsGrid.__getColumnObject(colIndex);\r\n\t\t\tswitch(event.type)\r\n\t\t\t{\r\n\t\t\t\t/*case \"mouseover\":\r\n\t\t\t\t\tif(this.util.hasStyleClass(resizeIndicator,\"nsColumnResizeIndicator\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar height = this.__nsGrid.__getViewportHeight();\r\n\t\t\t\t\t\tif(height != resizeIndicator.offsetHeight)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tresizeIndicator.style.height = height + \"px\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tresizeIndicator.style.borderRight = '2px solid #0000ff';\r\n\t\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"mouseout\":\r\n\t\t\t\t\tif(this.util.hasStyleClass(resizeIndicator,\"nsColumnResizeIndicator\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tresizeIndicator.style.borderRight = '';\r\n\t\t\t\t\t}\r\n\t\t\t\tbreak;*/\r\n\t\t\t\tcase \"mousedown\":\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tthis.__resizeIndicatorMouseDownCount++;\r\n\t\t\t\t\tif (this.__resizeIndicatorMouseDownInterval != -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tclearTimeout(this.__resizeIndicatorMouseDownInterval);\r\n\t\t\t\t\t\tthis.__resizeIndicatorMouseDownInterval = -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__resizeIndicatorMouseDownInterval = setTimeout(\r\n\t\t\t\t\t\tfunction()\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(self.__resizeIndicatorMouseDownCount > 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tself.autoResize(colIndex);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tself.startResize(event,target);\r\n\t\t\t\t\t\t\t\t/*var headerRect = headerCell.getBoundingClientRect();\r\n\t\t\t\t\t\t\t\tvar headerHeight = headerCell.offsetHeight;\r\n\t\t\t\t\t\t\t\tvar startOffset = headerRect.left - 6;\r\n\t\t\t\t\t\t\t    var startWidth = parseInt(headerRect.width, 10);\r\n\t\t\t\t\t\t\t    this.__resizeIndicatorHandler.style.top = headerRect.top + \"px\";\r\n\t\t\t\t\t\t\t    this.__resizeIndicatorHandler.style.left = (startOffset + startWidth) + \"px\";\r\n\t\t\t\t\t\t\t    this.__resizeIndicatorHandler.style.height = headerHeight + \"px\";\r\n\t\t\t\t\t\t\t\tthis.__lastHeaderCell = headerCell;*/\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tself.__resizeIndicatorMouseDownCount = 0;\r\n\t\t\t\t\t\t},500);\r\n\t\t\t\t\tstopEventPropogation();\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"mouseleave\":\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"click\":\r\n\t\t\t\t\tstopEventPropogation();\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"dblclick\":\r\n\t\t\t\t\tstopEventPropogation();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createResizeHandler = function(event)\r\n\t\t{\r\n\t\t\tthis.__resizeHandler = this.util.createDiv(null,\"nsResizeHandle\");\r\n\t\t\tthis.util.addStyleClass(this.__resizeHandler,\"nsResizeHandle\" + this.__nsGrid.__theme);\r\n\t\t\tthis.__resizeHandler.style.top = this.util.getCumulativeOffset(this.__resizingHeader,this.__nsGrid.__divTableWrapper).y + \"px\";\r\n\t\t\tthis.__resizeHandler.style.left = this.__getResizeLeftPos(event) + \"px\";\r\n\t\t\tvar scrollBarWidth = this.util.getScrollBarWidth(this.__nsGrid.__divCenterTableBodyContainer);\r\n\t\t\tthis.__resizeHandler.style.height = (this.__nsGrid.__divCenterTableHeaderContainer.offsetHeight + this.__nsGrid.__divCenterTableBodyContainer.offsetHeight - scrollBarWidth) + \"px\";\r\n\t\t\tvar maxZIndex = this.util.getMaxZIndex(this.__resizingHeader); \r\n\t\t\tif(maxZIndex > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__resizeHandler.style.zIndex = maxZIndex + 1;\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__divOuterContainer.appendChild(this.__resizeHandler);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getResizeLeftPos = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar left = 0;\r\n\t\t\tvar scrollContainer = this.__nsGrid.__getHorizontalScrollableContainer();\r\n\t\t\tvar hasHorizontalScrollbar = scrollContainer.scrollWidth > scrollContainer.clientWidth;\r\n\t\t\tif(hasHorizontalScrollbar)\r\n\t\t\t{\r\n\t\t\t\tvar containerLeft = this.util.getOffSetByRect(this.__nsGrid.__divOuterContainer).left;\r\n\t\t\t    left = (event.pageX - containerLeft + scrollContainer.scrollLeft);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar posEvent = this.util.getEventPosition(event);\r\n\t\t\t\tleft = posEvent.left;\r\n\t\t\t}\r\n\t\t    return left;\r\n\t\t};\r\n\t\r\n\t\tthis.__getHeaderTopCell = function(cell,cellIndex)\r\n\t\t{\r\n\t\t\tif(cell || !this.util.isUndefinedOrNull(cellIndex))\r\n\t\t\t{\r\n\t\t\t\tvar index = cell ? cell.cellIndex : cellIndex;\r\n\t\t\t\tvar headerRow = this.__nsGrid.__getHeaderHeaderRow(this.__nsGrid.__tblCenterHeader);\r\n\t\t\t\tif(headerRow && headerRow.cells.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerCells = headerRow.cells;\r\n\t\t\t\t\treturn headerCells[index];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\r\n\t\tthis.__getBodyTopCell = function(cell,cellIndex)\r\n\t\t{\r\n\t\t\tif(cell || !this.util.isUndefinedOrNull(cellIndex))\r\n\t\t\t{\r\n\t\t\t\tvar index = cell ? cell.cellIndex : cellIndex;\r\n\t\t\t\tvar bodyRow = this.__nsGrid.__getBodyHeaderRow(this.__nsGrid.__tblCenterBody);\r\n\t\t\t\tif(bodyRow && bodyRow.cells.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar bodyCells = bodyRow.cells;\r\n\t\t\t\t\treturn bodyCells[index];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleColumnResize = function()\r\n\t\t{\r\n\t\t\tthis.__nsGrid.__alignTables(false);\r\n\t\t\tif(this.__nsGrid.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\t//this.__nsGrid.__setVirtualVariables(false,false,false,false);\r\n\t\t\t}\r\n\t\t\t//this.__nsGrid.__setFixedCellsPosition();\r\n\t\t\tthis.__nsGrid.__addStyleForFixedColumns();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getPreferredWidthForColumn = function(objColumn)\r\n\t\t{\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar addRows = function(sourceTable)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrRows = sourceTable.tBodies[0].rows;\r\n\t\t\t\t\tfor(var count = 0;count < arrRows.length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar sourceRow = arrRows[count];\r\n\t\t\t\t\t\t//Ignore Filter Row\r\n\t\t\t\t\t\tif(sourceRow && !self.util.hasStyleClass(sourceRow,\"nsGridFilterRow\") && sourceRow.cells && sourceRow.cells.length)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar row = document.createElement(\"TR\");\r\n\t\t\t\t\t\t\tvar cell = row.insertCell(-1);\r\n\t\t\t\t\t\t\tcell.innerHTML = sourceRow.cells[objColumn[self.__nsGrid.__fieldColIndex]].innerHTML;\r\n\t\t\t\t\t\t\tcell.style.whiteSpace = \"nowrap\";\r\n\t\t\t\t\t\t\tcell.style.width = \"\";\r\n\t\t\t\t\t\t\tvar arrChildren = cell.querySelectorAll(\".nsTruncateToFit\");\r\n\t\t\t\t\t\t\tfor(var childCount = 0;childCount < arrChildren.length;childCount++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar child = arrChildren[childCount];\r\n\t\t\t\t\t\t\t\tself.util.removeStyleClass(child,\"nsTruncateToFit\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbody.appendChild(row);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tvar dummyTable = this.__nsGrid.__tblCenterBody.cloneNode(false);\r\n\t\t\t\tdummyTable.setAttribute(\"id\",\"nsDummyTable\");\r\n\t\t\t\tdummyTable.style.width = \"auto\";\r\n\t\t\t\tvar body = document.createElement(\"tbody\");\r\n\t\t\t\tdummyTable.appendChild(body);\r\n\t\t\t\taddRows(this.__nsGrid.__tblCenterHeader);\r\n\t\t\t\taddRows(this.__nsGrid.__tblCenterBody);\r\n\t\t\t\t//this.__nsGrid.__divCenterTableBodyContainer.appendChild(dummyTable);\r\n\t\t\t\tdocument.body.appendChild(dummyTable);\r\n\t\t\t\tvar preferredWidth = dummyTable.getBoundingClientRect().width;\r\n\t\t\t\t//this.__nsGrid.__divCenterTableBodyContainer.removeChild(dummyTable);\r\n\t\t\t\tdocument.body.removeChild(dummyTable);\r\n\t\t\t\t//+1 so that headers doesnot wordwrap\r\n\t\t\t\treturn preferredWidth + 5;\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t};\r\n\t};\r\n\treturn NSGridColumnResize;\r\n})();\r\nnsModuleExport(this,\"NSGridColumnResize\",NSGridColumnResize);\r\n\r\nvar NSGridColumnMove = (function()\r\n{\r\n\tvar NSGridColumnMove = function(nsGrid)\r\n\t{\r\n\t\tthis.__MIN_DRAG_OFFSET = 100;\r\n\t\t\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.util = nsGrid.util;\r\n\t\t\r\n\t\tthis.__objColumnDrag = null;\r\n\t\tthis.__lastDragEvent = null;\r\n\t\tthis.__lastDragInfo = null;\r\n\t\tthis.__isColumnDragged = false;\r\n\t\tthis.__scrollLeft = false;\r\n\t    this.__scrollRight = false;\r\n\t\tthis.__dragColumnMoveRef = null;\r\n\t\tthis.__dragColumnEndRef = null;\r\n\t\tthis.__scrollInterval = null;\r\n\t\tthis.__animationSteps = null;\r\n\t\tthis.__moveAttempts = 0;\r\n\t\tthis.__scrollableContainer = null;\r\n\t\tthis.__maxZIndex = 0;\r\n\t\t\r\n\t\tthis.handle = function(event,target)\r\n\t\t{\r\n\t\t\tthis.__maxZIndex = this.util.getMaxZIndex(target);\r\n\t\t\tthis.__scrollableContainer = this.__nsGrid.__getHorizontalScrollableContainer();\r\n\t\t\tthis.__startColumnMove(event,target);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__startColumnMove = function(event,target)\r\n\t\t{\r\n\t\t\t//should be merging __onGridLine and __isColumnResizing\r\n\t\t\tif(this.__nsGrid.__isColumnResizing || this.__nsGrid.__onGridLine)\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tvar objColumn = this.__nsGrid.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tvar columnIndex = this.__nsGrid.__getColumnIndexByObject(objColumn);\r\n\t\t\tif(columnIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.COLUMN_MOVING,objColumn,{columnDetail:objColumn,columnIndex:columnIndex});\r\n\t\t\t\tthis.__lastDragEvent = event;\r\n\t\t\t\tthis.__isColumnDragged = true;\r\n\t\t\t\tthis.__objColumnDrag = {};\r\n\t\t\t\tthis.__objColumnDrag.source = target;\r\n\t\t\t\tthis.__objColumnDrag.objColumn = objColumn;\r\n\t\t\t\tthis.__objColumnDrag.columnIndex = columnIndex;\r\n\t\t\t\tvar position = this.util.getEventPosition(event,this.__nsGrid.__divCenterTableHeaderContainer);\r\n\t\t\t\tthis.__objColumnDrag.dragElement = this.__createCopyItem(target,position);\r\n\t\t\t\tthis.__objColumnDrag.dragElementAdded = false;\r\n\t\t\t\tthis.__objColumnDrag.position = position;\r\n\t\t\t\tthis.__dragColumnMoveRef = this.__dragColumnMoveHandler.bind(this);\r\n\t\t\t\tthis.__dragColumnEndRef = this.__dragColumnEndHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(document,\"mousemove\",this.__dragColumnMoveRef);\r\n\t\t\t\tthis.util.addEvent(document,\"mouseup\",this.__dragColumnEndRef);\r\n\t\t\t}\r\n\t\t\tevent.preventDefault();\r\n\t\t};\r\n\t\r\n\t\tthis.__dragColumnMoveHandler = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tvar direction = this.__getDragDirection(event);\r\n\t\t\tthis.__lastDragEvent = event;\r\n\t\t\t\r\n\t\t\tvar position = this.util.getEventPosition(event);\r\n\t\t\tvar leftOffset = this.__objColumnDrag.position.left - position.left;\r\n\t\t    var topOffset = this.__objColumnDrag.position.top - position.top;\r\n\t\t    var dragRadius = (leftOffset * leftOffset) + (topOffset * topOffset);\r\n\t\t    if(!this.__objColumnDrag.dragElementAdded && dragRadius > this.__MIN_DRAG_OFFSET)\r\n\t\t    {\r\n\t\t    \tdocument.body.appendChild(this.__objColumnDrag.dragElement);\r\n\t\t    \tthis.__objColumnDrag.dragElementAdded = true;\r\n\t\t    }\r\n\t\t    this.__positionDragElement(event);\r\n\t\t    /*var posEvent = this.util.getEventPosition(event);\r\n\t\t    this.__objColumnDrag.dragElement.style.left = posEvent.left + \"px\";\r\n\t        this.__objColumnDrag.dragElement.style.top = posEvent.top + \"px\";*/\r\n\t\t    if(this.__objColumnDrag.lastDropTarget)\r\n\t\t    {\r\n\t\t    \tthis.util.removeStyleClass(this.__objColumnDrag.lastDropTarget,\"nsDottedCell\"); \r\n\t\t    \tthis.__objColumnDrag.lastDropTarget = null;\r\n\t\t    }\r\n\t\t    var target = this.util.getTarget(event);\r\n\t\t    var element = this.util.findParentBySelector(target,\".\" + this.__nsGrid.__CLASS_TABLE_HEADER_DROPPABLE_CELL);\r\n\t\t    if(element != this.__objColumnDrag.source)\r\n\t\t    {\r\n\t\t    \tthis.util.addStyleClass(element,\"nsDottedCell\");   \r\n\t\t    \tthis.__objColumnDrag.lastDropTarget = element;\r\n\t\t    }\r\n\t\t    var objDrag = this.__getDragInfoObject(event,direction);\r\n\t\t    this.__handleScrollMovement(objDrag);\r\n\t\t    event.preventDefault();\r\n\t\t};\r\n\t\r\n\t\tthis.__dragColumnEndHandler = function(event)\r\n\t\t{\r\n\t\t\tthis.__lastDragEvent = null;\r\n\t\t\tthis.__isColumnDragged = false;\r\n\t\t\tthis.__stopScrollAnimation();\r\n\t\t\tif(this.__objColumnDrag.lastDropTarget)\r\n\t\t    {\r\n\t\t    \tthis.util.removeStyleClass(this.__objColumnDrag.lastDropTarget,\"nsDottedCell\"); \r\n\t\t    \tthis.__objColumnDrag.lastDropTarget = null;\r\n\t\t    }\r\n\t\t\tthis.util.removeEvent(document,\"mousemove\",this.__dragColumnMoveRef);\r\n\t\t\tthis.__dragColumnMoveRef = null;\r\n\t\t\tthis.util.removeEvent(document,\"mouseup\",this.__dragColumnEndRef);\r\n\t\t\tthis.__dragColumnEndRef = null;\r\n\t\t\tif(this.__objColumnDrag.dragElementAdded)\r\n\t\t\t{\r\n\t\t\t\tvar position = this.util.getEventPosition(event);\r\n\t\t\t\tposition.top = position.top + this.__nsGrid.__divCenterTableHeaderContainer.scrollTop;\r\n\t\t\t\tposition.left = position.left + this.__nsGrid.__divCenterTableHeaderContainer.scrollLeft;\r\n\t\t\t\tvar tablePosition = this.util.getOffSet(this.__nsGrid.__tblCenterHeader);\r\n\t\t\t\tif (position.top < tablePosition.top || position.top > (tablePosition.top + this.__nsGrid.__tblCenterHeader.offsetHeight)) \r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addStyleClass(this.__objColumnDrag.dragElement,\"nsGhostHeader\");\r\n\t\t\t\t\tvar transitionEndCallback = function()\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__removeDragElement();\r\n\t\t\t\t\t};\r\n\t\t\t\t\tvar transition = new this.util.transition(this.__objColumnDrag.dragElement,transitionEndCallback.bind(this));\r\n\t\t\t\t\tthis.__objColumnDrag.dragElement.style.left = (this.__objColumnDrag.position.left - this.__nsGrid.__divCenterTableHeaderContainer.scrollLeft) + \"px\"; //position.left + \"px\";\r\n\t\t\t\t\tthis.__objColumnDrag.dragElement.style.top = (this.__objColumnDrag.position.top ) + \"px\";\r\n\t\t\t\t    return;\r\n\t\t\t\t}\r\n\t\t\t\tvar targetIndex = this.__getHeaderColumnByPosition(position);\r\n\t\t\t    if (targetIndex > -1 && targetIndex != this.__objColumnDrag.columnIndex) \r\n\t\t\t    {\r\n\t\t\t    \tthis.__nsGrid.moveColumn(this.__objColumnDrag.columnIndex,targetIndex);\r\n\t\t\t    }\r\n\t\t\t    this.__removeDragElement();\r\n\t\t\t}\r\n\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.COLUMN_MOVED,this.__objColumnDrag.objColumn,{columnDetail:this.__objColumnDrag.objColumn,columnIndex:this.__objColumnDrag.columnIndex});\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createCopyItem = function(target,position)\r\n\t\t{\r\n\t\t\tvar divDrag = null;\r\n\t\t\tif(target && position)\r\n\t\t\t{\r\n\t\t\t\tdivDrag = this.util.createDiv(this.__nsGrid.getID() + \"Drag\",this.__nsGrid.__CLASS_TABLE_HEADER_CELL);\r\n\t\t\t\tthis.util.addStyleClass(divDrag , \"nsDataGridHeaderDrag\");\r\n\t\t\t\tthis.util.addStyleClass(divDrag , \"nsDataGridHeaderDrag\" + this.__nsGrid.__theme);\r\n\t\t\t\tdivDrag.innerHTML = target.innerHTML;\r\n\t\t\t\tdivDrag.style.left = (position.left) + \"px\";\r\n\t\t\t\tdivDrag.style.top = (position.top) + \"px\";\r\n\t\t\t\t//giving 50px padding to the width if width is very less\r\n\t\t\t\tdivDrag.style.width = (target.offsetWidth + 50) + \"px\";\r\n\t\t\t\tdivDrag.style.height = target.offsetHeight + \"px\";\r\n\t\t\t\tif(this.__maxZIndex > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tdivDrag.style.zIndex = this.__maxZIndex + 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn divDrag;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__positionDragElement = function(event)\r\n\t\t{\r\n\t\t\tvar posEvent = this.util.getEventPosition(event);\r\n\t\t\tvar rectDragElement = this.__objColumnDrag.dragElement.getBoundingClientRect();\r\n\t        var objDimension = this.util.getDocumentDimension();\r\n\t        var browserWidth = objDimension.width - 2;\r\n\t        var browserHeight = objDimension.height - 2;\r\n\t        // put DragElement vertically in middle of cursor\r\n\t        var yPos = posEvent.top - (rectDragElement.height / 2);\r\n\t        var xPos = posEvent.left;\r\n\t        if (browserWidth > 0) \r\n\t        {\r\n\t            if ((xPos + this.__objColumnDrag.dragElement.clientWidth) > browserWidth) \r\n\t            {\r\n\t            \txPos = browserWidth - this.__objColumnDrag.dragElement.clientWidth;\r\n\t            }\r\n\t        }\r\n\t        if (browserHeight > 0) \r\n\t        {\r\n\t            if ((yPos + this.__objColumnDrag.dragElement.clientHeight) > browserHeight) \r\n\t            {\r\n\t            \tyPos = browserHeight - this.__objColumnDrag.dragElement.clientHeight;\r\n\t            }\r\n\t        }\r\n\t        xPos = Math.max(0,xPos);\r\n\t        yPos = Math.max(0,yPos);\r\n\t        this.__objColumnDrag.dragElement.style.left = xPos + \"px\";\r\n\t        this.__objColumnDrag.dragElement.style.top = yPos + \"px\";\r\n\t\t};\r\n\t\t\r\n\t\tthis.__removeDragElement = function()\r\n\t\t{\r\n\t\t\tif(this.__objColumnDrag && this.__objColumnDrag.dragElement)\r\n\t\t\t{\r\n\t\t\t\tdocument.body.removeChild(this.__objColumnDrag.dragElement);\r\n\t\t\t\tthis.__objColumnDrag.dragElement = null;\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__getHeaderColumnByPosition = function(position) \r\n\t\t{\r\n\t\t\tvar headerBodyRow = this.__nsGrid.__getHeaderBodyRow(this.__nsGrid.__tblCenterHeader);\r\n\t\t\tif(headerBodyRow)\r\n\t\t\t{\r\n\t\t\t\tvar headerBodyRowCells = headerBodyRow.cells;\r\n\t\t\t    for (var count = 0; count < headerBodyRowCells.length; count++) \r\n\t\t\t    {\r\n\t\t\t    \tvar cell = headerBodyRowCells[count];\r\n\t\t\t    \tif(this.util.hasStyleClass(cell,this.__nsGrid.__CLASS_TABLE_HEADER_DROPPABLE_CELL))\r\n\t\t\t    \t{\r\n\t\t\t    \t\tvar rowPosition = this.util.getOffSet(cell);\r\n\t\t\t\t    \tif (rowPosition.left <= position.left && position.left <= rowPosition.left + headerBodyRowCells[count].offsetWidth) \r\n\t\t\t\t    \t{\r\n\t\t\t\t    \t\treturn count;\r\n\t\t\t\t    \t}\r\n\t\t\t    \t}\r\n\t\t\t    }\r\n\t\t\t    return -1;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\t/*Horizontal Scroll Logic for Edge cases */\r\n\t\tthis.__getDragDirection = function(event) \r\n\t\t{\r\n\t\t    var direction = null;\r\n\t\t    if (this.__lastDragEvent.clientX > event.clientX) \r\n\t\t    {\r\n\t\t        direction = \"left\";\r\n\t\t    }\r\n\t\t    else if (this.__lastDragEvent.clientX < event.clientX) \r\n\t\t    {\r\n\t\t        direction = \"right\";\r\n\t\t    }\r\n\t\t    return direction;\r\n\t\t};\r\n\t\r\n\t\tthis.__getDragInfoObject = function(event,direction) \r\n\t\t{\r\n\t\t    // localise x and y to the target component\r\n\t\t    var rect = this.__nsGrid.__divCenterTableHeaderContainer.getBoundingClientRect();\r\n\t\t    var x = event.clientX - rect.left;\r\n\t\t    var y = event.clientY - rect.top;\r\n\t\t    var objDragInfo = \r\n\t\t    {\r\n\t\t        event: event,\r\n\t\t        x: x,\r\n\t\t        y: y,\r\n\t\t        direction: direction\r\n\t\t    };\r\n\t\t    return objDragInfo;\r\n\t\t};\r\n\t\r\n\t\tthis.__handleScrollMovement = function(objDragInfo) \r\n\t\t{\r\n\t\t\tthis.__lastDragInfo = objDragInfo;\r\n\t\t    if (!objDragInfo || !objDragInfo.direction) \r\n\t\t    {\r\n\t\t        return;\r\n\t\t    }\r\n\t\t    var adjustedScrollPos = this.__getAdjustedScrollPosition(objDragInfo);\r\n\t\t    this.__setScrollVariables(adjustedScrollPos);\r\n\t\t};\r\n\t\r\n\t\tthis.__getAdjustedScrollPosition = function(objDragInfo) \r\n\t\t{\r\n\t\t\treturn objDragInfo.x + this.__scrollableContainer.scrollLeft;\r\n\t\t};\r\n\t\r\n\t\tthis.__setScrollVariables = function (adjustedScrollPos) \r\n\t\t{\r\n\t\t    if (this.__scrollableContainer) \r\n\t\t    {\r\n\t\t        //below logic checks if the scroll should move right or left\r\n\t\t        var xPosLeft = this.__scrollableContainer.scrollLeft;\r\n\t\t        var xPosRight = xPosLeft + this.__scrollableContainer.clientWidth;\r\n\t\t        this.__scrollLeft = adjustedScrollPos < (xPosLeft + 50);\r\n\t\t        this.__scrollRight = adjustedScrollPos > (xPosRight - 100);\r\n\t\t        if(this.__scrollLeft || this.__scrollRight) \r\n\t\t        {\r\n\t\t            this.__startScrollAnimation();\r\n\t\t        }\r\n\t\t        else \r\n\t\t        {\r\n\t\t            this.__stopScrollAnimation();\r\n\t\t        }\r\n\t\t    }\r\n\t\t};\r\n\t\r\n\t\tthis.__startScrollAnimation = function() \r\n\t\t{\r\n\t\t    if (!this.__scrollInterval) \r\n\t\t    {\r\n\t\t        this.__animationSteps = 0;\r\n\t\t        this.__moveAttempts = 0;\r\n\t\t        this.__scrollInterval = setInterval(this.__scrollBody.bind(this), 100);\r\n\t\t        if (this.__scrollLeft) \r\n\t\t        {\r\n\t\t        \tthis.__setIcon(\"left\",true);\r\n\t\t            //this.dragAndDropService.setGhostIcon(dragAndDropService_1.DragAndDropService.ICON_LEFT, true);\r\n\t\t        }\r\n\t\t        else \r\n\t\t        {\r\n\t\t        \tthis.__setIcon(\"right\",true);\r\n\t\t            //this.dragAndDropService.setGhostIcon(dragAndDropService_1.DragAndDropService.ICON_RIGHT, true);\r\n\t\t        }\r\n\t\t    }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__stopScrollAnimation = function () \r\n\t\t{\r\n\t\t    if (this.__scrollInterval) \r\n\t\t    {\r\n\t\t        clearInterval(this.__scrollInterval);\r\n\t\t        this.__scrollInterval = null;\r\n\t\t        this.__setIcon(\"move\",false);\r\n\t\t        //this.dragAndDropService.setGhostIcon(dragAndDropService_1.DragAndDropService.ICON_MOVE);\r\n\t\t    }\r\n\t\t};\r\n\t\r\n\t\tthis.__scrollBody = function() \r\n\t\t{\r\n\t\t    var pixelsToMove;\r\n\t\t    this.__animationSteps++;\r\n\t\t    pixelsToMove = 10 + (this.__animationSteps * 5);\r\n\t\t    if (pixelsToMove > 100) \r\n\t\t    {\r\n\t\t        pixelsToMove = 100;\r\n\t\t    }\r\n\t\t    var pixelsMoved = 0;\r\n\t\t    if (this.__scrollLeft) \r\n\t\t    {\r\n\t\t        pixelsMoved = this.__scrollBodyHorizontally(-pixelsToMove);\r\n\t\t    }\r\n\t\t    else if (this.__scrollRight) \r\n\t\t    {\r\n\t\t        pixelsMoved = this.__scrollBodyHorizontally(pixelsToMove);\r\n\t\t    }\r\n\t\t    if (pixelsMoved !== 0) \r\n\t\t    {\r\n\t\t        this.__handleScrollMovement(this.__lastDragInfo);\r\n\t\t        this.__moveAttempts = 0;\r\n\t\t    }\r\n\t\t    else \r\n\t\t    {\r\n\t\t        this.__moveAttempts++;\r\n\t\t        if (this.__moveAttempts > 7) \r\n\t\t        {\r\n\t\t            if (this.__scrollLeft) \r\n\t\t            {\r\n\t\t                //this.columnController.setColumnPinned(this.__lastDragInfo.dragItem, column_1.Column.PINNED_LEFT);\r\n\t\t            }\r\n\t\t            else \r\n\t\t            {\r\n\t\t                //this.columnController.setColumnPinned(this.__lastDragInfo.dragItem, column_1.Column.PINNED_RIGHT);\r\n\t\t            }\r\n\t\t            this.__pushScroll();\r\n\t\t        }\r\n\t\t    }\r\n\t\t};\r\n\t\r\n\t\tthis.__scrollBodyHorizontally = function(pixels) \r\n\t\t{\r\n\t\t    var oldScrollPosition = this.__scrollableContainer.scrollLeft;\r\n\t\t    this.__scrollableContainer.scrollLeft = oldScrollPosition + pixels;\r\n\t\t    var newScrollPosition = this.__scrollableContainer.scrollLeft;\r\n\t\t    return newScrollPosition - oldScrollPosition;\r\n\t\t};\r\n\t\r\n\t\tthis.__pushScroll = function() \r\n\t\t{\r\n\t\t    if (this.__isColumnDragged) \r\n\t\t    {\r\n\t\t        this.__handleScrollMovement(this.__lastDragEvent);\r\n\t\t    }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setIcon = function(iconName,animate)\r\n\t\t{\r\n\t\t\tif(iconName)\r\n\t\t\t{\r\n\t\t\t\tvar divDrag = this.__objColumnDrag.dragElement;\r\n\t\t\t\tvar divMove = divDrag.querySelector(\".nsHeaderMove\");\r\n\t\t\t\tvar objSVG = new NSSvg();\r\n\t\t\t\tvar iconID = null;\r\n\t\t\t\tswitch(iconName) \r\n\t\t\t\t{\r\n\t\t\t         case \"left\":\r\n\t\t\t        \t iconID = new NSSvgShapes().__MOVE_ICON_ID;\r\n\t\t\t             break;\r\n\t\t\t         case \"right\":\r\n\t\t\t        \t iconID = new NSSvgShapes().__RIGHT_ICON_ID;\r\n\t\t\t             break;\r\n\t\t\t         case \"move\":\r\n\t\t\t        \t iconID = new NSSvgShapes().__LEFT_ICON_ID;\r\n\t\t\t             break;\r\n\t\t\t         default:\r\n\t\t\t        \t iconID = null;\r\n\t\t\t             break;\r\n\t\t\t\t}\r\n\t\t\t\tif(divMove)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.removeAllChildren(divMove);\r\n\t\t\t\t\tif(iconID)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar containerID = divMove.getAttribute(\"id\");\r\n\t\t\t\t\t\tif(!containerID)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcontainerID = this.util.getUniqueId();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar svg = objSVG.addSVG(divMove,containerID + iconID + \"svg\",\"nsMoveIcon\",null,null,null,null,null,null,false);\r\n\t\t\t\t\t\tthis.util.addStyleClass(svg,\"nsMoveIconTheme\");\r\n\t\t\t\t\t\tobjSVG.addUse(svg,containerID + \"use\",null,\"#\" + iconID);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tanimate ? this.util.addStyleClass(divMove,\"nsAnimateLeftToRight\") : this.util.removeStyleClass(divMove,\"nsAnimateLeftToRight\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t/*End of Horizontal Scroll Logic for Edge cases */\r\n\t};\r\n\treturn NSGridColumnMove;\r\n})();\r\nnsModuleExport(this,\"NSGridColumnMove\",NSGridColumnMove);\r\n\r\nvar NSGridFilter = (function()\r\n{\r\n\tvar NSGridFilter = function(nsGrid)\r\n\t{\r\n\t\tthis.SEARCH_INTERVAL = 500;\r\n\t\tthis.__nsGrid = nsGrid;\r\n\t\tthis.__enableApply = true;\r\n\t\tthis.__isOrFilter = false;\r\n\t\t\r\n\t\tthis.util = nsGrid.util;\r\n\t\tthis.isFiltered = false;\r\n\t\tthis.__interval = null;\r\n\t\tthis.__objControl = {};\r\n\t\tthis.__filteredColumn = [];\r\n\t\tthis.__objAdvancedFilterSetting = {};\r\n\t\tthis.__nsPopUp = null;\r\n\t\tthis.__maxZIndex = -1;\r\n\t\tthis.__documentClickRef = null;\r\n\t\tthis.__documentKeyUpRef = null;\r\n\t\t\r\n\t\tthis.processColumnObject = function(objColumn)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter)\r\n\t\t\t{\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"enableFilter\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn.enableFilter = Boolean.parse(objColumn[\"enableFilter\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn.enableFilter = true;\r\n\t\t\t\t}\r\n\t\t\t\tif(objColumn.enableFilter)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar objFilter = objColumn[\"filter\"];\r\n\t\t\t\t\tif(objFilter)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(objFilter.hasOwnProperty(\"filterRenderer\"))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar filterRenderer = objFilter[\"filterRenderer\"];\r\n\t\t\t\t\t\t\tif (typeof filterRenderer === \"string\" || filterRenderer instanceof String)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif(this.util.isFunction(filterRenderer))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tobjFilter.filterRenderer = this.__nsGrid.__context[filterRenderer];\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(objFilter.hasOwnProperty(\"filterTemplate\") && objFilter[\"filterTemplate\"])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tobjFilter.filterTemplate = this.util.getTemplate(objFilter[\"filterTemplate\"]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(objFilter.hasOwnProperty(\"type\") && objFilter[\"type\"] == NSGrid.FILTER_TYPE_DATE)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__setDefaultDatePicker();\r\n\t\t\t\t\t\t\tobjFilter.filterDateComponent = new this.__nsGrid.__components[\"datePicker\"]();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tobjFilter.filterRenderer = this.__defaultRenderer.bind(this);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(this.__nsGrid.__enableAdvancedFilter)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(objFilter.hasOwnProperty(\"enableAdvancedFilter\"))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tobjFilter.enableAdvancedFilter = Boolean.parse(objFilter[\"enableAdvancedFilter\"]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tobjFilter.enableAdvancedFilter = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tobjFilter[\"advancedFilterType\"] = objFilter[\"advancedFilterType\"] ? objFilter[\"advancedFilterType\"] : NSGrid.ADVANCED_FILTER_TEXT;\r\n\t\t\t\t\t\t\tif(objFilter.hasOwnProperty(\"advancedFilterHandler\"))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar advancedFilterHandler = objFilter[\"advancedFilterHandler\"];\r\n\t\t\t\t\t\t\t\tif (typeof advancedFilterHandler === \"string\" || advancedFilterHandler instanceof String)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif(this.util.isFunction(advancedFilterHandler))\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tobjFilter.advancedFilterHandler = this.__nsGrid.__context[advancedFilterHandler];\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tobjFilter.enableAdvancedFilter = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tobjColumn[\"filter\"] = {filterRenderer:this.__defaultRenderer.bind(this),enableAdvancedFilter:this.__nsGrid.__enableAdvancedFilter,advancedFilterType:NSGrid.ADVANCED_FILTER_TEXT};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.addFilterRenderer = function(rendererRow,rendererCell,colItem,colIndex,colID)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter && colItem && colItem[\"enableFilter\"])\r\n\t\t\t{\r\n\t\t\t\tvar objFilter = colItem[\"filter\"];\r\n\t\t\t\tif(objFilter)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divHeaderRendererContainer = this.util.createDiv(colID + \"rendererContainer\",\"nsFilterParentContainer\"); \r\n\t\t\t\t\trendererCell.appendChild(divHeaderRendererContainer);\r\n\t\t\t\t\tvar dataField = colItem[\"dataField\"];\r\n\t\t\t\t\tvar type = objFilter[\"type\"];\r\n\t\t\t\t\tvar templateRenderer = objFilter[\"filterTemplate\"];\r\n\t\t\t\t\tvar itemRenderer = objFilter[\"filterRenderer\"];\r\n\t\t\t\t\tvar dateComponent = objFilter[\"filterDateComponent\"];\r\n\t\t\t\t\tif(dateComponent && type == NSGrid.FILTER_TYPE_DATE)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar config = objFilter[\"config\"] || {};\r\n\t\t\t\t\t\tthis.dateRenderer(dateComponent,dataField,divHeaderRendererContainer,config,objFilter,this.dateSelectedHandler.bind(this,objFilter));\r\n\t\t\t\t\t\tthis.__objControl[dataField] = {control:dateComponent,config:config,type:\"date\"};\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(itemRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar objRenderer = itemRenderer(colItem,colIndex,rendererCell,rendererRow);\r\n\t\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar compSpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\t\tcompSpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(compSpan);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(objRenderer);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(templateRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(templateRenderer.cloneNode(true));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(objFilter && objFilter[\"enableAdvancedFilter\"])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar rendererID = this.__getRendererID(dataField);\r\n\t\t\t\t\t\tvar divFilterIconContainer = this.util.createDiv(rendererID + \"FilterIconContainer\",\"nsFilterIconContainer\");\r\n\t\t\t\t\t\tdivFilterIconContainer.setAttribute(\"field\",dataField);\r\n\t\t\t\t\t\tthis.util.addEvent(divFilterIconContainer,\"click\",this.__filterIconClickHandler.bind(this));\r\n\t\t\t\t\t\tif(this.__nsGrid.__getColumnCustomIcon(colItem,\"filter\"))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdivFilterIconContainer.innerHTML = this.__nsGrid.__getColumnCustomIcon(colItem,\"filter\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar objSVG = new NSSvg();\r\n\t\t\t\t\t\t\tvar filterID = new NSSvgShapes().__FILTER_ICON_ID;\r\n\t\t\t\t\t\t\tvar svg = objSVG.addSVG(divFilterIconContainer,rendererID + \"filtersvg\",\"nsFilterIconSVG\",null,null,null,null,null,null,true);\r\n\t\t\t\t\t\t\tobjSVG.addUse(svg,rendererID + \"use\",null,\"#\" + filterID);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.util.addStyleClass(divHeaderRendererContainer,\"nsAdvancedFilterParentContainer\");\r\n\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(divFilterIconContainer);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.dateRenderer = function(dateComponent,dataField,parent,config,objFilter,dateSelectedHandler)\r\n\t\t{\r\n\t\t\tconfig.dateSelectedHandler = this.dateSelectedHandler.bind(this,objFilter,config);//dateSelectedHandler;\r\n\t\t\tdateComponent.init(config);\r\n\t\t\tvar element = dateComponent.getElement();\r\n\t\t\tif(element)\r\n\t\t\t{\r\n\t\t\t\telement.setAttribute(\"field\",dataField);\r\n\t\t\t\tparent.appendChild(element);\r\n\t\t\t\tdateComponent.elementAdded();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.warning(\"NSGrid\",\"Date Component UI is null.\");\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.dateSelectedHandler = function(objFilter,config,isTyping)\r\n\t\t{\r\n\t\t\tvar dateComponent = objFilter[\"filterDateComponent\"];\r\n\t\t\tif(dateComponent)\r\n\t\t\t{\r\n\t\t\t\tvar date = dateComponent.getDate();\r\n\t\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\t\t//clear advanced Filter object if coming from normal filter\r\n\t\t\t\tif(!this.__nsPopUp)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar dataField = target.getAttribute(\"field\");\r\n\t\t\t\t\tif(dataField)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(isTyping)\r\n\t\t\t\t{\r\n\t\t\t\t\tclearTimeout(this.__interval);\r\n\t\t\t\t\tvar base = this;\r\n\t\t\t\t\tthis.__interval = setTimeout(function(){\r\n\t\t\t\t\t\t\tbase.__filterGrid.bind(base)();\r\n\t\t\t\t\t}, this.SEARCH_INTERVAL);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__filterGrid.bind(this)();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.setFiltersInControls = function(filter)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter && this.__objControl && filter)\r\n\t\t\t{\r\n\t\t\t\t for(var field in this.__objControl)\r\n\t\t\t\t {\r\n\t\t\t\t\t if(filter[field])\r\n\t\t\t\t     {\r\n\t\t\t\t\t\t var control = this.__objControl[field];\r\n\t\t\t\t\t\t if(control && control.control)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t if(control.type == \"date\")\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t control.control.setDate(filter[field]);\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t else if(control.type == \"text\")\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t control.control.value = filter[field];\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t     }\r\n\t\t\t\t }\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.resetFilters = function()\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter && this.__objControl)\r\n\t\t\t{\r\n\t\t\t\t for(var field in this.__objControl)\r\n\t\t\t\t {\r\n\t\t\t\t\t var control = this.__objControl[field];\r\n\t\t\t\t\t if(control && control.control)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t if(control.type == \"date\" && control.control.getDate())\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t control.control.setDate(null);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if(control.type == \"text\" && control.control.value)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t control.control.value = \"\";\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t this.__resetFiltering();\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.remove = function()\r\n\t\t{\r\n\t\t\tif(this.__documentClickRef)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeEvent(document,\"click\", this.__documentClickRef, false);\r\n\t\t\t\tthis.__documentClickRef = null;\r\n\t\t\t}\r\n\t\t\tif(this.__documentKeyUpRef)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeEvent(document,\"keyup\", this.__documentKeyUpRef, false);\r\n\t\t\t\tthis.__documentKeyUpRef = null;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.clearFilters = function() \r\n\t\t{\r\n\t\t\t for(var field in this.__objControl)\r\n\t\t\t {\r\n\t\t\t\t var control = this.__objControl[field];\r\n\t\t\t\t if(control && control.control)\r\n\t\t\t\t {\r\n\t\t\t\t\t if(control.type == \"date\" && control.control.getDate())\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t control.control.setDate(null);\r\n\t\t\t\t\t }\r\n\t\t\t\t\t else if(control.type == \"text\" && control.control.value)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t control.control.value = \"\";\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t this.__objAdvancedFilterSetting = {};\r\n\t\t};\r\n\t\t\r\n\t\tthis.resetVariables = function() \r\n\t\t{\r\n\t\t\tthis.__filteredColumn = [];\r\n\t\t\tthis.__objAdvancedFilterSetting = [];\r\n\t\t};\r\n\t\t\r\n\t\tthis.__initialize = function()\r\n\t\t{\r\n\t\t\tif(!this.__documentClickRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__documentClickRef = this.__documentClickHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(document,\"click\", this.__documentClickRef);\r\n\t\t\t}\r\n\t\t\tif(!this.__documentKeyUpRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__documentKeyUpRef = this.__documentKeyUpHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(document,\"keyup\", this.__documentKeyUpRef);\r\n\t\t\t}\r\n\t\t\tthis.__maxZIndex = this.util.getMaxZIndex();\r\n\t\t\tthis.__injectInNSGrid();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__defaultRenderer = function(colItem,colIndex,cell,row)\r\n\t\t{\r\n\t\t\tif(colItem)\r\n\t\t\t{\r\n\t\t\t\tvar objFilter = colItem[\"filter\"];\r\n\t\t\t\tvar dataField = colItem[\"dataField\"];\r\n\t\t\t\tvar headerText = colItem[\"headerText\"];\r\n\t\t\t\tvar rendererID = this.__getRendererID(dataField);\r\n\t\t\t\tvar divRenderer = this.util.createDiv(rendererID,\"nsFilterContainer\");\r\n\t\t\t\tvar txtFilter = this.util.createElement(\"input\",\"txt\" + rendererID,\"nsFilter\");\r\n\t\t\t\t//this.util.addStyleClass(txtFilter,\"nsSearchInlineTextBox\");\r\n\t\t\t\ttxtFilter.setAttribute(\"type\",\"search\");\r\n\t\t\t\ttxtFilter.setAttribute(\"autocomplete\",\"off\");\r\n\t\t\t\ttxtFilter.setAttribute(\"field\",dataField);\r\n\t\t\t\t//txtFilter.setAttribute(\"placeholder\",\"Search \" + headerText);\r\n\t\t\t\tthis.util.addEvent(txtFilter,\"input\",this.__txtInputChangeHandler.bind(this));\r\n\t\t\t\t//this.util.addEvent(txtFilter,\"search\",this.__txtInputChangeHandler.bind(this));\r\n\t\t\t\t//var divSearch = this.util.getSearchTextBox(txtFilter);\r\n\t\t\t\t//txtFilter.style.width = (cell.offsetWidth / 2) + \"px\";\r\n\t\t\t\tdivRenderer.appendChild(txtFilter);\r\n\t\t\t\tthis.__objControl[dataField] = {control:txtFilter,type:\"text\"};\r\n\t\t\t\treturn divRenderer;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__txtInputChangeHandler = function(event)\r\n\t\t{\r\n\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\tvar dataField = target.getAttribute(\"field\");\r\n\t\t\tif(dataField)\r\n\t\t\t{\r\n\t\t\t\tthis.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t}\r\n\t\t\tclearTimeout(this.__interval);\r\n\t\t\tvar base = this;\r\n\t\t\tthis.__interval = setTimeout(function(){\r\n\t\t\t\t\tbase.__filterGrid.bind(base)();\r\n\t\t\t\t}, this.SEARCH_INTERVAL);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__filterIconClickHandler = function(event)\r\n\t\t{\r\n\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\ttarget = this.util.getWebComponentElement(target);\r\n\t\t\tif(target && !this.util.hasStyleClass(target,\"nsFilterIconContainer\"))\r\n\t\t\t{\r\n\t\t\t\ttarget = this.util.findParentBySelector(target,\".nsFilterIconContainer\");\r\n\t\t\t}\r\n\t\t\tvar dataField = target.getAttribute(\"field\");\r\n\t\t\tvar objColumn = this.__nsGrid.__getColumnObjectByDataField(dataField);\r\n\t\t\tvar objFilter = objColumn[\"filter\"];\r\n\t\t\tif(this.__nsPopUp)\r\n\t\t\t{\r\n\t\t\t\tthis.__removePopUp();\r\n\t\t\t}\r\n\t\t\tvar control = this.__objControl[dataField];\r\n\t\t\tif(control && control.control)\r\n\t\t\t{\r\n\t\t\t\t(control.type == \"date\") ? control.control.setDate(null) : control.control.value = \"\";\r\n\t\t\t}\r\n\t\t\tvar colID = this.__getRendererID(dataField);\r\n\t\t\tvar popUpPos = objFilter[\"advancedFilterPopUpPos\"];\r\n\t\t\tif(!popUpPos)\r\n\t\t\t{\r\n\t\t\t\tpopUpPos = this.util.POS_BOTTOMLEFT;\r\n\t\t\t\tif(objColumn[this.__nsGrid.__fieldColIndex] === 0 || (this.__nsGrid.__enableGrouping && objColumn[this.__nsGrid.__fieldColIndex] === 1))\r\n\t\t\t\t{\r\n\t\t\t\t\tpopUpPos = this.util.POS_BOTTOMRIGHT; \r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar popUpSetting = {id:colID + \"detailFilterContainer\",type:\"div\",width:275,position:popUpPos,closeOnOutsideClick:true};\r\n\t\t\tthis.__nsPopUp = new this.util.nsPopUp(popUpSetting);\r\n\t\t\tthis.__nsPopUp.create();\r\n\t\t\tvar popUp = this.__nsPopUp.getPopUp();\r\n\t\t\tif(this.__maxZIndex > 0)\r\n\t\t\t{\r\n\t\t\t\tpopUp.style.zIndex = this.__maxZIndex + 1;\r\n\t\t\t}\r\n\t\t\tthis.util.addEvent(popUp,\"click\",this.__detailFilterClickHandler.bind(this));\r\n\t\t\tvar advancedFilterType = objFilter[\"advancedFilterType\"];\r\n\t\t\tif(objFilter.advancedFilterHandler)\r\n\t\t\t{\r\n\t\t\t\tobjFilter.advancedFilterHandler(dataField,this.__nsPopUp,this.__objAdvancedFilterSetting,this.__getRendererID(dataField),this.__enableApply,\r\n\t\t\t\t\t\tthis.__createApplySection.bind(this),this.__advanceFilterGrid.bind(this),this.__removePopUp.bind(this));\r\n\t\t\t}\r\n\t\t\telse if(advancedFilterType === NSGrid.ADVANCED_FILTER_TEXT)\r\n\t\t\t{\r\n\t\t\t\tthis.__getTextDetailFilter(dataField,objFilter);\r\n\t\t\t}\r\n\t\t\telse if(advancedFilterType === NSGrid.ADVANCED_FILTER_NUMBER)\r\n\t\t\t{\r\n\t\t\t\tthis.__getNumberDetailFilter(dataField,objFilter);\r\n\t\t\t}\r\n\t\t\telse if(advancedFilterType === NSGrid.ADVANCED_FILTER_LIST)\r\n\t\t\t{\r\n\t\t\t\tthis.__getListDetailFilter(dataField,objFilter);\r\n\t\t\t}\r\n\t\t\telse if(advancedFilterType === NSGrid.ADVANCED_FILTER_DATE)\r\n\t\t\t{\r\n\t\t\t\tthis.__getDateDetailFilter(dataField,objFilter);\r\n\t\t\t}\r\n\t\t\tthis.__nsPopUp.show();\r\n\t\t\tthis.__nsPopUp.placePopUp(event);\r\n\t\t\t//event.stopImmediatePropagation();\r\n\t\t\tevent.stopPropagation();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__filterGrid = function()\r\n\t\t{\r\n\t\t\t var conditionFilter = null;\r\n\t\t\t if(this.__isOrFilter)\r\n\t\t\t {\r\n\t\t\t\t var filter = [];\r\n\t\t\t\t var setting = {};\r\n\t\t\t\t for(var field in this.__objControl)\r\n\t\t\t\t {\r\n\t\t\t\t\t var control = this.__objControl[field];\r\n\t\t\t\t\t if(control && control.control)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t if(control.type == \"date\" && control.control.getDate())\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t var item = {};\r\n\t\t\t\t\t\t\t item[field] = control.control.getDate();\r\n\t\t\t\t\t\t\t var config = control.config || {};\r\n\t\t\t\t\t\t\t setting[field] = {matchType:\"equals\",type:\"date\"};\r\n\t\t\t\t\t\t\t for(var key in config)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(this.util.isUndefined(setting[field][key]))\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t setting[field][key] = config[key];\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t filter.push(item);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if(control.type == \"text\" && control.control.value)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t var item = {};\r\n\t\t\t\t\t\t\t item[field] = control.control.value;\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:false,multiline:false,matchType:new NSFilter().CONTAINS};\r\n\t\t\t\t\t\t\t filter.push(item);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t conditionFilter = filter;\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t var filter = {};\r\n\t\t\t\t var setting = {};\r\n\t\t\t\t for(var field in this.__objControl)\r\n\t\t\t\t {\r\n\t\t\t\t\t var control = this.__objControl[field];\r\n\t\t\t\t\t if(control && control.control)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t if(control.type == \"date\" && control.control.getDate())\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t filter[field] = control.control.getDate();\r\n\t\t\t\t\t\t\t var config = control.config || {};\r\n\t\t\t\t\t\t\t setting[field] = {matchType:\"equals\",type:\"date\"};\r\n\t\t\t\t\t\t\t for(var key in config)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(this.util.isUndefined(setting[field][key]))\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t setting[field][key] = config[key];\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if(control.type == \"text\" && control.control.value)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t filter[field] = control.control.value;\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:false,multiline:false,matchType:new NSFilter().CONTAINS};\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t conditionFilter = Object.keys(filter);\r\n\t\t\t }\r\n\t\t\t var isReset = false;\r\n\t\t\t if(filter && conditionFilter && conditionFilter.length > 0)\r\n\t\t\t {\r\n\t\t\t\t this.__handleFiltering(filter,setting);\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t this.__resetFiltering();\r\n\t\t\t\t isReset = true;\r\n\t\t\t }\r\n\t\t\t this.__nsGrid.__callFunctionInsideGridType(\"afterFiltering\",isReset);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__advanceFilterGrid = function()\r\n\t\t{\r\n\t\t\t var fieldSetting = null;\r\n\t\t\t var field = null;\r\n\t\t\t var conditionFilter = null;\r\n\t\t\t if(this.__isOrFilter)\r\n\t\t\t {\r\n\t\t\t\t var filter = [];\r\n\t\t\t\t var setting = {};\r\n\t\t\t\t var item = null;\r\n\t\t\t\t for(field in this.__objAdvancedFilterSetting)\r\n\t\t\t\t {\r\n\t\t\t\t\t fieldSetting = this.__objAdvancedFilterSetting[field];\r\n\t\t\t\t\t if(fieldSetting)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t if(fieldSetting.type == NSGrid.ADVANCED_FILTER_DATE)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t item = {};\r\n\t\t\t\t\t\t\t item[field] = new Date();\r\n\t\t\t\t\t\t\t filter.push(item);\r\n\t\t\t\t\t\t\t var config = fieldSetting.config || {};\r\n\t\t\t\t\t\t\t setting[field] = {matchType1:fieldSetting.firstSelectValue,firstDate:fieldSetting.firstDate,operation:fieldSetting.operationSelectValue,\r\n\t\t\t\t\t\t\t\t\t matchType2:fieldSetting.secondSelectValue,secondDate:fieldSetting.secondDate,\r\n\t\t\t\t\t\t\t\t\t type:NSGrid.ADVANCED_FILTER_DATE};\r\n\t\t\t\t\t\t\t for(var key in config)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(this.util.isUndefined(setting[field][key]))\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t setting[field][key] = config[key];\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if(fieldSetting[\"arrText\"] && fieldSetting[\"arrTextField\"])\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t var arrTextField = fieldSetting[\"arrTextField\"];\r\n\t\t\t\t\t\t\t var arrText = fieldSetting[\"arrText\"];\r\n\t\t\t\t\t\t\t var length = arrText.length;\r\n\t\t\t\t\t\t\t filter[field] = [];\r\n\t\t\t\t\t\t\t for(var count = 0;count < length;count++)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t item = {};\r\n\t\t\t\t\t\t\t\t item[field] = arrText[count][arrTextField];\r\n\t\t\t\t\t\t\t\t filter.push(item);\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:fieldSetting.caseSensitive,multiline:false,matchType:fieldSetting.matchType};\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t item = {};\r\n\t\t\t\t\t\t\t item[field] = fieldSetting.text;\r\n\t\t\t\t\t\t\t filter.push(item);\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:fieldSetting.caseSensitive,multiline:false,matchType:fieldSetting.matchType};\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t conditionFilter = filter;\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t var filter = {};\r\n\t\t\t\t var setting = {};\r\n\t\t\t\t for(field in this.__objAdvancedFilterSetting)\r\n\t\t\t\t {\r\n\t\t\t\t\t fieldSetting = this.__objAdvancedFilterSetting[field];\r\n\t\t\t\t\t if(fieldSetting)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t if(fieldSetting.type == NSGrid.ADVANCED_FILTER_DATE)\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t filter[field] = new Date();\r\n\t\t\t\t\t\t\t var config = fieldSetting.config || {};\r\n\t\t\t\t\t\t\t setting[field] = {matchType1:fieldSetting.firstSelectValue,firstDate:fieldSetting.firstDate,operation:fieldSetting.operationSelectValue,\r\n\t\t\t\t\t\t\t\t\t matchType2:fieldSetting.secondSelectValue,secondDate:fieldSetting.secondDate,\r\n\t\t\t\t\t\t\t\t\t type:NSGrid.ADVANCED_FILTER_DATE};\r\n\t\t\t\t\t\t\t for(var key in config)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t if(this.util.isUndefined(setting[field][key]))\r\n\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t setting[field][key] = config[key];\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if(fieldSetting[\"arrText\"] && fieldSetting[\"arrTextField\"])\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t var arrTextField = fieldSetting[\"arrTextField\"];\r\n\t\t\t\t\t\t\t var arrText = fieldSetting[\"arrText\"];\r\n\t\t\t\t\t\t\t var length = arrText.length;\r\n\t\t\t\t\t\t\t filter[field] = [];\r\n\t\t\t\t\t\t\t for(var count = 0;count < length;count++)\r\n\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t filter[field].push(arrText[count][arrTextField]);\r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:fieldSetting.caseSensitive,multiline:false,matchType:fieldSetting.matchType};\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t filter[field] = fieldSetting.text;\r\n\t\t\t\t\t\t\t setting[field] = {caseSensitive:fieldSetting.caseSensitive,multiline:false,matchType:fieldSetting.matchType};\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }\r\n\t\t\t\t }\r\n\t\t\t\t conditionFilter = Object.keys(filter);\r\n\t\t\t }\r\n\t\t\t var isReset = false;\r\n\t\t\t if(filter && conditionFilter && conditionFilter.length > 0)\r\n\t\t\t {\r\n\t\t\t\t this.__handleFiltering(filter,setting);\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t this.__resetFiltering();\r\n\t\t\t\t isReset = true;\r\n\t\t\t }\r\n\t\t\t this.__nsGrid.__callFunctionInsideGridType(\"afterFiltering\",isReset);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleFiltering = function(filter,setting,enableHighlighting,recordLimit)\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter)\r\n\t\t\t{\r\n\t\t\t\tvar eventParam = {filter:filter,setting:setting,recordLimit:recordLimit};\r\n\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.FILTER_CHANGING,eventParam,eventParam);\r\n\t\t\t\tthis.__filteredColumn = [];\r\n\t\t\t\tif(filter)\r\n\t\t\t    {\r\n\t\t\t\t\t if(this.util.isUndefinedOrNull(enableHighlighting))\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\tenableHighlighting = true;\r\n\t\t\t\t\t }\r\n\t\t\t\t\t var isHierarchical = false;\r\n\t\t\t\t\t var source = this.__nsGrid.__arrWrapper;\r\n\t\t\t\t\t if(this.__nsGrid.__enableHierarchical || this.__nsGrid.__enableGrouping || this.__nsGrid.__enableMasterDetail)\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t isHierarchical = true;\r\n\t\t\t\t\t }\r\n\t\t\t\t   \t var nsFilter = new NSFilter(source,filter,setting,recordLimit,isHierarchical,this.__nsGrid.__childField,\r\n\t\t\t\t   \t\t\t this.__nsGrid.__filterFunction,this.__nsGrid.__hierarchyFilterChildrenFunction,\r\n\t\t\t\t   \t\t\t (this.__nsGrid.__objGrid.__ignoreFieldsForDeepCopy && this.__nsGrid.__objGrid.__ignoreFieldsForDeepCopy())\r\n\t\t\t\t   \t );\r\n\t\t\t\t   \t this.__nsGrid.__arrInternalSource = nsFilter.execute();\r\n\t\t\t\t   \t this.__nsGrid.__arrFilteredGroupedSource =  this.__nsGrid.__arrInternalSource.slice(0);\r\n\t\t\t\t   \t if(enableHighlighting)\r\n\t\t\t\t   \t {\r\n\t\t\t\t\t   \t if(filter instanceof Array) \r\n\t\t\t\t  \t     {\r\n\t\t\t\t\t   \t\t for (var count = 0; count < filter.length; count++) \r\n\t\t\t\t\t         {\r\n\t\t\t\t\t \t   \t\tvar item = filter[count];\r\n\t\t\t\t\t \t   \t\tvar key = Object.keys(item)[0];\r\n\t\t\t\t\t \t   \t\tvar colItem = this.__nsGrid.__getColumnObjectByDataField(key);\r\n\t\t\t\t\t \t   \t\tthis.__filteredColumn.push({field:key,text:item[key],item:colItem});\r\n\t\t\t\t\t         }\r\n\t\t\t\t  \t     }\r\n\t\t\t\t  \t\t else if(typeof(filter) === \"object\") \r\n\t\t\t\t  \t     {\r\n\t\t\t\t  \t        for(var key in filter) \r\n\t\t\t\t  \t        {\r\n\t\t\t\t  \t        \tvar colItem = this.__nsGrid.__getColumnObjectByDataField(key);\r\n\t\t\t\t  \t        \tthis.__filteredColumn.push({field:key,text:filter[key],item:colItem});\r\n\t\t\t\t  \t        }\r\n\t\t\t\t  \t     }\r\n\t\t\t\t   \t }\r\n\t\t\t\t   \t if(isHierarchical)\r\n\t\t\t\t   \t {\r\n\t\t\t\t   \t\tthis.__nsGrid.__objGrid.__setWrapperSource(this.__nsGrid.__arrInternalSource,0,-1,0,false);\r\n\t\t\t\t   \t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0); \r\n\t\t\t\t   \t }\r\n\t\t\t\t   \t this.__nsGrid.__updateTotalRecords();\r\n\t\t\t\t   \t this.__nsGrid.__updateVisibleIndexByRow(this.__nsGrid.__arrInternalSource);\r\n\t\t\t\t   \t this.__nsGrid.__renderBody(false,true);\r\n\t\t\t\t   \t this.isFiltered = true;\r\n\t\t\t\t   \t this.__nsGrid.__dispatchEvent(NSGrid.FILTER_CHANGED,eventParam,eventParam);\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__resetFiltering = function()\r\n\t\t{\r\n\t\t\tif(this.__nsGrid.__enableFilter)\r\n\t\t\t{\r\n\t\t\t\tif(this.__nsGrid.__dataSource)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.FILTER_CHANGING,null,null);\r\n\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrWrapper.slice(0);\r\n\t\t\t\t\tthis.__nsGrid.__arrFilteredGroupedSource =  this.__nsGrid.__arrInternalSource.slice(0);\r\n\t\t\t\t\tthis.__filteredColumn = [];\r\n\t\t\t\t\tif(this.__nsGrid.__enableHierarchical || this.__nsGrid.__enableGrouping || this.__nsGrid.__enableMasterDetail)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__nsGrid.__objGrid.__setWrapperSource(this.__nsGrid.__arrInternalSource,0,-1,0,false);\r\n\t\t\t\t\t\tthis.__nsGrid.__arrInternalSource = this.__nsGrid.__arrFlatHierarchicalSource.slice(0); \r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__nsGrid.__updateTotalRecords();\r\n\t\t\t\t\tthis.__nsGrid.__updateVisibleIndexByRow(this.__nsGrid.__arrInternalSource);\r\n\t\t\t\t\tthis.__nsGrid.__renderBody(false,true);\r\n\t\t\t\t\tthis.isFiltered = false;\r\n\t\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.FILTER_CHANGED,null,null);\r\n\t\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.FILTER_RESETTED,null,null);\r\n\t\t\t\t\t//this.unHighlightText();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__highlightDiv = function(divText,colIndex)\r\n\t\t{\r\n\t\t\tvar length = this.__filteredColumn.length;\r\n\t\t\tfor (var count = 0; count < length; count++) \r\n\t\t    {\r\n\t\t\t\tvar item = this.__filteredColumn[count].item;\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar type = (item.filter && item.filter.type) ? item.filter.type : \"text\";\r\n\t\t\t\t\tif(type == \"text\" && item[this.__nsGrid.__fieldColIndex] === colIndex)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar text = this.__filteredColumn[count].text;\r\n\t\t\t\t\t\tthis.util.highlightText(divText,text,\"nsTextHighlight\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__documentClickHandler = function(event) \r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tthis.__removePopUp();\r\n\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.ADVANCED_FILTER_CLOSING);\r\n\t\t\t/*var target = this.util.getTarget(event);\r\n\t\t\tif(!(target && target.getAttribute(\"id\") && target.getAttribute(\"id\").endsWith(\"FilterIconContainer\")))\r\n\t\t\t{\r\n\t\t\t\tthis.__removePopUp();\r\n\t\t\t\tthis.util.preventDefault(event);\r\n\t\t\t}*/\r\n\t\t};\r\n\t\r\n\t\r\n\t\tthis.__documentKeyUpHandler = function(event) \r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tif(event.keyCode === this.util.KEYCODE.ESC) \r\n\t\t\t{\r\n\t\t\t\tthis.__removePopUp();\r\n\t\t\t\tthis.__nsGrid.__dispatchEvent(NSGrid.ADVANCED_FILTER_CLOSING);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__detailFilterClickHandler = function(event)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tevent.stopImmediatePropagation();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__removePopUp = function()\r\n\t\t{\r\n\t\t\tif(this.__nsPopUp)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsPopUp.remove();\r\n\t\t\t\tthis.__nsPopUp = null;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getTextDetailFilter = function(dataField,objFilter)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar txtInputChangeHandler = function()\r\n\t\t\t{\r\n\t\t\t\tclearTimeout(self.__interval);\r\n\t\t\t\tself.__interval = setTimeout(function(){\r\n\t\t\t\t\t\thandleTextFilter();\r\n\t\t\t\t\t}, self.SEARCH_INTERVAL);\r\n\t\t\t};\r\n\t\t\tvar handleTextFilter = function()\r\n\t\t\t{\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar text = null;\r\n\t\t\t\tif(txtFilter.value && txtFilter.value !== \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\ttext = txtFilter.value;\r\n\t\t\t\t\titem = {text:text,caseSensitive:chkSensitive.checked,matchType:arrOptions[cmbFilter.selectedIndex].value,sensitiveChecked:chkSensitive.checked,\r\n\t\t\t\t\t\t\toptionIndex:cmbFilter.selectedIndex,textInputText:txtFilter.value,type:NSGrid.ADVANCED_FILTER_TEXT};\r\n\t\t\t\t}\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = item;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tif(self.__enableApply)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__removePopUp();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar resetTextFilter = function()\r\n\t\t\t{\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tself.__removePopUp();\r\n\t\t\t};\r\n\t\t\tvar createSelect = function(arrSource,strID,prevField)\r\n\t\t\t{\r\n\t\t\t\tvar divSelect = self.util.createElement(\"span\",colID + strID + \"detailFilterSelectContainer\");\r\n\t\t\t\tvar cmbFilter = self.util.createElement(\"select\",colID + strID + \"detailFilterSelect\",\"nsFilterSelect\");\r\n\t\t\t\tcmbFilter.style.height = \"25px\";\r\n\t\t\t\tvar option = null;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar label = null;\r\n\t\t\t\tfor(var count = 0;count < arrSource.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrSource[count];\r\n\t\t\t\t\toption = document.createElement(\"option\");\r\n\t\t\t\t\tlabel = document.createTextNode(item[\"label\"]);\r\n\t\t\t\t\toption.appendChild(label);\r\n\t\t\t\t\toption.setAttribute(\"value\", item[\"id\"]);\r\n\t\t\t\t\tcmbFilter.appendChild(option);\r\n\t\t\t\t}\r\n\t\t\t\tif(objPrev && objPrev[prevField])\r\n\t\t\t\t{\r\n\t\t\t\t\tcmbFilter.selectedIndex = objPrev[prevField];\r\n\t\t\t\t}\r\n\t\t\t\tdivSelect.style.display = \"inline-block\";\r\n\t\t\t\tdivSelect.style.width = \"40%\";\r\n\t\t\t\tdivSelect.appendChild(cmbFilter);\r\n\t\t\t\tdivUpperContainer.appendChild(divSelect);\r\n\t\t\t\treturn cmbFilter;\r\n\t\t\t};\r\n\t\t\tvar createCheckbox = function(text,strID,prevField)\r\n\t\t\t{\r\n\t\t\t\tvar divCheckbox = self.util.createElement(\"span\",colID + strID + \"detailFilterCheckboxContainer\");\r\n\t\t\t\tvar label = self.util.createElement(\"label\",colID + strID + \"detailFilterLabel\",null);\r\n\t\t\t\tvar checkbox = self.util.createElement(\"input\",colID + strID + \"detailFilterCheckbox\",null);\r\n\t\t\t\tcheckbox.setAttribute(\"type\",\"checkbox\");\r\n\t\t\t\tlabel.appendChild(checkbox);\r\n\t\t\t\tif(text)\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel.appendChild(document.createTextNode(text));\r\n\t\t\t\t}\r\n\t\t\t\tif(objPrev && objPrev[prevField])\r\n\t\t\t\t{\r\n\t\t\t\t\tcheckbox.setAttribute(\"checked\",true);\r\n\t\t\t\t}\r\n\t\t\t\tlabel.style.fontWeight = \"400\";\r\n\t\t\t\tlabel.style.cursor = \"pointer\";\r\n\t\t\t\tcheckbox.style.marginRight = \"5px\";\r\n\t\t\t\tdivCheckbox.style.paddingTop = \"5px\";\r\n\t\t\t\tdivCheckbox.style.display = \"inline-block\";\r\n\t\t\t\tdivCheckbox.appendChild(label);\r\n\t\t\t\tdivLowerContainer.appendChild(divCheckbox);\r\n\t\t\t\treturn checkbox;\r\n\t\t\t};\r\n\t\t\tvar nsFilter = new NSFilter();\r\n\t\t\tvar arrOptions = [{id:1,label:\"Contains\",value:nsFilter.CONTAINS},\r\n\t\t\t                  {id:2,label:\"Exact\",value:nsFilter.EXACT},\r\n\t\t\t                  {id:3,label:\"Starts With\",value:nsFilter.STARTS_WITH},\r\n\t\t\t                  {id:4,label:\"Ends With\",value:nsFilter.ENDS_WITH}];\r\n\t\t\tvar objPrev = this.__objAdvancedFilterSetting[dataField];\r\n\t\t\tvar colID = this.__getRendererID(dataField);\r\n\t\t\tvar divDetailFilterContainer = this.__nsPopUp.getPopUp();\r\n\t\t\t//divDetailFilterContainer.style.width = \"275px\";\r\n\t\t\tdivDetailFilterContainer.style.padding = \"10px\";\r\n\t\t\tvar divUpperContainer = this.util.createDiv(colID + \"detailFilterUpperContainer\");\r\n\t\t\tdivUpperContainer.style.paddingBottom = \"8px\";\r\n\t\t\tvar divLowerContainer = this.util.createDiv(colID + \"detailFilterLowerContainer\");\r\n\t\t\tvar cmbFilter = createSelect(arrOptions,\"options\",\"optionIndex\");\r\n\t\t\tvar divTextInput = this.util.createElement(\"span\",colID + \"detailFilterTextInputContainer\");\r\n\t\t\tdivTextInput.style.float = \"right\";\r\n\t\t\tdivTextInput.style.width = \"60%\";\r\n\t\t\tvar txtFilter = this.util.createElement(\"input\",colID + \"detailFilterTextInput\",\"nsFilterTextInput\");\r\n\t\t\ttxtFilter.setAttribute(\"placeholder\", \"Enter Value here\");\r\n\t\t\ttxtFilter.style.width = \"100%\";\r\n\t\t\tif(objPrev && objPrev[\"textInputText\"])\r\n\t\t\t{\r\n\t\t\t\ttxtFilter.value = objPrev[\"textInputText\"];\r\n\t\t\t}\r\n\t\t\t//var divSearch = this.util.getSearchTextBox(txtFilter);\r\n\t\t\t//this.util.addStyleClass(divSearch,\"nsFilterSearchTextBox\");\r\n\t\t\tdivTextInput.appendChild(txtFilter);\r\n\t\t\tdivUpperContainer.appendChild(divTextInput);\r\n\t\t\tvar chkSensitive = createCheckbox(\"Case Sensitive\",\"sensitive\",\"sensitiveChecked\");\r\n\t\t\tif(this.__enableApply)\r\n\t\t\t{\r\n\t\t\t\tthis.__createApplySection.bind(this)(colID,divLowerContainer,handleTextFilter,resetTextFilter);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.addEvent(chkSensitive,\"click\",handleTextFilter);\r\n\t\t\t\tthis.util.addEvent(cmbFilter,\"change\",handleTextFilter);\r\n\t\t\t\tthis.util.addEvent(txtFilter,\"keyup\",txtInputChangeHandler);\r\n\t\t\t}\r\n\t\t\tdivDetailFilterContainer.appendChild(divUpperContainer);\r\n\t\t\tdivDetailFilterContainer.appendChild(divLowerContainer);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getNumberDetailFilter = function(dataField,objFilter)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar txtInputChangeHandler = function()\r\n\t\t\t{\r\n\t\t\t\tclearTimeout(self.__interval);\r\n\t\t\t\tself.__interval = setTimeout(function(){\r\n\t\t\t\t\t\thandleNumberFilter();\r\n\t\t\t\t\t}, self.SEARCH_INTERVAL);\r\n\t\t\t};\r\n\t\t\tvar handleNumberFilter = function()\r\n\t\t\t{\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar text = null;\r\n\t\t\t\tif(txtFilter.value && txtFilter.value !== \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\ttext = arrOptions[cmbFilter.selectedIndex].sign + txtFilter.value;\r\n\t\t\t\t\titem = {text:text,caseSensitive:false,matchType:new NSFilter().CONTAINS,index:cmbFilter.selectedIndex,textInputText:txtFilter.value,type:NSGrid.ADVANCED_FILTER_NUMBER};\r\n\t\t\t\t}\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = item;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tif(self.__enableApply)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__removePopUp();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar resetNumberFilter = function()\r\n\t\t\t{\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tself.__removePopUp();\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar arrOptions = [{id:1,label:\"<=\",toolTip:\"Less than Equals To\",sign:\"<=\"},\r\n\t\t\t                  {id:2,label:\">=\",toolTip:\"Greater than Equals To\",sign:\">=\"},\r\n\t\t\t                  {id:3,label:\"<\",toolTip:\"Less than\",sign:\"<\"},\r\n\t\t\t                  {id:4,label:\">\",toolTip:\"Greater than\",sign:\">\"},\r\n\t\t\t                  {id:5,label:\"=\",toolTip:\"Equals\",sign:\"\"}];\r\n\t\t\tvar objPrev = this.__objAdvancedFilterSetting[dataField];\r\n\t\t\tvar colID = this.__getRendererID(dataField);\r\n\t\t\tvar divDetailFilterContainer = this.__nsPopUp.getPopUp();\r\n\t\t\t//divDetailFilterContainer.style.width = \"225px\";\r\n\t\t\tdivDetailFilterContainer.style.padding = \"10px\";\r\n\t\t\tvar divUpperContainer = this.util.createDiv(colID + \"detailFilterUpperContainer\");\r\n\t\t\tdivUpperContainer.style.paddingBottom = \"8px\";\r\n\t\t\tvar divLowerContainer = this.util.createDiv(colID + \"detailFilterLowerContainer\");\r\n\t\t\tvar divSelect = this.util.createElement(\"span\",colID + \"detailFilterSelectContainer\");\r\n\t\t\tvar cmbFilter = this.util.createElement(\"select\",colID + \"detailFilterSelect\",\"nsFilterSelect\");\r\n\t\t\tcmbFilter.style.height = \"25px\";\r\n\t\t\tdivSelect.style.display = \"inline-block\";\r\n\t\t\tdivSelect.style.width = \"20%\";\r\n\t\t\tvar option = null;\r\n\t\t\tvar item = null;\r\n\t\t\tvar label = null;\r\n\t\t\tfor(var count = 0;count < arrOptions.length;count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrOptions[count];\r\n\t\t\t\toption = document.createElement(\"option\");\r\n\t\t\t\tlabel = document.createTextNode(item[\"label\"]);\r\n\t\t\t\toption.appendChild(label);\r\n\t\t\t\t//option.setAttribute(\"text\", item[\"label\"]);\r\n\t\t\t\toption.setAttribute(\"value\", item[\"id\"]);\r\n\t\t\t\tcmbFilter.appendChild(option);\r\n\t\t\t}\r\n\t\t\tif(objPrev && objPrev[\"index\"])\r\n\t\t\t{\r\n\t\t\t\tcmbFilter.selectedIndex = objPrev[\"index\"];\r\n\t\t\t}\r\n\t\t\tdivSelect.appendChild(cmbFilter);\r\n\t\t\tdivUpperContainer.appendChild(divSelect);\r\n\t\t\tvar divTextInput = this.util.createElement(\"span\",colID + \"detailFilterTextInputContainer\");\r\n\t\t\tvar txtFilter = this.util.createElement(\"input\",colID + \"detailFilterTextInput\",\"nsFilterTextInput\");\r\n\t\t\ttxtFilter.setAttribute(\"placeholder\", \"Enter Value here\");\r\n\t\t\tif(objPrev && objPrev[\"textInputText\"])\r\n\t\t\t{\r\n\t\t\t\ttxtFilter.value = objPrev[\"textInputText\"];\r\n\t\t\t}\r\n\t\t\tdivTextInput.style.float = \"right\";\r\n\t\t\tdivTextInput.style.width = \"80%\";\r\n\t\t\ttxtFilter.style.width = \"100%\";\r\n\t\t\tdivTextInput.appendChild(txtFilter);\r\n\t\t\tdivUpperContainer.appendChild(divTextInput);\r\n\t\t\tif(this.__enableApply)\r\n\t\t\t{\r\n\t\t\t\tthis.__createApplySection.bind(this)(colID,divLowerContainer,handleNumberFilter,resetNumberFilter);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.addEvent(cmbFilter,\"change\",handleNumberFilter);\r\n\t\t\t\tthis.util.addEvent(txtFilter,\"keyup\",txtInputChangeHandler);\r\n\t\t\t}\r\n\t\t\tdivDetailFilterContainer.appendChild(divUpperContainer);\r\n\t\t\tdivDetailFilterContainer.appendChild(divLowerContainer);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getListDetailFilter = function(dataField,objFilter)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar itemRenderer = function(item,labelField,fieldIndex,isDisabled,listItem)\r\n\t\t\t{\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divRenderer = self.util.createElement(\"span\",colID + \"filterListContainer\" + item[\"id\"] ,\"nsFilterListRenderer\");\r\n\t\t\t\t\tvar label = self.util.createElement(\"label\");\r\n\t\t\t\t\tvar checkBox = self.util.createElement(\"input\",null,\"nsFilterListRendererCheckBox\");\r\n\t\t\t\t\tcheckBox.setAttribute(\"type\",\"checkbox\");\r\n\t\t\t\t\tcheckBox.checked = Boolean.parse(item[\"selected\"]);\r\n\t\t\t\t\tthis.util.addEvent(checkBox,\"click\",checkBoxClickHandler);\r\n\t\t\t\t\tlabel.style.fontWeight = \"400\";\r\n\t\t\t\t\tlabel.style.cursor = \"pointer\";\r\n\t\t\t\t\tcheckBox.style.marginRight = \"5px\";\r\n\t\t\t\t\tlabel.appendChild(checkBox);\r\n\t\t\t\t\tlabel.appendChild(document.createTextNode(item[labelField]));\r\n\t\t\t\t\tdivRenderer.appendChild(label);\r\n\t\t\t\t\treturn divRenderer;\r\n\t\t\t\t}\r\n\t\t\t\treturn null;\r\n\t\t\t};\r\n\t\t\tvar txtInputChangeHandler = function()\r\n\t\t\t{\r\n\t\t\t\tclearTimeout(self.__interval);\r\n\t\t\t\tself.__interval = setTimeout(function(){\r\n\t\t\t\t\t\thandleListFilter(true);\r\n\t\t\t\t\t}, self.SEARCH_INTERVAL);\r\n\t\t\t};\r\n\t\t\tvar handleListFilter = function(isReset)\r\n\t\t\t{\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar text = null;\r\n\t\t\t\tvar text = txtFilter.value;\r\n\t\t\t\tif(text === \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tobjNSList.resetFilter();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar setting = {caseSensitive:false,multiline:false,matchType:new NSFilter().CONTAINS};\r\n\t\t\t\t\tobjNSList.filter(text,setting,true);\r\n\t\t\t\t}\r\n\t\t\t\tif(isReset)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrSelected = objNSList.__arrInternalSource;\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar checkBoxClickHandler = function(event)\r\n\t\t\t{\r\n\t\t\t\tvar target = self.util.getTarget(event);\r\n\t\t\t\tvar checked = target.checked;\r\n\t\t\t\ttarget = self.util.findParent(target,\"li\");\r\n\t\t\t\tvar source = objNSList.__arrInternalSource;\r\n\t\t\t\tvar index = objNSList.__getIndexFromTarget(target);\r\n\t\t\t\tif(index > -1)\r\n\t\t\t\t{\r\n\t\t\t\t\ttempItem = objNSList.__getItemByIndex(index);\r\n\t\t\t\t\tif(tempItem)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar selectedIndex = source.findIndex(findIndexfromSelectedArray);\r\n\t\t\t\t\t\tif(checked && selectedIndex > -1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrSelected.push(tempItem);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(!checked && selectedIndex > -1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfor(var count = 0;count < arrSelected.length;count++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif(arrSelected[count].id == selectedIndex)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tarrSelected.splice(count,1);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttempItem[\"selected\"] = checked;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetSelectAllCheckBox();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar chkSelectAllClickHandler = function(event)\r\n\t\t\t{\r\n\t\t\t\tif(arrSource)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar length = arrSource.length;\r\n\t\t\t\t\tvar checked = chkSelectAll.checked;\r\n\t\t\t\t\tvar source = objNSList.__arrInternalSource;\r\n\t\t\t\t\tvar item = null;\r\n\t\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem = arrSource[count];\r\n\t\t\t\t\t\titem[\"selected\"] = checked;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(source)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\titem = source[count];\r\n\t\t\t\t\t\t\titem[\"selected\"] = checked;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(checked)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrSelected = self.util.cloneObject(arrSource);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrSelected = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tobjNSList.__renderBody(false);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar setSelectAllCheckBox = function()\r\n\t\t\t{\r\n\t\t\t\tvar isAllSelected = isSelectedAll();\r\n\t\t\t\tvar isNoneSelected = isUnselectedAll();\r\n\t\t\t\tif(isAllSelected)\r\n\t\t\t\t{\r\n\t\t\t\t\tchkSelectAll.indeterminate = false;\r\n\t\t\t\t\tchkSelectAll.checked = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if(isNoneSelected)\r\n\t\t\t\t{\r\n\t\t\t\t\tchkSelectAll.indeterminate = false;\r\n\t\t\t\t\tchkSelectAll.checked = false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tchkSelectAll.indeterminate = true;\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar findIndexfromSelectedArray = function(element,index,array)\r\n\t\t\t{\r\n\t\t\t\treturn (element[\"id\"] === tempItem[\"id\"]);\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar isSelectedAll = function()\r\n\t\t\t{\r\n\t\t\t\tif(arrSource && arrSelected)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn (arrSource.length === arrSelected.length);\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar isUnselectedAll = function()\r\n\t\t\t{\r\n\t\t\t\tif(arrSelected)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn (arrSelected.length === 0);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar handleMainFilter = function()\r\n\t\t\t{\r\n\t\t\t\tvar arrTemp = [];\r\n\t\t\t\tif(arrSelected && arrSelected.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrSelected.length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(arrSelected[count][\"selected\"])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrTemp.push(arrSelected[count]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar item = {arrText:arrTemp,arrTextField:\"label\",caseSensitive:true,matchType:new NSFilter().EXACT,arrSelected:arrSelected,textInputText:txtFilter.value,type:NSGrid.ADVANCED_FILTER_LIST};\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = item;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tif(self.__enableApply)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__removePopUp();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar resetMainFilter = function()\r\n\t\t\t{\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tself.__removePopUp();\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar tempItem = null;\r\n\t\t\tvar objPrev = this.__objAdvancedFilterSetting[dataField];\r\n\t\t\tif(!objPrev)\r\n\t\t\t{\r\n\t\t\t\tobjPrev = {};\r\n\t\t\t}\r\n\t\t\tvar arrSelected = objPrev[\"arrSelected\"];\r\n\t\t\tvar arrSource = this.__getUniqueValues(this.__nsGrid.__objGrid.__getFlatSource(),dataField,arrSelected);\r\n\t\t\tif(!arrSelected)\r\n\t\t\t{\r\n\t\t\t\tarrSelected = this.util.cloneObject(arrSource);\r\n\t\t\t}\r\n\t\t\tvar colID = this.__getRendererID(dataField);\r\n\t\t\tvar divDetailFilterContainer = this.__nsPopUp.getPopUp();\r\n\t\t\t//divDetailFilterContainer.style.width = \"240px\";\r\n\t\t\tdivDetailFilterContainer.style.padding = \"10px\";\r\n\t\t\tvar divUpperContainer = this.util.createDiv(colID + \"detailFilterUpperContainer\");\r\n\t\t\tdivUpperContainer.style.paddingBottom = \"8px\";\r\n\t\t\tvar divLowerContainer = this.util.createDiv(colID + \"detailFilterLowerContainer\");\r\n\t\t\tvar divTextInput = this.util.createDiv(colID + \"detailFilterTextInputContainer\",\"nsFilterLineContainer\");\r\n\t\t\tthis.util.addStyleClass(divTextInput,\"nsFilterLineContainerTheme\");\r\n\t\t\tdivTextInput.setAttribute(\"style\",\"height:29px;\");\r\n\t\t\tvar txtFilter = this.util.createElement(\"input\",colID + \"detailFilterTextInput\",\"nsFilterTextInput\");\r\n\t\t\ttxtFilter.setAttribute(\"placeholder\", \"Enter Value here\");\r\n\t\t\ttxtFilter.style.width = \"100%\";\r\n\t\t\tif(objPrev[\"textInputText\"])\r\n\t\t\t{\r\n\t\t\t\ttxtFilter.value = objPrev[\"textInputText\"];\r\n\t\t\t}\r\n\t\t\tthis.util.addEvent(txtFilter,\"keyup\",txtInputChangeHandler);\r\n\t\t\tdivTextInput.appendChild(txtFilter);\r\n\t\t\tdivUpperContainer.appendChild(divTextInput);\r\n\t\t\tdivDetailFilterContainer.appendChild(divUpperContainer);\r\n\t\t\tdivDetailFilterContainer.appendChild(divLowerContainer);\r\n\t\t\tvar divList = this.util.createDiv(colID + \"detailFilterListContainer\");\r\n\t\t\tvar lstFilter = this.util.createElement(\"div\",colID + \"detailFilterList\",\"nsFilterList\");\r\n\t\t\tlstFilter.style.height = \"300px\";\r\n\t\t\tdivList.appendChild(lstFilter);\r\n\t\t\tdivUpperContainer.appendChild(divList);\r\n\t\t\tvar setting = {labelField:\"label\",enableVirtualScroll:false,enableDragDrop:false,enableDragByHandle:false,enableMultipleSelection:true,enableKeyboardNavigation:false,\r\n\t\t\t\t\t\t   customScrollerRequired:false,enableMouseHover:true,enableMouseHoverAnimation:false,itemRenderer:itemRenderer.bind(this)};\r\n\t\t\tsetting[\"dataSource\"] = arrSource;\r\n\t\t\tvar objNSList = new NSList(lstFilter,setting);\r\n\t\t\t\r\n\t\t\tvar divSelectAll = this.util.createElement(\"span\",colID + \"detailFilterSelectAllContainer\",\"nsFilterLineContainer\");\r\n\t\t\tthis.util.addStyleClass(divSelectAll,\"nsFilterLineContainerTheme\");\r\n\t\t\tvar label = self.util.createElement(\"label\");\r\n\t\t\tvar chkSelectAll = self.util.createElement(\"input\",null,\"nsFilterListRendererCheckBox\");\r\n\t\t\tchkSelectAll.setAttribute(\"type\",\"checkbox\");\r\n\t\t\tthis.util.addEvent(chkSelectAll,\"click\",chkSelectAllClickHandler);\r\n\t\t\tlabel.appendChild(chkSelectAll);\r\n\t\t\tlabel.appendChild(document.createTextNode(\"Select All\"));\r\n\t\t\tlabel.style.fontWeight = \"400\";\r\n\t\t\tlabel.style.cursor = \"pointer\";\r\n\t\t\tchkSelectAll.style.marginRight = \"5px\";\r\n\t\t\tdivSelectAll.style.paddingTop = \"5px\";\r\n\t\t\tdivSelectAll.style.display = \"inline-block\";\r\n\t\t\tdivSelectAll.appendChild(label);\r\n\t\t\tdivLowerContainer.appendChild(divSelectAll);\r\n\t\t\tif(this.__enableApply)\r\n\t\t\t{\r\n\t\t\t\tthis.__createApplySection.bind(this)(colID,divLowerContainer,handleMainFilter,resetMainFilter);\r\n\t\t\t}\r\n\t\t\thandleListFilter(false);\r\n\t\t\tsetSelectAllCheckBox();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getDateDetailFilter = function(dataField,objFilter)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tthis.__setDefaultDatePicker();\r\n\t\t\tvar arrOptions = [{text:\"Equals\",value:\"equals\"},\r\n\t\t\t                  {text:\"Greater than\",value:\"greaterThan\"},\r\n\t\t\t                  {text:\"Less than\",value:\"lessThan\"},\r\n\t\t\t                  {text:\"Not equal\",value:\"notEqual\"}];\r\n\t\t\tvar arrOptOption = [{text:\"And\",value:\"and\"},\r\n\t\t\t                  {text:\"OR\",value:\"or\"}];\r\n\t\t\tvar createSelect = function(id,css)\r\n\t\t\t{\r\n\t\t\t\tvar select =  self.util.createElement(\"select\",id,css);\r\n\t\t\t\tfor(var count = 0;count < arrOptions.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = arrOptions[count];\r\n\t\t\t\t\tvar option = self.util.createElement(\"option\");\r\n\t\t\t\t\toption.setAttribute(\"value\", item.value);\r\n\t\t\t\t\tvar text = document.createTextNode(item.text);\r\n\t\t\t\t\toption.appendChild(text);\r\n\t\t\t\t\tselect.appendChild(option);\r\n\t\t\t\t}\r\n\t\t\t\treturn select;\r\n\t\t\t};\r\n\t\t\tvar handleMainFilter = function()\r\n\t\t\t{\r\n\t\t\t\tvar item = {type:NSGrid.ADVANCED_FILTER_DATE,selectFirst:selectFirst,firstSelectIndex:selectFirst.selectedIndex,firstSelectValue:selectFirst.options[selectFirst.selectedIndex].value,\r\n\t\t\t\t\t\t\tcompFirstDate:compFirstDate,firstDate:compFirstDate.getDate(),\r\n\t\t\t\t\t\t\toperationSelect:select,operationSelectedIndex:select.selectedIndex,operationSelectValue:select.options[select.selectedIndex].value,\r\n\t\t\t\t\t\t\tselectSecond:selectSecond,secondSelectIndex:selectSecond.selectedIndex,secondSelectValue:selectSecond.options[selectSecond.selectedIndex].value,\r\n\t\t\t\t\t\t\tcompSecondDate:compSecondDate,secondDate:compSecondDate.getDate(),config:dateConfig,\r\n\t\t\t\t\t\t\tdivUpperContainer:divUpperContainer,divLowerContainer:divLowerContainer\r\n\t\t\t\t\t\t};\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = item;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tif(self.__enableApply)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__removePopUp();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tvar resetMainFilter = function()\r\n\t\t\t{\r\n\t\t\t\tself.__objAdvancedFilterSetting[dataField] = null;\r\n\t\t\t\tself.__advanceFilterGrid.bind(self)();\r\n\t\t\t\tself.__removePopUp();\r\n\t\t\t};\r\n\t\t\tvar divDetailFilterContainer = this.__nsPopUp.getPopUp();\r\n\t\t\tdivDetailFilterContainer.style.padding = \"10px\";\r\n\t\t\tvar dateConfig = objFilter[\"advancedFilterConfig\"] || {};\r\n\t\t\tvar filterConfig = objFilter[\"config\"] || {};\r\n\t\t\tfor(var key in filterConfig)\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isUndefined(dateConfig[key]))\r\n\t\t\t\t{\r\n\t\t\t\t\tdateConfig[key] = filterConfig[key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdateConfig[\"filterManually\"] = this.__enableApply;\r\n\t\t\tvar objPrev = this.__objAdvancedFilterSetting[dataField];\r\n\t\t\tif(objPrev)\r\n\t\t\t{\r\n\t\t\t\tvar divUpperContainer = objPrev.divUpperContainer;\r\n\t\t\t\tvar divLowerContainer = objPrev.divLowerContainer;\r\n\t\t\t\tvar selectFirst = objPrev.selectFirst;\r\n\t\t\t\tselectFirst.selectedIndex = objPrev.firstSelectIndex;\r\n\t\t\t\tvar compFirstDate = objPrev.compFirstDate;\r\n\t\t\t\tcompFirstDate.setDate(objPrev.firstDate);\r\n\t\t\t\tvar select = objPrev.operationSelect;\r\n\t\t\t\tselect.selectedIndex = objPrev.operationSelectedIndex;\r\n\t\t\t\tvar selectSecond = objPrev.selectSecond;\r\n\t\t\t\tselectSecond.selectedIndex = objPrev.secondSelectIndex;\r\n\t\t\t\tvar compSecondDate = objPrev.compSecondDate;\r\n\t\t\t\tcompSecondDate.setDate(objPrev.secondDate);\r\n\t\t\t\tdivDetailFilterContainer.appendChild(divUpperContainer);\r\n\t\t\t\tdivDetailFilterContainer.appendChild(divLowerContainer);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t/*if(!objPrev)\r\n\t\t\t\t{\r\n\t\t\t\t\tobjPrev = {};\r\n\t\t\t\t}*/\r\n\t\t\t\tvar colID = this.__getRendererID(dataField);\r\n\t\t\t\tvar divUpperContainer = this.util.createDiv(colID + \"detailFilterUpperContainer\");\r\n\t\t\t\tdivUpperContainer.style.paddingBottom = \"8px\";\r\n\t\t\t\tvar divLowerContainer = this.util.createDiv(colID + \"detailFilterLowerContainer\");\r\n\t\t\t\tvar divFirstSelect = this.util.createDiv(colID + \"detailFirstSelectContainer\",\"nsGridFilterFirstSelectContainer\");\r\n\t\t\t\tthis.util.addStyleClass(divFirstSelect,\"nsGridFilterFirstSelectContainerTheme\");\r\n\t\t\t\t//divFirstSelect.setAttribute(\"style\",\"height:29px;\");\r\n\t\t\t\tvar selectFirst =  createSelect(colID + \"detailFirstSelect\",\"nsGridFilterFirstSelect\");\r\n\t\t\t\tdivFirstSelect.appendChild(selectFirst);\r\n\t\t\t\tdivUpperContainer.appendChild(divFirstSelect);\r\n\t\t\t\t//selectFirst.selectedIndex = this.util.isUndefinedOrNull(objPrev.firstSelectIndex) ? 0 : objPrev.firstSelectIndex;\r\n\t\t\t\t\r\n\t\t\t\tvar divFirstDate = this.util.createDiv(colID + \"detailFirstDateContainer\",\"nsGridFilterFirstDateContainer\");\r\n\t\t\t\tthis.util.addStyleClass(divFirstDate,\"nsGridFilterFirstDateContainerTheme\");\r\n\t\t\t\tdivUpperContainer.appendChild(divFirstDate);\r\n\t\t\t\tvar compFirstDate = new this.__nsGrid.__components[\"datePicker\"]();\r\n\t\t\t\tthis.dateRenderer(compFirstDate,dataField,divFirstDate,dateConfig,objFilter);\r\n\t\t\t\t\r\n\t\t\t\tvar divOption = this.util.createDiv(colID + \"detailOptionContainer\",\"nsGridFilterOptionContainer\");\r\n\t\t\t\tthis.util.addStyleClass(divOption,\"nsGridFilterOptionContainerTheme\");\r\n\t\t\t\tvar select =  this.util.createElement(\"select\",null,\"nsGridFilterOptOption\");\r\n\t\t\t\tfor(var count = 0;count < arrOptOption.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = arrOptOption[count];\r\n\t\t\t\t\tvar option = this.util.createElement(\"option\");\r\n\t\t\t\t\toption.setAttribute(\"value\", item.value);\r\n\t\t\t\t\tvar text = document.createTextNode(item.text);\r\n\t\t\t\t\toption.appendChild(text);\r\n\t\t\t\t\tselect.appendChild(option);\r\n\t\t\t\t}\r\n\t\t\t\tdivOption.appendChild(select);\r\n\t\t\t\tdivUpperContainer.appendChild(divOption);\r\n\t\t\t\t//select.selectedIndex = this.util.isUndefinedOrNull(objPrev.operationSelectedIndex) ? 0 : objPrev.operationSelectedIndex;\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tvar divSecondSelect = this.util.createDiv(colID + \"detailSecondSelectContainer\",\"nsGridFilterSecondSelectContainer\");\r\n\t\t\t\tthis.util.addStyleClass(divSecondSelect,\"nsGridFilterSecondSelectContainerTheme\");\r\n\t\t\t\t//divSecondSelect.setAttribute(\"style\",\"height:29px;\");\r\n\t\t\t\tvar selectSecond =  createSelect(colID + \"detailSecondSelect\",\"nsGridFilterSecondSelect\");\r\n\t\t\t\tdivSecondSelect.appendChild(selectSecond);\r\n\t\t\t\tdivUpperContainer.appendChild(divSecondSelect);\r\n\t\t\t\t//selectSecond.selectedIndex = this.util.isUndefinedOrNull(objPrev.secondSelectIndex) ? 0 : objPrev.secondSelectIndex;\r\n\t\t\t\t\r\n\t\t\t\tvar divSecondDate = this.util.createDiv(colID + \"detailSecondDateContainer\",\"nsGridFilterSecondDateContainer\");\r\n\t\t\t\tthis.util.addStyleClass(divSecondDate,\"nsGridFilterSecondDateContainerTheme\");\r\n\t\t\t\tdivUpperContainer.appendChild(divSecondDate);\r\n\t\t\t\tvar compSecondDate = new this.__nsGrid.__components[\"datePicker\"]();\r\n\t\t\t\tthis.dateRenderer(compSecondDate,dataField,divSecondDate,dateConfig,objFilter);\r\n\t\t\t\tdivDetailFilterContainer.appendChild(divUpperContainer);\r\n\t\t\t\tdivDetailFilterContainer.appendChild(divLowerContainer);\r\n\t\t\t\tif(this.__enableApply)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__createApplySection.bind(this)(colID,divLowerContainer,handleMainFilter,resetMainFilter);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createApplySection = function(colID,parent,applyClickHandler,resetClickHandler)\r\n\t\t{\r\n\t\t\tvar divApplyButton = this.util.createDiv(colID + \"detailFilterApplyButtonContainer\",\"nsFilterButtonDiv\");\r\n\t\t\tthis.util.addStyleClass(divApplyButton,\"nsFilterButtonDivTheme\");\r\n\t\t\tvar btnFilter = this.util.createElement(\"button\",colID + \"detailFilterApply\",\"nsFilterButton\");\r\n\t\t\tthis.util.addStyleClass(btnFilter,\"nsButton\");\r\n\t\t\tthis.util.addStyleClass(btnFilter,\"nsButtonGreen\");\r\n\t\t\tthis.util.addStyleClass(btnFilter,\"nsButtonShadow\");\r\n\t\t\tthis.util.addStyleClass(btnFilter,\"nsButtonFont12\");\r\n\t\t\tbtnFilter.innerHTML = \"Filter\";\r\n\t\t\tdivApplyButton.appendChild(btnFilter);\r\n\t\t\tvar btnCancel = this.util.createElement(\"button\",colID + \"detailFilterReset\",\"nsFilterButton\");\r\n\t\t\tthis.util.addStyleClass(btnCancel,\"nsButton\");\r\n\t\t\tthis.util.addStyleClass(btnCancel,\"nsButtonGrey\");\r\n\t\t\tthis.util.addStyleClass(btnCancel,\"nsButtonShadow\");\r\n\t\t\tthis.util.addStyleClass(btnCancel,\"nsButtonFont12\");\r\n\t\t\tbtnCancel.innerHTML = \"Cancel\";\r\n\t\t\tdivApplyButton.appendChild(btnCancel);\r\n\t\t\tdivApplyButton.style.float = \"right\";\r\n\t\t\tparent.appendChild(divApplyButton);\r\n\t\t\tthis.util.addEvent(btnFilter,\"click\",applyClickHandler);\r\n\t\t\tthis.util.addEvent(btnCancel,\"click\",resetClickHandler);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getRendererID = function(dataField)\r\n\t\t{\r\n\t\t\treturn (this.__nsGrid.getID() + \"col\" + dataField + \"renderer\");\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getUniqueValues = function(arrSource,dataField,arrSelected)\r\n\t\t{\r\n\t\t\tvar findItem = function(element, index, array) \r\n\t\t\t{\r\n\t\t\t\treturn (item[\"value\"] === element[\"value\"]);\r\n\t\t\t};\r\n\t\t\tvar arrReturn = null;\r\n\t\t\tvar item = {};\r\n\t\t\tif(arrSource && arrSource.length > 0 && dataField)\r\n\t\t\t{\r\n\t\t\t\tvar objMap = {};\r\n\t\t\t\tvar value = \"\";\r\n\t\t\t\tvar length = arrSource.length;\r\n\t\t\t\tvar count = 0;\r\n\t\t\t\tvar arrTemp = [];\r\n\t\t\t\tvar itemPrev = {};\r\n\t\t\t\tarrReturn = [];\r\n\t\t\t    for(count = 0; count < length;count++)\r\n\t\t\t    {\r\n\t\t\t    \tvalue = arrSource[count][dataField];\r\n\t\t\t    \tif(value)\r\n\t\t\t    \t{\r\n\t\t\t    \t\tobjMap[value] = value;\r\n\t\t\t    \t}\r\n\t\t\t    }\r\n\t\t\t    arrTemp = Object.keys(objMap);\r\n\t\t\t    length = arrTemp.length;\r\n\t\t\t    if(length > 0)\r\n\t\t\t    {\r\n\t\t\t    \tfor(count = 0; count < length;count++)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tvalue = arrTemp[count];\r\n\t\t\t\t    \titem = {id:count,label:value,value:value,selected:true};\r\n\t\t\t\t    \t//if arrSelected is present and then item is not found then it is unselected\r\n\t\t\t\t    \t//if arrSelected is not present then all Items are selected\r\n\t\t\t\t    \tif(arrSelected)\r\n\t\t\t\t    \t{\r\n\t\t\t\t    \t\titemPrev = arrSelected.find(findItem);\r\n\t\t\t\t    \t\tif(itemPrev)\r\n\t\t\t\t    \t\t{\r\n\t\t\t\t    \t\t\titem[\"selected\"] = itemPrev[\"selected\"];\r\n\t\t\t\t    \t\t}\r\n\t\t\t\t    \t\telse\r\n\t\t\t\t    \t\t{\r\n\t\t\t\t    \t\t\titem[\"selected\"] = false;\r\n\t\t\t\t    \t\t}\r\n\t\t\t\t    \t}\r\n\t\t\t\t    \tarrReturn.push(item);\r\n\t\t\t\t    }\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\treturn arrReturn;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setDefaultDatePicker = function()\r\n\t\t{\r\n\t\t\tif(!this.__nsGrid.__components)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGrid.__components = {};\r\n\t\t\t}\r\n\t\t\tif(!this.__nsGrid.__components[\"datePicker\"])\r\n\t\t\t{\r\n\t\t\t\tvar dateComp = function()\r\n\t\t\t\t{\r\n\t\t\t\t\tvar setting = null;\r\n\t\t\t\t\tvar div = null;\r\n\t\t\t\t\tvar objDate = null;\r\n\t\t\t\t    var self = this;\r\n\t\t\t\t    var util = new NSUtil();\r\n\t\t\t\t    \r\n\t\t\t\t    var init = function(config) \r\n\t\t\t\t    {\r\n\t\t\t\t\t\tsetting = getParam(config);\r\n\t\t\t\t\t\tif(!setting)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tsetting = {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tsetting.dateOutputFormat = setting.dateOutputFormat ? setting.dateOutputFormat : \"MM/dd/yyyy\";\r\n\t\t\t\t\t\t//setting.placeHolder = setting.placeHolder ? setting.placeHolder : setting.dateOutputFormat;\r\n\t\t\t\t\t\tdiv = util.createDiv(null,\"nsGridDatePicker\"); \r\n\t\t\t\t\t\t//div.style.width = \"90%\";\r\n\t\t\t\t\t\tdiv.style.display = \"inline-block\";\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var getElement = function()\r\n\t\t\t\t    {\r\n\t\t\t\t    \treturn div;\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var elementAdded = function()\r\n\t\t\t\t    {\r\n\t\t\t\t    \tobjDate = new NSDatePicker(div,setting);\r\n\t\t\t\t\t\tutil.addEvent(div,NSDatePicker.DATE_SELECTED,function(event)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdateSelected(event.detail,false);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tutil.addEvent(div,NSDatePicker.INPUT_CHANGE,function(event)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdateSelected(event.detail,true);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var dateSelected = function(date,isType)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tif(util.isUndefinedOrNull(setting.filterManually) || !setting.filterManually)\r\n\t\t\t\t    \t{\r\n\t\t\t\t    \t\tsetting.dateSelectedHandler(isType);\r\n\t\t\t\t    \t}\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var getDate = function()\r\n\t\t\t\t    {\r\n\t\t\t\t    \treturn objDate.getSelectedDate();\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var setDate = function(date,fireEvent)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tobjDate.setSelectedDate(date,null,false);\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    var getParam = function(param)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tif(!param)\r\n\t\t\t\t    \t{\r\n\t\t\t\t    \t\tparam = {};\r\n\t\t\t\t    \t}\r\n\t\t\t\t    \t/*param = {\r\n\t\t\t\t    \t\tcssClass: param.cssClass || null,\r\n\t\t\t\t    \t};*/\r\n\t\t\t\t    \treturn param;\r\n\t\t\t\t    };\r\n\t\t\t\t    \r\n\t\t\t\t    self.init = init;\r\n\t\t\t\t    self.getElement = getElement;\r\n\t\t\t\t    self.elementAdded = elementAdded;\r\n\t\t\t\t    self.getDate = getDate;\r\n\t\t\t\t    self.setDate = setDate;\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t\tthis.__nsGrid.__components[\"datePicker\"] = dateComp;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__injectInNSGrid = function()\r\n\t\t{\r\n\t\t\tNSGrid.FILTER_TYPE_DATE = \"date\";\r\n\t\t\tNSGrid.ADVANCED_FILTER_TEXT = \"text\";\r\n\t\t\tNSGrid.ADVANCED_FILTER_NUMBER = \"number\";\r\n\t\t\tNSGrid.ADVANCED_FILTER_LIST = \"list\";\r\n\t\t\tNSGrid.ADVANCED_FILTER_DATE = \"date\";\r\n\t\t};\r\n\t\tthis.__initialize();\r\n\t};\r\n\treturn NSGridFilter;\r\n})();\r\nnsModuleExport(this,\"NSGridFilter\",NSGridFilter);var NSList = (function()\r\n{\r\n\tfunction NSList(component,setting) \r\n\t{\r\n\t\t//this.base.call(this);\r\n\t\tthis.ITEM_SELECTED = \"itemSelected\";\r\n\t\tthis.ITEM_UNSELECTED = \"itemUnselected\";\r\n\t\tthis.ITEM_NAVIGATED = \"itemNavigated\";\r\n\t\tthis.NAVIGATION_UP = \"up\";\r\n\t\tthis.NAVIGATION_DOWN = \"down\";\r\n\t\tthis.ITEM_DROPPING = \"itemDropping\";\r\n\t\tthis.ITEM_DROPPED = \"itemDropped\";\r\n\t\tthis.DRAG_STARTED = \"dragStarted\";\r\n\t\tthis.DRAGGING = \"dragging\";\r\n\t\tthis.DRAG_END = \"dragEnd\";\r\n\t\t\r\n\t\tthis.__setting = setting;\r\n\t\tthis.__dataSource = null;\r\n\t\tthis.__labelField = \"label\";\r\n\t\tthis.__itemRenderer = null;\r\n\t\tthis.__templateID = null;\r\n\t\tthis.__setData = null;\r\n\t\tthis.__labelFunction = null;\r\n\t\tthis.__enableHierarchical = false;\r\n\t\tthis.__enableMouseHover = false;\r\n\t\tthis.__enableMouseHoverAnimation = false;\r\n\t\tthis.__disableHoverField = null;\r\n\t\tthis.__disableHoverFunction = null;\r\n\t\tthis.__enableKeyboardNavigation = false;\r\n\t\tthis.__enableMultipleSelection = false;\r\n\t\tthis.__enableCustomScrollBar = false;\r\n\t\tthis.__enableVirtualScroll = false;\r\n\t\tthis.__isDraggable = true;\r\n\t\tthis.__isDroppable = true;\r\n\t\tthis.__enableDragByHandle = false;\r\n\t\tthis.__dragHandlerClass = null;\r\n\t\tthis.__enableDragAfterHold = false;\r\n\t\tthis.__holdTime = 500;\r\n\t\tthis.__enableCloneMode = false;\r\n\t\tthis.__rowHeight = -1;\r\n\t\tthis.__noDataMessage = \"No matching records found\";\r\n\t\tthis.__enableContextMenu = false;\r\n\t\tthis.__enableVariableRowHeight = false;\r\n\t\tthis.__contextMenuProvider = null;\r\n\t\tthis.__contextMenuSetting = null;\r\n\t\tthis.__enableTruncateToFit = false;\r\n\t\tthis.__toolTipField = null;\r\n\t\tthis.__enableToolTipForTruncateText = false;\r\n\t\tthis.__toolTipRenderer = null;\r\n\t\t\r\n\t\tthis.__arrWrapper = null;\r\n\t\tthis.__arrInternalSource = null;\r\n\t\tthis.__arrFlatHierarchicalSource = [];\r\n\t\t\r\n\t\tthis.__divOuterContainer = null;\r\n\t\tthis.__divParentContainer = null;\r\n\t\tthis.__listContainer = null;\r\n\t\tthis.__scroller = null;\r\n\t\tthis.__scrollerSetting = {};\r\n\t\tthis.__customScrollBarSetting = {};\r\n\t\tthis.__customScrollBarTooltip = null;\r\n\t\t\r\n\t\tthis.__template = null;\r\n\t\tthis.__currentIndex = -1;\r\n\t\tthis.__selectedIndex = -1;\r\n\t\tthis.__navigationIndex = -1;\r\n\t\tthis.__selectedItem = null;\r\n\t\tthis.__selectedItems = [];\t\r\n\t\tthis.__selectedIndexes = [];\r\n\t\tthis.__lastNavigationDirection = null;\r\n\t\tthis.__orignalItemKey = [];\r\n\t\t//for keyboard navigation\r\n\t\tthis.__pageSize = 0;\r\n\t\tthis.__scrollTarget = null;\r\n\t\tthis.__startArrayElement = -1;\r\n\t\tthis.__listItemHeight = 0;\r\n\t\t//for Virtual Scroll\r\n\t\tthis.__virtualScrollSetting = {};\r\n\t\tthis.__nsVirtualScroll = null; \r\n\t\tthis.__virtualRowHeight = 0;\r\n\t\t\r\n\t\tthis.__childField = \"children\";\r\n\t\tthis.__CLASS_GROUP_CELL = \"nsListGroupCell\";\r\n\t\tthis.__CLASS_CELL_CHILD = \"nsListCellChild\";\r\n\t\t\r\n\t\t//removing this.getID() as prefix as move functionality from one list to another would have different fields.\r\n\t\tthis.__fieldPrefix = \"ns_field\";\r\n\t\tthis.__fieldIndex =  this.__fieldPrefix + \"_item_index\";\r\n\t\tthis.__fieldVisibleIndex = this.__fieldPrefix + \"_item_visible_index\";\r\n\t\tthis.__fieldItem = this.__fieldPrefix + \"_item\";\r\n\t\tthis.__fieldDisableHover = this.__fieldPrefix + \"_disableHover\";\r\n\t\tthis.__fieldSelected = this.__fieldPrefix + \"_selected\";\r\n\t\tthis.__fieldHover = this.__fieldPrefix + \"_hover\";\r\n\t\t\r\n\t\tthis.__fieldItemLevel = this.__fieldPrefix + \"_item_level\";\r\n\t\tthis.__fieldItemVisible = this.__fieldPrefix + \"_item_visible\";\r\n\t\tthis.__fieldParentIndex = this.__fieldPrefix + \"_parent_index\";\r\n\t\tthis.__fieldHasChild = this.__fieldPrefix + \"_item_hasChild\";\r\n\t\tthis.__fieldHasParent = this.__fieldPrefix + \"_item_hasParent\";\r\n\t\tthis.__fieldIsCollapsed = this.__fieldPrefix + \"_item_isCollapsed\";\r\n\t\tthis.__fieldItemArrow = this.__fieldPrefix + \"_item_arrow\";\r\n\t\t\r\n\t\tthis.__isShiftPressed = false;\r\n\t\tthis.__isCtrlPressed = false;\r\n\t\t\r\n\t\tthis.__objGrid = null;\r\n\t\tthis.__nsListFilter = null;\r\n\t\tthis.__nsListDragDrop = null;\r\n\t\tthis.__nsToolTipInElement = null;\r\n\t\t\r\n\t\tthis.__keyDownRef = null;\r\n\t\tthis.__keyUpRef = null;\r\n\t\tthis.base.__setBaseComponent.call(this,component);\r\n\t};\r\n\tnsExtendPrototype(NSContainerBase,NSList);\r\n\tNSList.prototype.constructor = NSList;\r\n\t\r\n\tNSList.prototype.initializeComponent = function() \r\n\t{\r\n\t\tthis.base.initializeComponent.call(this);\r\n\t\tthis.__setSetting();\r\n\t\tthis.__initializePluggins();\r\n\t};\r\n\t\r\n\tNSList.prototype.setComponentProperties = function() \r\n\t{\r\n\t\tthis.base.setComponentProperties.call(this);\r\n\t\tthis.__objGrid.__addSVGInPage();\r\n\t\tthis.__setTemplate();\r\n\t\tthis.__objGrid.__initialize();\r\n\t\tthis.__addListenerForBody();\r\n\t\tif(this.__dataSource)\r\n\t\t{\r\n\t\t\tthis.dataSource(this.__dataSource);\r\n\t\t}\r\n\t\tif(!window[\"nsListMap\"])\r\n\t\t{\r\n\t\t\twindow[\"nsListMap\"] = {};\r\n\t\t}\r\n\t\twindow[\"nsListMap\"][this.getID()] = this;\r\n\t};\r\n\t\r\n\tNSList.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty)\r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t\tthis.base.propertyChange.call(this,attrName, oldVal, newVal, setProperty);\r\n\t};\r\n\t\r\n\tNSList.prototype.removeComponent = function() \r\n\t{\r\n\t\tif(this.__keyDownRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document,\"keydown\",this.__keyDownRef);\r\n\t\t\tthis.__keyDownRef = null;\r\n\t\t}\r\n\t\tif(this.__keyUpRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document,\"keyup\",this.__keyUpRef);\r\n\t\t\tthis.__keyUpRef = null;\r\n\t\t}\r\n\t\tif(this.__scroller)\r\n\t\t{\r\n\t\t\tthis.__scroller.__destroyElements();\r\n\t\t\tthis.__scroller = null;\r\n\t\t}\r\n\t\tthis.base.removeComponent.call(this);\r\n\t};\r\n\t\r\n\tNSList.prototype.componentResized = function(event) \r\n\t{\r\n\t\tthis.base.componentResized.call(this,event);\r\n\t};\r\n\t\r\n\tNSList.prototype.expandAll = function()\r\n\t{\r\n\t\tif(this.__enableHierarchical)\r\n\t\t{\r\n\t\t\tthis.__expandCollapseAll(false);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.collapseAll = function()\r\n\t{\r\n\t\tif(this.__enableHierarchical)\r\n\t\t{\r\n\t\t\tthis.__expandCollapseAll(true);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.setContextMenuSetting = function(contextMenuSetting)\r\n\t{\r\n\t\tthis.__contextMenuSetting = contextMenuSetting;\r\n\t};\r\n\t\r\n\tNSList.prototype.__setSetting = function()\r\n\t{\r\n\t\tvar setting = this.__setting;\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(setting.hasOwnProperty(\"enableHierarchical\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableHierarchical = Boolean.parse(setting[\"enableHierarchical\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableVirtualScroll\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVirtualScroll = Boolean.parse(setting[\"enableVirtualScroll\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableDragDrop\"))\r\n\t\t\t{\r\n\t\t\t\tif(!this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__enableDragDrop = Boolean.parse(setting[\"enableDragDrop\"]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"isDraggable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__isDraggable = Boolean.parse(setting[\"isDraggable\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"isDroppable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__isDroppable = Boolean.parse(setting[\"isDroppable\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableDragByHandle\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableDragByHandle = Boolean.parse(setting[\"enableDragByHandle\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"dragHandlerClass\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__dragHandlerClass = setting[\"dragHandlerClass\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableDragAfterHold\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableDragAfterHold = Boolean.parse(setting[\"enableDragAfterHold\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"holdTime\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__holdTime = parseInt(setting[\"holdTime\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableCloneMode\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableCloneMode = Boolean.parse(setting[\"enableCloneMode\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"labelField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__labelField = setting[\"labelField\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"itemRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__itemRenderer = setting[\"itemRenderer\"];\r\n\t\t\t\tthis.__itemRenderer = this.util.getFunction(this.__itemRenderer);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"template\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__templateID = setting[\"template\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"setData\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__setData = setting[\"setData\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"labelFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__labelFunction = setting[\"labelFunction\"];\r\n\t\t\t\tthis.__labelFunction = this.util.getFunction(this.__labelFunction);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableMultipleSelection\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMultipleSelection =  Boolean.parse(setting[\"enableMultipleSelection\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableCustomScrollBar\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableCustomScrollBar =  Boolean.parse(setting[\"enableCustomScrollBar\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableKeyboardNavigation\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableKeyboardNavigation =  Boolean.parse(setting[\"enableKeyboardNavigation\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableMouseHover\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMouseHover =  Boolean.parse(setting[\"enableMouseHover\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableMouseHoverAnimation\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMouseHoverAnimation =  Boolean.parse(setting[\"enableMouseHoverAnimation\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"disableHoverField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__disableHoverField = setting[\"disableHoverField\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"disableHoverFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__disableHoverFunction = setting[\"disableHoverFunction\"];\r\n\t\t\t\tthis.__disableHoverFunction = this.util.getFunction(this.__disableHoverFunction);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"rowHeight\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__rowHeight =  parseInt(setting[\"rowHeight\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"noDataMessage\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__noDataMessage = setting[\"noDataMessage\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"dataSource\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__dataSource = setting[\"dataSource\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"childField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__childField = setting[\"childField\"];\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableContextMenu\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableContextMenu = Boolean.parse(setting[\"enableContextMenu\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"contextMenuProvider\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__contextMenuProvider =  setting[\"contextMenuProvider\"];\r\n\t\t\t\tthis.__contextMenuProvider = this.util.getFunction(this.__contextMenuProvider);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"enableVariableRowHeight\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVariableRowHeight =  Boolean.parse(setting[\"enableVariableRowHeight\"]);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"customScrollBarSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__customScrollBarSetting =  setting[\"customScrollBarSetting\"];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__customScrollBarSetting = {enableTooltip: false,toolTipLabelFunction: null,verticalScrollButtons: {enable: false},horizontalScrollButtons:{enable: false}};\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"virtualScrollSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__virtualScrollSetting = setting[\"virtualScrollSetting\"];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__virtualScrollSetting = {pageSize: null,pagesRendered: null,enableScrollDelay: false,scrollInterval: null,resizeInterval: null,enableLoader: false,getLoaderComponent: null};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.dataSource = function(source)\r\n\t{\r\n\t\tthis.__dataSource = source;\r\n\t\tif(this.__listContainer)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(this.__listContainer);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__createStructure();\r\n\t\t}\r\n\t\tif(this.__dataSource && this.__dataSource.length > 0)\r\n\t\t{\r\n\t\t\tthis.__orignalItemKey = Object.keys(this.__dataSource[0]);\r\n\t\t\tthis.__objGrid.dataSource();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__arrWrapper = [];\r\n\t\t\tthis.__arrInternalSource = [];\r\n\t\t\tthis.__updateTotalRecords(0);\r\n\t\t}\r\n\t\tthis.__renderBody();\r\n\t};\r\n\t\r\n\tNSList.prototype.getOrignalItem = function(item)\r\n\t{\r\n\t\tif(item && this.__orignalItemKey && this.__orignalItemKey.length > 0)\r\n\t\t{\r\n\t\t\tvar retItem = {};\r\n\t\t\tvar key = null;\r\n\t\t\tfor(var count = 0;count < this.__orignalItemKey.length;count++)\r\n\t\t\t{\r\n\t\t\t\tkey = this.__orignalItemKey[count];\r\n\t\t\t\tretItem[key] = item[key];\r\n\t\t\t}\r\n\t\t\treturn retItem;\r\n\t\t}\r\n\t\treturn item;\r\n\t};\r\n\t\r\n\tNSList.prototype.addItems = function(arrItem)\r\n\t{\r\n\t\tthis.__addItem(arrItem);\r\n\t};\r\n\t\r\n\tNSList.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t\tthis.__objGrid.addItemsAsChildren(item,arrChildren);\r\n\t};\r\n\t\r\n\tNSList.prototype.removeItems = function(arrObject)\r\n\t{\r\n\t\tif(arrObject && arrObject.length > 0)\r\n\t\t{\r\n\t\t\tvar arrIndex = [];\r\n\t\t\tif(this.util.isNumber(arrObject[0]))\r\n\t\t\t{\r\n\t\t\t\tarrIndex = arrObject;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfor (var count = 0;count < arrObject.length;count++)\r\n\t\t\t    {\r\n\t\t\t\t\tvar item = arrObject[count];\r\n\t\t\t\t\tif(item && item[this.__fieldIndex])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrIndex.push(item[this.__fieldIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\tarrIndex.sort();\r\n\t   \t \tfor (var rowIndex = arrIndex.length - 1; rowIndex >= 0; rowIndex--)\r\n\t\t    {\r\n\t   \t \t\tvar index = arrIndex[rowIndex];\r\n\t   \t \t\tif(index > 0 && index < this.__arrInternalSource.length)\r\n\t   \t \t\t{\r\n\t\t   \t \t\t//if virtual scroll or Pagination of type Page is enabled then do not remove rows\r\n\t\t   \t \t\tif(!this.__enableVirtualScroll)\r\n\t\t   \t \t\t{\r\n\t\t   \t \t\t\tthis.__listContainer.removeChild(this.__listContainer.childNodes[index]);\r\n\t\t   \t \t\t}\r\n\t\t   \t \t\tthis.__arrInternalSource.splice(index, 1);\r\n\t\t   \t \t\tthis.__arrWrapper.splice(index, 1);\r\n\t   \t \t\t}\r\n\t\t    }\r\n\t\t \tthis.__updateTotalRecords();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.scrollToIndex = function(selectedIndex,animationRequired)\r\n\t{\r\n\t\tselectedIndex = parseInt(selectedIndex);\r\n\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\tif(selectedIndex > -1 && source && selectedIndex < source.length)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(selectedIndex);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__enableCustomScrollBar)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar targetDimension = this.__virtualRowHeight * (selectedIndex - 1);\r\n\t\t\t\t\t\tthis.__setVirtualScroll_ScrollTop(targetDimension);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//var item = this.__getVisibleItemByIndex(this.__arrInternalSource,selectedIndex);\r\n\t\t\t\t\t\tif(this.__nsVirtualScroll)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//because in list index is index+1\r\n\t\t\t\t\t\t\tthis.__nsVirtualScroll.scrollToIndex(selectedIndex - 1,animationRequired);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item[this.__fieldItem])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar targetDimension = item[this.__fieldItem].offsetTop;\r\n\t\t\t\t\t\tvar scrollTarget = this.__divOuterContainer;\r\n\t\t\t\t\t\tif(animationRequired)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar animation = new this.util.animation(scrollTarget,[\r\n\t\t\t\t       \t  \t    {\r\n\t\t\t\t       \t  \t      time: 500,\r\n\t\t\t\t       \t  \t      property:\"scrollTop\",\r\n\t\t\t\t       \t  \t      target: targetDimension,\r\n\t\t\t\t       \t  \t    }\r\n\t\t\t\t       \t  \t]);\r\n\t\t\t\t   \t  \t  \tanimation.animate();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tscrollTarget.scrollTop = targetDimension;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.setSelectedItems = function(arrItems)\r\n\t{\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tthis.__clearAllRowSelection(false);\r\n\t\t\t\tvar length = arrItems.length;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tindex = this.__getIndexByItem(item);\r\n\t\t\t\t\tif(index > -1 && source && index < source.length)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__setIndex(index,true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.setSelectedItem = function(arrItems)\r\n\t{\r\n\t\tthis.setSelectedItems([arrItems]);\r\n\t};\r\n\t\r\n\tNSList.prototype.setSelectedIndexes = function(arrSelectedIndex)\r\n\t{\r\n\t\tif(arrSelectedIndex && arrSelectedIndex.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tvar length = arrSelectedIndex.length;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tindex = arrSelectedIndex[count];\r\n\t\t\t\t\tif(index > -1 && source && index < source.length)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__setIndex(index,true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.setSelectedIndex = function(selectedIndex)\r\n\t{\r\n\t\tthis.setSelectedIndexes([selectedIndex]);\r\n\t};\r\n\t\r\n\tNSList.prototype.unSelectItems = function(arrItems)\r\n\t{\r\n\t\t\r\n\t};\r\n\t\r\n\tNSList.prototype.unSelectItem = function(arrItems)\r\n\t{\r\n\t\tthis.unSelectItems([arrItems]);\r\n\t};\r\n\t\r\n\tNSList.prototype.unSelectIndexes = function(arrSelectedIndex)\r\n\t{\r\n\t\t\r\n\t};\r\n\t\r\n\tNSList.prototype.unSelectIndex = function(selectedIndex)\r\n\t{\r\n\t\tthis.unSelectIndexes([selectedIndex]);\r\n\t};\r\n\t\r\n\tNSList.prototype.getSelectedIndex = function()\r\n\t{\r\n\t\treturn this.__selectedIndex;\r\n\t};\r\n\t\r\n\tNSList.prototype.getSelectedItem = function()\r\n\t{\r\n\t\treturn this.__selectedItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.getSelectedIndexes = function()\r\n\t{\r\n\t\treturn this.__selectedIndexes;\r\n\t};\r\n\t\r\n\tNSList.prototype.getSelectedItems = function()\r\n\t{\r\n\t\treturn this.__selectedItems;\r\n\t};\r\n\t\r\n\tNSList.prototype.deselectAll = function()\r\n\t{\r\n\t\tthis.__clearAllRowSelection(true);\r\n\t};\r\n\t\r\n\tNSList.prototype.filter = function(strData,setting,enableHighlighting,recordLimit)\r\n\t{\r\n\t\tthis.__nsListFilter.filter(strData,setting,enableHighlighting,recordLimit);\r\n\t};\r\n\t\r\n\tNSList.prototype.resetFilter = function()\r\n\t{\r\n\t\tthis.__nsListFilter.reset();\r\n\t};\r\n\t\r\n\tNSList.prototype.updateListItemByIndex = function(index)\r\n\t{\r\n\t\tvar item = this.__getItemByIndex(index);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar listItem = this.__getListItemFromItem(item);\r\n\t\t\tif(listItem)\r\n\t\t\t{\r\n\t\t\t\tvar index = this.__getIndexByItem(item);\r\n\t\t\t\tthis.__updateListItemText(listItem,item,index);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__highlightDiv = function(divText)\r\n\t{\r\n\t\tthis.__nsListFilter.__highlightDiv(divText);\r\n\t};\r\n\t\r\n\tNSList.prototype.__initializePluggins = function()\r\n\t{\r\n\t\tif(!this.__objGrid)\r\n\t\t{\r\n\t\t\tif(this.__enableHierarchical)\r\n\t\t\t{\r\n\t\t\t\tthis.__objGrid = new NSHierarchicalList(this);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__objGrid = new NSFlatList(this);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!this.__nsListFilter)\r\n\t\t{\r\n\t\t\tthis.__nsListFilter = new NSListFilter(this);\r\n\t\t\tif(this.__enableDragDrop)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsListDragDrop = new NSListDragDrop(this);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__nsToolTipInElement = new this.util.nsToolTipInElement();\r\n\t};\r\n\t\r\n\tNSList.prototype.__createStructure = function()\r\n\t{\r\n\t\tif(!this.__divOuterContainer)\r\n\t\t{\r\n\t\t\tthis.__divOuterContainer = this.util.createDiv(this.getID() + \"container\",\"nsListOuterContainer\");\r\n\t\t\tif(this.__enableHierarchical)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(this.__divOuterContainer,\"nsListOuterContainerHierarchical\")\r\n\t\t\t}\r\n\t\t\tthis.__divOuterContainer.style.width = this.util.getStyleValue(this.__baseComponent,\"width\");\r\n\t\t\t//this.__divOuterContainer.style.height = this.util.getStyleValue(this.__baseComponent,\"height\");\r\n\t\t\tthis.addChild(this.__divOuterContainer);\r\n\t\t\tthis.__divParentContainer = this.util.createDiv(this.getID() + \"parentContainer\",\"nsListParentContainer\");\r\n\t\t\tthis.__divOuterContainer.appendChild(this.__divParentContainer);\r\n\t\t\tthis.__listContainer = this.util.createElement(\"ul\",this.getID() + \"list\",\"nsListContainer\");\r\n\t\t\tthis.__listContainer.style.minHeight = (this.__divOuterContainer.clientHeight - 10) + \"px\";\r\n\t\t\tthis.__divParentContainer.appendChild(this.__listContainer);\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(this.__divParentContainer,\"nsListBodyContainerVirtual\");\r\n\t\t\t}\r\n\t\t\tthis.__createCustomScroller();\r\n\t\t}\r\n\t};\r\n\r\n\tNSList.prototype.__renderBody = function()\r\n\t{\r\n\t\tthis.__navigationIndex = -1;\r\n\t\tif(this.__enableContextMenu)\r\n\t\t{\r\n\t\t\tthis.__initializeContextMenu();\r\n\t\t}\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(this.__listContainer);\r\n\t\t\tthis.__createList(this.__arrInternalSource,0,this.__arrInternalSource.length);\r\n\t\t\t//5 is offset for number of rows\r\n\t\t\tvar listItem = this.__getListItemByIndex(0);\r\n\t\t\tif(listItem)\r\n\t\t\t{\r\n\t\t\t\tthis.__listItemHeight = listItem.clientHeight;\r\n\t\t\t}\r\n\t\t\tthis.__pageSize = (this.__divOuterContainer.clientHeight/this.__listItemHeight) - 5;\r\n\t\t\tthis.__startArrayElement = 0;\r\n\t\t}\r\n\t\t//this.__listContainer.scrollTop = 0;\r\n\t\tif(this.__nsListDragDrop)\r\n\t\t{\r\n\t\t\tthis.__nsListDragDrop.initialize();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setNSVirtualScroll = function(source)\r\n\t{\r\n\t\tvar length = 0;\r\n\t\tif(source && source.length)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tif(source[count][this.__fieldItemVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\tlength++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__nsVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__nsVirtualScroll.dataSource(length);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(length > 0)\r\n\t\t\t{\r\n\t\t\t\tif(this.__rowHeight > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__virtualRowHeight = this.__rowHeight;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__createList(this.__arrInternalSource,0,1);\r\n\t\t\t\t\tvar item = this.__arrInternalSource[0];\r\n\t\t\t\t\tvar listItem = item[this.__fieldItem];\r\n\t\t\t\t    this.__virtualRowHeight = listItem.offsetHeight;\r\n\t\t\t\t    listItem.parentNode.removeChild(listItem);\r\n\t\t\t\t}\r\n\t\t\t\tvar setting = {scrollElement: this.__divOuterContainer,contentElement: this.__listContainer,itemTag: \"li\",totalLength: length,getItemComponent:this.__getItemComponentForVirtual.call(this),getEmptyItemComponent:this.__getEmptyItemComponentForVirtual.call(this)};\r\n\t\t\t\tvar virtualScrollSetting = this.__virtualScrollSetting;\r\n\t\t\t\tvar arrCopyFields = [\"pageSize\",\"pagesRendered\",\"enableScrollDelay\",\"scrollInterval\",\"resizeInterval\",\"enableLoader\",\"getLoaderComponent\"];\r\n\t\t\t\tvar field = null;\r\n\t\t\t\tfor(var count = 0;count < arrCopyFields.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tfield = arrCopyFields[count];\r\n\t\t\t\t\tif(!this.util.isUndefinedOrNull(virtualScrollSetting[field]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetting[field] = virtualScrollSetting[field];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsVirtualScroll = new NSVirtualScroll(setting);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__getItemComponentForVirtual = function()\r\n\t{\r\n\t\tvar list = this;\r\n\t\tvar CreateListItem = function(index)\r\n\t\t{\r\n\t\t\tthis.__index = index;\r\n\t\t\tthis.__list =  list;\r\n\t\t\tthis.__item = null;\r\n\t\t\tthis.__listItem = null;\r\n\t\t};\r\n\t\tCreateListItem.prototype.getElement = function()\r\n\t\t{\r\n\t\t\tif(!this.__listItem)\r\n\t\t\t{\r\n\t\t\t\tif(this.__list.__enableHierarchical)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__item = this.__list.__getVisibleItemByIndex(null,this.__index);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__item = this.__list.__arrInternalSource[this.__index];\r\n\t\t\t\t}\r\n\t\t\t\tthis.__listItem = this.__list.__createListItem(this.__item,false);\r\n\t\t\t}\r\n\t\t\treturn this.__listItem;\r\n\t\t};\r\n\t\treturn CreateListItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getEmptyItemComponentForVirtual = function()\r\n\t{\r\n\t\tvar list = this;\r\n\t\tvar CreateEmptyListItem = function()\r\n\t\t{\r\n\t\t\tthis.__list =  list;\r\n\t\t\tthis.__listItem = null;\r\n\t\t};\r\n\t\tCreateEmptyListItem.prototype.getElement = function()\r\n\t\t{\r\n\t\t\tif(!this.__listItem)\r\n\t\t\t{\r\n\t\t\t\tthis.__listItem = this.__list.__createNoDataRow.call(this.__list);\r\n\t\t\t}\r\n\t\t\treturn this.__listItem;\r\n\t\t};\r\n\t\treturn CreateEmptyListItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.__createCustomScroller = function()\r\n\t{\r\n\t\tif(this.__enableCustomScrollBar && !this.__scroller)\r\n\t\t{\r\n\t\t\tvar setting = {element: this.__divOuterContainer,enableCustomHandler: true,verticalScrollButtons:this.__customScrollBarSetting.verticalScrollButtons,horizontalScrollButtons:this.__customScrollBarSetting.horizontalScrollButtons};\r\n\t\t\tfor (var key in setting) \r\n\t\t\t{ \r\n\t\t\t\tthis.__scrollerSetting[key] = setting[key]; \r\n\t\t\t}\r\n\t\t\tthis.__scroller = new NSScroller(this.__scrollerSetting);\r\n\t\t\tthis.util.addEvent(this.__scrollerSetting.element,NSScroller.SCROLLING,this.__customScrollHandler.bind(this));\r\n\t\t\tthis.util.addEvent(this.__scrollerSetting.element,NSScroller.SCROLL_END,this.__customScrollEndHandler.bind(this));\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__customScrollHandler = function(event)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar virtualVerHandler = function()\r\n\t\t{\r\n\t\t\t//todo Virtual Scroll impl for Custom Scroll Bar\r\n\t\t};\r\n\t\tvar dataRefreshVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar asyncLoadVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar paginationVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar normalVerHandler = function()\r\n\t\t{\r\n\t\t\tself.__divOuterContainer.scrollTop = scrollPos;\r\n\t\t\t\r\n\t\t\tvar first,last;\r\n\t\t\tvar arrRows = self.__listContainer.querySelectorAll(\"li\");\r\n\t\t\tfor(var count = 0;count < arrRows.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar li = arrRows[count];\r\n\t\t\t\tif(isInViewport(li))\r\n\t\t\t\t{\r\n\t\t\t\t\tfirst = li;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor(;count < arrRows.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar li = arrRows[count];\r\n\t\t\t\tif(!isInViewport(li))\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tlast = li;\r\n\t\t\t}\r\n\t\t\tconsole.log(first,last);\r\n\t\t};\r\n\t\tvar normalHorHandler = function()\r\n\t\t{\r\n\t\t\tself.__divOuterContainer.scrollLeft = scrollPos;\r\n\t\t};\r\n\t\tvar isInViewport = function (elem) \r\n\t\t{\r\n\t\t\tif(elem)\r\n\t\t\t{\r\n\t\t\t\t/*var distance = elem.getBoundingClientRect();\r\n\t\t\t\treturn (\r\n\t\t\t\t\tdistance.top >= 0 &&\r\n\t\t\t\t\tdistance.left >= 0 &&\r\n\t\t\t\t\tdistance.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\r\n\t\t\t\t\tdistance.right <= (window.innerWidth || document.documentElement.clientWidth)\r\n\t\t\t\t);*/\r\n\t\t\t\tconst rect = elem.getBoundingClientRect();\r\n\t\t\t    const windowHeight = (window.innerHeight || document.documentElement.clientHeight);\r\n\t\t\t    const windowWidth = (window.innerWidth || document.documentElement.clientWidth);\r\n\r\n\t\t\t    const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);\r\n\t\t\t    const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);\r\n\r\n\t\t\t    return (vertInView && horInView);\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\tvar objCondition = {virtualScroll:{eligible:this.__enableVirtualScroll,verHandler:virtualVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tdataRefreshOnEnd:{eligible:this.__enableDataRefreshOnScrollEnd,verHandler:dataRefreshVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tasyncLoad:{eligible:this.__enableAsyncLoadPagination,verHandler:asyncLoadVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tpagination:{eligible:(this.__enablePagination && this.__isPaginationTypeScroll),verHandler:paginationVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tnormal:{eligible:true,verHandler:normalVerHandler,horHandler:normalHorHandler}\r\n\t\t\t\t\t\t   };\r\n\t\tvar eventItem = event;\r\n\t\tvar direction = eventItem.direction;\r\n\t\tvar scrollPos = eventItem.scrollPos;\r\n\t\tvar oldScrollPos = eventItem.oldScrollPos;\r\n\t\tvar orignalEvent = eventItem.orignalEvent;\r\n\t\tvar scrollBar = eventItem.scrollBar;\r\n\t\tvar position = eventItem.absoluteScrollBarPos;\r\n\t\tfor(var key in objCondition)\r\n\t\t{\r\n\t\t\tvar item = objCondition[key];\r\n\t\t\tif(item.eligible)\r\n\t\t\t{\r\n\t\t\t\tif(direction == \"vertical\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item.verHandler)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.__customScrollBarSetting[\"enableTooltip\"] && !this.__customScrollBarTooltip)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__customScrollBarTooltip = this.util.createElement(\"span\",null,\"tooltiptext tooltip-left\");\r\n\t\t\t\t\t\t\tdocument.body.appendChild(this.__customScrollBarTooltip);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\titem.verHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item.horHandler)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem.horHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__customScrollEndHandler = function(event)\r\n\t{\r\n\t\tif(this.__customScrollBarTooltip)\r\n\t\t{\r\n\t\t\tdocument.body.removeChild(this.__customScrollBarTooltip);\r\n\t\t\tthis.__customScrollBarTooltip = null;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__customScrollTooltipPos = function(scrollbar,position,itemFrom,itemTo)\r\n\t{\r\n\t\tif(this.__customScrollBarTooltip)\r\n\t\t{\r\n\t\t\tvar toolTip = this.__customScrollBarTooltip;\r\n\t\t\tvar css = {};\r\n\t\t\t//5 for the triangle\r\n\t\t\tcss.left = (position.x - toolTip.offsetWidth - 5) + \"px\";\r\n\t\t\tcss.top = position.y + \"px\";\r\n\t\t\tthis.util.css(toolTip,css);\r\n\t\t\tif(this.__customScrollBarSetting.toolTipLabelFunction)\r\n\t\t\t{\r\n\t\t\t\ttoolTip.innerHTML = this.__customScrollBarSetting.toolTipLabelFunction(itemFrom,itemTo);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttoolTip.innerHTML = \"Showing Record from index \" + itemFrom + \" to \" +  itemTo;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t};\r\n\t\r\n\tNSList.prototype.__virtualRowSelection = function()\r\n\t{\r\n\t\tif(this.__listContainer.children && this.__listContainer.children.length > 0 && this.__arrInternalSource)\r\n\t\t{\r\n\t\t\tvar listItem = null;\r\n\t\t\tvar index = null;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = 0; count < this.__listContainer.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tlistItem = this.__listContainer.children[count];\r\n\t\t\t\tindex = this.__getIndexFromTarget(listItem);\r\n\t\t\t\titem = this.__getItemByIndex(index);\r\n\t\t\t\tif(item && this.__isMouseHoverAllowed(index))\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item[this.__fieldSelected])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//DONOT REPLACE WITH __markRowSelected\r\n\t\t\t\t\t\tthis.util.addStyleClass(listItem,\"nsListItemSelected\"); \r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//DONOT REPLACE WITH __markRowUnselected\r\n\t\t\t\t\t\tthis.util.removeStyleClass(listItem,\"nsListItemSelected\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__virtualRowHover = function()\r\n\t{\r\n\t\tif(this.__listContainer.children && this.__listContainer.children.length > 0 && this.__arrInternalSource)\r\n\t\t{\r\n\t\t\tvar listItem = null;\r\n\t\t\tvar index = null;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = 0; count < this.__listContainer.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tlistItem = this.__listContainer.children[count];\r\n\t\t\t\tindex = this.__getIndexFromTarget(listItem);\r\n\t\t\t\titem = this.__getItemByIndex(index);\r\n\t\t\t\t(item && item[this.__fieldHover]) ? this.util.addStyleClass(listItem,\"nsListItemHover\") : this.util.removeStyleClass(listItem,\"nsListItemHover\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setVirtualRowHoverField = function(indexToSet)\r\n\t{\r\n\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t{\r\n\t\t\tindexToSet = -1;\r\n\t\t}\r\n\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = 0; count < source.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__fieldHover] = (item[this.__fieldIndex] === indexToSet); \r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setVirtualRowHover = function(indexToSet)\r\n\t{\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t{\r\n\t\t\t\tindexToSet = 0;\r\n\t\t\t}\r\n\t\t\tvar item = this.__getVisibleItemByIndex(null,indexToSet);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__navigationIndex = indexToSet;\r\n\t\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t\tthis.__setVirtualRowHoverField(index);\r\n\t\t\t\tthis.__virtualRowHover();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setRowHover = function(indexToSet)\r\n\t{\r\n\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t{\r\n\t\t\tindexToSet = 0;\r\n\t\t}\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__setVirtualRowHover(indexToSet);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(indexToSet))\r\n\t\t\t{\r\n\t\t\t\tindexToSet = 0;\r\n\t\t\t}\r\n\t\t\tthis.__navigationIndex = indexToSet;\r\n\t\t\tvar listItem = this.__getListItemFromContainer(this.__navigationIndex);\r\n\t\t\tthis.util.addStyleClass(listItem,\"nsListItemHover\");\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__createNoDataRow = function()\r\n\t{\r\n\t\tvar listItem = this.util.createElement(\"li\",null,\"nsListNoRecordsFound\");\r\n\t\tlistItem.setAttribute(\"nsNoData\",\"true\");\r\n\t\tvar textNode = document.createTextNode(this.__noDataMessage);\r\n\t\tlistItem.appendChild(textNode);\r\n\t\treturn listItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.__addListenerForBody = function()\r\n\t{\r\n\t\tif(!this.__keyDownRef)\r\n\t\t{\r\n\t\t\tthis.__keyDownRef = this.__keyDownHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document,\"keydown\",this.__keyDownRef);\r\n\t\t}\r\n\t\tif(!this.__keyUpRef)\r\n\t\t{\r\n\t\t\tthis.__keyUpRef = this.__keyUpHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document,\"keyup\",this.__keyUpRef);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__createList = function(dataSet,startIndex,endIndex)\r\n\t{\r\n\t\tif(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t\t\tthis.__objGrid.__createList(dataSet,startIndex,endIndex);\r\n\t    }\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__listContainer.appendChild(this.__createNoDataRow());\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__createListAt = function(item,index,isResetIndex)\r\n\t{\r\n\t\tif(item && index > -1)\r\n\t    {\r\n\t\t\tthis.__updateItem(item,index,true,isResetIndex);\r\n\t\t\tvar listItem = this.__createListItem(item,false);\r\n\t\t\tthis.__listContainer.insertBefore(listItem, this.__listContainer.childNodes[index]);\r\n\t\t\treturn listItem;\r\n\t    }\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateItem = function(item,index,isReset,isResetIndex)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tif(isResetIndex || !item.hasOwnProperty(this.__fieldIndex))\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldIndex] = index;\r\n\t\t\t}\r\n\t\t\tif(isReset || !item.hasOwnProperty(this.__fieldDisableHover))\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldDisableHover] = this.__isHoverDisabled(item);\r\n\t\t\t}\r\n\t\t\tif(isReset || !item.hasOwnProperty(this.__fieldSelected))\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldSelected] = false;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__createListItem = function(item,isAdd)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\t if(this.util.isUndefined(isAdd) || isAdd === null)\r\n\t\t\t {\r\n\t\t\t\t isAdd = true;\r\n\t\t\t }\r\n\t\t\t var listItem = this.util.createElement(\"li\",null,\"nsListItem\");\r\n\t\t\t this.__objGrid.__createListItem(listItem,item);\r\n\t\t\t if(this.__enableMouseHover)\r\n\t\t\t {\r\n\t\t\t\t this.util.addEvent(listItem,\"mouseover\",this.__itemMouseOverHandler.bind(this));\r\n\t\t\t\t this.util.addEvent(listItem,\"mouseout\",this.__itemMouseOutHandler.bind(this));\r\n\t\t\t\t if(this.__enableMouseHoverAnimation)\r\n\t\t\t\t {\r\n\t\t\t\t\t this.util.addStyleClass(listItem,\"nsListItemAnimated\");\r\n\t\t\t\t }\r\n\t\t\t\t else\r\n\t\t\t\t {\r\n\t\t\t\t\t this.util.addStyleClass(listItem,\"nsListItemNormal\");\r\n\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t this.util.addEvent(listItem,\"click\",this.__itemClickHandler.bind(this));\r\n\t\t\t this.__setListItemProperties(listItem,item);\r\n\t\t\t if(isAdd)\r\n\t\t\t {\r\n\t\t\t\t this.__listContainer.appendChild(listItem);\r\n\t\t\t }\r\n\t\t\t return listItem;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__setListItemProperties = function(listItem,item)\r\n\t{\r\n\t\tthis.__objGrid.__setListItemProperties(listItem,item);\r\n\t};\r\n\t\r\n\tNSList.prototype.__addCellText = function(listItem,item,div)\r\n\t{\r\n\t\tvar toolTipText = null;\r\n\t\tif(listItem && item && div)\r\n\t\t{\r\n\t\t\tif(this.__itemRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar objRenderer = this.__itemRenderer(item,this.__labelField,item[this.__fieldIndex],item[this.__fieldDisableHover],listItem);\r\n\t\t\t\tif(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar compBodySpan = document.createElement(\"span\");\r\n\t\t\t\t\t\tcompBodySpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\tdiv.appendChild(compBodySpan);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdiv.appendChild(objRenderer);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(this.__template)\r\n\t\t\t{\r\n\t\t\t\tdiv.appendChild(this.__template.cloneNode(true));\r\n\t\t\t\tthis.__setDataInTemplateRenderer(div,item,listItem);\r\n\t\t\t}\r\n\t\t\telse if(this.__labelFunction)\r\n\t\t\t{\r\n\t\t\t\tvar text = this.__labelFunction(item,this.__labelField);\r\n\t\t\t\tdiv.appendChild(document.createTextNode(text));\r\n\t\t\t}\r\n\t\t\telse if(item.hasOwnProperty(this.__labelField) && !this.util.isUndefined(item[this.__labelField]) && item[this.__labelField] != null)\r\n\t\t    {\r\n\t\t\t\tvar text = item[this.__labelField];\r\n\t\t\t\tdiv.appendChild(document.createTextNode(text));\r\n\t\t    }\r\n\t\t\tthis.__highlightDiv(div);\r\n\t\t\tif(this.__toolTipField)\r\n\t\t\t{\r\n\t\t\t\ttoolTipText = item[this.__toolTipField];\r\n\t\t\t}\r\n\t\t\telse if(this.__toolTipRenderer)\r\n\t\t\t{\r\n\t\t\t\ttoolTipText = this.__toolTipRenderer(item,this.__labelField,item[this.__fieldIndex],item[this.__fieldDisableHover],listItem);\r\n\t\t\t}\r\n\t\t\tif(this.__enableTruncateToFit)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(div,\"nsListTruncateToFit\");\r\n\t\t\t\t//This condition is above so that toolTip and title are not set togeather\r\n\t\t\t\tif(!toolTipText || toolTipText === \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__enableToolTipForTruncateText)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttoolTipText = div.textContent;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdiv.setAttribute(\"title\",div.textContent);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(toolTipText && toolTipText !== \"\")\r\n\t\t\t{\r\n\t\t\t\tthis.__nsToolTipInElement.addToolTip(div,toolTipText);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setDataInTemplateRenderer = function(cellItem,data,listItem)\r\n\t{\r\n\t\tif(cellItem && this.__setData)\r\n\t\t{\r\n\t\t\tthis.__setRendererProperties(cellItem);\r\n\t\t\tthis.__setRendererInData(cellItem,data,listItem);\r\n\t\t\t//IE bug\r\n\t\t\tcellItem.data = data;\r\n\t\t\tif(this.util.isFunction(this.__setData))\r\n\t\t    {\r\n\t\t\t\tvar strParam = \"(cellItem,data,dataField,isDisabled,listItem)\"; \r\n\t\t    \tif(this.util.isString(this.__setData))\r\n\t\t    \t{\r\n\t\t    \t\tvar base = this;\r\n\t\t    \t\tthis.util.callFunctionFromString(this.__setData + strParam,function(paramValue){\r\n\t\t\t\t\t\tif(paramValue === \"cellItem\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn cellItem;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"data\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn data;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"dataField\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn base.__labelField;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"isDisabled\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn data[base.__fieldDisableHover];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"listItem\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn listItem;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn paramValue;\r\n\t\t\t\t\t});\r\n\t\t    \t}\r\n\t\t    \telse\r\n\t\t    \t{\r\n\t\t    \t\tthis.__setData(cellItem,data,this.__labelField,data[this.__fieldDisableHover],listItem);\r\n\t\t    \t}\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setRendererInData = function(cellItem,data,listItem)\r\n\t{\r\n\t\tif(cellItem)\r\n\t\t{\r\n\t\t\tvar compChild = null;\r\n\t\t\tfor(var count = 0; count < cellItem.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tcompChild = cellItem.children[count];\r\n\t\t\t\tif(compChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tcompChild.data = data;\r\n\t\t\t\t\tcompChild.listItem = listItem;\r\n\t\t\t\t}\r\n\t\t\t\t//IE 9 Bug,you got to assign it back\r\n\t\t\t\t//listItem.children[count] = compChild;\r\n\t\t\t\tthis.__setRendererInData(compChild,data,listItem);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setRendererProperties = function(cellItem)\r\n\t{\r\n\t\tif(cellItem)\r\n\t\t{\r\n\t\t\tvar compChild = null;\r\n\t\t\tfor(var count = 0; count < cellItem.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tcompChild = cellItem.children[count];\r\n\t\t\t\tvar grid = this;\r\n\t\t\t\tArray.prototype.slice.call(compChild.attributes).forEach(function(attribute) \r\n\t\t\t\t{\r\n\t\t\t        if(grid.util.isFunction(attribute.value))\r\n\t\t\t        {\r\n\t\t\t        \tvar newValue = attribute.value + \"(this)\";\r\n\t\t\t        \tcompChild.removeAttribute(attribute.name);\r\n\t\t\t\t\t\tcompChild.setAttribute(attribute.name,newValue);\r\n\t\t\t        }\r\n\t\t\t\t});\r\n\t\t\t\tif(compChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(compChild.hasAttribute(\"accessor-name\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcellItem[compChild.getAttribute(\"accessor-name\")] = compChild;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.__setRendererProperties(compChild);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setTemplate = function()\r\n\t{\r\n\t\tif(this.__templateID)\r\n\t\t{\r\n\t\t\tthis.__template = this.util.getTemplate(this.__templateID);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__isHoverDisabled = function(item)\r\n\t{\r\n\t\tif(this.__disableHoverField)\r\n\t\t{\r\n\t\t\treturn Boolean.parse(item[this.__disableHoverField]);\r\n\t\t}\r\n\t\tif(this.__disableHoverFunction)\r\n\t\t{\r\n\t\t\treturn Boolean.parse(this.__disableHoverFunction(item,this.__fieldIndex));\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSList.prototype.__itemClickHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t    var target = this.util.getTarget(event);\r\n\t    target = this.util.findParent(target,\"li\");\r\n\t    var index = this.__getIndexFromTarget(target);\r\n\t    this.__setIndex(index,false);\r\n\t    this.__lastNavigationDirection = null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__setIndex = function(index,isMultiSelect)\r\n\t{\r\n\t\tif(index > -1)\r\n\t\t{\r\n\t\t\tisMultiSelect = Boolean.parse(isMultiSelect);\r\n\t\t\tif (this.__isShiftPressed && this.__enableMultipleSelection)\r\n\t\t    {\r\n\t\t    \tthis.__multiSectionHandler(index);\r\n\t\t    }\r\n\t\t    else if(isMultiSelect || (this.__isCtrlPressed && this.__enableMultipleSelection))\r\n\t\t    {\r\n\t\t    \tif(this.__isRowSelected(index))\r\n\t\t    \t{\r\n\t\t    \t\tthis.__markRowUnselected(index);\r\n\t\t    \t}\r\n\t\t    \telse\r\n\t\t    \t{\r\n\t\t    \t\tthis.__markRowSelected(index);\r\n\t\t    \t}\r\n\t\t    }\r\n\t\t    else\r\n\t\t    {\r\n\t\t    \tthis.__clearAllRowSelection(false);\r\n\t\t    \tthis.__markRowSelected(index);\r\n\t\t    } \r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__itemMouseOverHandler = function(event)\r\n\t{\r\n\t\t var target = this.util.getTarget(event);\r\n\t     target = this.util.findParent(target,\"li\");\r\n\t     var index = this.__getIndexFromTarget(target);\r\n\t     var item = this.__getItemByIndex(index);\r\n\t     if(target && index > -1 && this.__isMouseHoverAllowed(index))\r\n\t     {\r\n\t    \t this.util.addStyleClass(target,\"nsListItemHover\");\r\n\t    \t this.__navigationIndex = index;\r\n\t    \t this.util.dispatchEvent(this.__baseComponent,this.ITEM_NAVIGATED,item,{index:this.__navigationIndex});\r\n\t     }\r\n\t};\r\n\t\r\n\tNSList.prototype.__itemMouseOutHandler = function(event)\r\n\t{\r\n\t\t var target = this.util.getTarget(event);\r\n\t     target = this.util.findParent(target,\"li\");\r\n\t     if(target)\r\n\t     {\r\n\t    \t this.util.removeStyleClass(target,\"nsListItemHover\");\r\n\t     }\r\n\t};\r\n\t\r\n\tNSList.prototype.__keyDownHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tif(this.hasFocus())\r\n\t\t{\r\n\t\t\tthis.__isShiftPressed = event.shiftKey;\r\n\t\t\tthis.__isCtrlPressed = event.ctrlKey;\r\n\t\t\tvar isShiftCtrlPressed = this.__isShiftPressed || this.__isCtrlPressed;\r\n\t\t\tvar keyCode = this.util.getKeyUnicode(event);\r\n\t\t\tif(this.__enableKeyboardNavigation)\r\n\t\t\t{\r\n\t\t\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\t\t\t//key Up\r\n\t\t\t\tif(keyCode === this.util.KEYCODE.UP && isShiftCtrlPressed && this.__enableMultipleSelection)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__lastNavigationDirection && this.__lastNavigationDirection === this.NAVIGATION_DOWN)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.NAVIGATION_UP);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(this.__selectedIndex != 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__selectedIndex--;\r\n\t\t\t\t\t\tthis.__navigationIndex--;\r\n\t\t\t\t\t\twhile(!this.__isMouseHoverAllowed(this.__selectedIndex))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__selectedIndex--;\r\n\t\t\t\t\t\t\tthis.__navigationIndex--;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.NAVIGATION_UP);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//key down\r\n\t\t\t\telse if(keyCode === this.util.KEYCODE.DOWN && isShiftCtrlPressed && this.__enableMultipleSelection)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__lastNavigationDirection && this.__lastNavigationDirection === this.NAVIGATION_UP)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.NAVIGATION_DOWN);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(source && this.__selectedIndex != source.length - 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__selectedIndex++;\r\n\t\t\t\t\t\tthis.__navigationIndex++;\r\n\t\t\t\t\t\twhile(!this.__isMouseHoverAllowed(this.__selectedIndex))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__selectedIndex++;\r\n\t\t\t\t\t\t\tthis.__navigationIndex++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn this.__keyBoardSelectionHandler(event,this.NAVIGATION_DOWN);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if(keyCode === this.util.KEYCODE.UP)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(source && this.__navigationIndex === -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__navigationIndex = source.length - 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(this.__navigationIndex > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn this.__keyBoardNavigationHandler(event,this.NAVIGATION_UP);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if(keyCode === this.util.KEYCODE.DOWN)\r\n\t\t\t\t{\r\n\t\t\t\t\t/*if(this.__navigationIndex === -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__navigationIndex = 0;\r\n\t\t\t\t\t}*/\r\n\t\t\t\t\tif(source)//&& this.__navigationIndex < source.length\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn this.__keyBoardNavigationHandler(event,this.NAVIGATION_DOWN);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if(keyCode === this.util.KEYCODE.ENTER)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__clearAllRowSelection(false);\r\n\t\t\t\t\tvar listItem = this.__getkeyboardNavigationListItem();\r\n\t\t\t\t\tif(listItem)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__markRowSelected(this.__getIndexFromTarget(listItem));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(keyCode === this.util.KEYCODE.SHIFT)\r\n\t\t\t{\r\n\t\t\t\tthis.util.makeBodyUnselectable();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__keyUpHandler = function(event)\r\n\t{\r\n\t\tif(this.util.getKeyUnicode(event) === this.util.KEYCODE.CTRL)\r\n\t\t{\r\n\t\t\tthis.__isCtrlPressed = false;\r\n\t\t}\r\n\t\tif(this.util.getKeyUnicode(event) === this.util.KEYCODE.SHIFT)\r\n\t\t{\r\n\t\t\tthis.__isShiftPressed = false;\r\n\t\t\tthis.util.makeBodySelectable();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__keyBoardNavigationHandler = function(event,direction)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar lastIndex = this.__navigationIndex;\r\n\t\tvar currentIndex = this.__navigationIndex;\r\n\t\t(direction === this.NAVIGATION_UP) ? currentIndex--:currentIndex++;\r\n\t\twhile(!this.__isMouseHoverAllowed(currentIndex))\r\n\t\t{\r\n\t\t\t(direction === this.NAVIGATION_UP) ? currentIndex--:currentIndex++;\r\n\t\t}\r\n\t\tvar endHandler = function()\r\n\t\t{\r\n\t\t\tself.__navigationIndex = currentIndex;\r\n\t\t\tvar listItem = self.__getkeyboardNavigationListItem();\r\n\t\t\tvar index = -1;\r\n\t\t\tvar item = null;\r\n\t\t\tif(listItem)\r\n\t\t\t{\r\n\t\t\t\tvar source = self.__objGrid.__getFlatSource();\r\n\t\t\t\tindex = self.__getIndexFromTarget(listItem);\r\n\t\t\t\titem = self.__getItemByIndex(index, source);\r\n\t\t\t}\r\n\t\t\tself.util.dispatchEvent(self.__baseComponent,self.ITEM_NAVIGATED,item,{index:index});\r\n\t\t\tself.__lastNavigationDirection = null;\r\n\t\t};\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar virtualHandler = function()\r\n\t\t\t{\r\n\t\t\t\t//self.__setVirtualRowHover.call(self,index);\r\n\t\t\t\tvar item = self.__getVisibleItemByIndex.call(self,null,currentIndex);\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar index = item[self.__fieldIndex];\r\n\t\t\t\t\tself.__setVirtualRowHoverField.call(self,index);\r\n\t\t\t\t\tself.__virtualRowHover.call(self);\r\n\t\t\t\t\tendHandler();\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tthis.scrollToIndex(currentIndex,false);\r\n\t\t\t\r\n\t\t\tsetTimeout(function()\r\n\t\t\t{ \r\n\t\t\t\tvirtualHandler();\r\n\t\t\t},0);\r\n\t\t\t//this.__setVirtualRowHover(currentIndex);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar listItem = this.__getListItemFromContainer(lastIndex - this.__startArrayElement);\r\n\t\t\tvar currentListItem = this.__getListItemFromContainer(currentIndex - this.__startArrayElement);\r\n\t\t\t//var listItem = this.__getListItemByIndex(lastIndex - this.__startArrayElement);\r\n\t\t\t//var currentListItem = this.__getListItemByIndex(currentIndex - this.__startArrayElement);\r\n\t\t\tif(currentListItem)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(listItem,\"nsListItemHover\");\r\n\t\t\t\tthis.util.addStyleClass(currentListItem,\"nsListItemHover\");\r\n\t\t\t\tthis.__refreshScrollPosition(currentListItem,direction);\r\n\t\t\t\tendHandler();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tevent.preventDefault();\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSList.prototype.__keyBoardSelectionHandler = function(event,direction)\r\n\t{\r\n\t\tif(this.__isRowSelected(this.__selectedIndex))\r\n\t\t{\r\n\t\t\tthis.__markRowUnselected(this.__selectedIndex);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__markRowSelected(this.__selectedIndex);\r\n\t\t}\r\n\t\tif(direction === this.NAVIGATION_DOWN)\r\n\t\t{\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.scrollToIndex(this.__selectedIndex,false);\r\n\t\t\t}\r\n\t\t\telse if(Math.floor(this.__selectedIndex % this.__pageSize) === 0)\r\n\t\t\t{\r\n\t\t\t\tvar listItem = this.__getListItemByIndex(this.__selectedIndex);\r\n\t\t\t\tthis.__refreshScrollPosition(listItem,this.NAVIGATION_DOWN);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(direction === this.NAVIGATION_UP)\r\n\t\t{\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.scrollToIndex(this.__selectedIndex,false);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar listItem = this.__getListItemByIndex(this.__selectedIndex);\r\n\t\t\t\tthis.__refreshScrollPosition(listItem,this.NAVIGATION_UP);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__lastNavigationDirection = direction;\r\n\t\tevent.preventDefault();\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSList.prototype.__refreshScrollPosition = function(listItem,direction)\r\n\t{\r\n\t\tif(!this.__isElementInView(listItem))\r\n\t\t{\r\n\t\t\tthis.__scrollToListItem(listItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__isElementInView = function(listItem)\r\n\t{\r\n\t\tvar cellBottom = 0;\r\n\t    var parentBottom = 0;\r\n\t    var cellTop = 0;\r\n\t    var parentTop = 0;\r\n\t\tif(listItem)\r\n\t\t{\r\n\t\t\tvar scrollParent = this.__divOuterContainer;\r\n\t\t\tvar listChild = listItem.querySelector(\".nsListChild\");\r\n\t\t\tif(scrollParent && listChild)\r\n\t\t\t{\r\n\t\t\t\tvar cellRect = listChild.getBoundingClientRect();\r\n\t            parentTop = 0;\r\n\t            var rectScrollParent = scrollParent.getBoundingClientRect();\r\n\t            parentBottom = rectScrollParent.height;\r\n\t            cellTop =  cellRect.top - rectScrollParent.top;\r\n\t            cellBottom = cellTop + cellRect.height;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn cellBottom <= parentBottom && cellTop >= parentTop;\r\n\t};\r\n\t\r\n\tNSList.prototype.__scrollToListItem = function(listItem)\r\n\t{\r\n\t\tif(listItem)\r\n\t\t{\r\n\t\t\tvar rectCell = listItem.getBoundingClientRect();\r\n\t\t\tvar rectParentContainer = this.__divParentContainer.getBoundingClientRect();\r\n\t        var scrollTop = rectCell.top - rectParentContainer.top;\r\n\t        this.__divOuterContainer.scrollTop = scrollTop;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__getkeyboardNavigationListItem = function()\r\n\t{\r\n\t\tvar listItem = null;\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tlistItem = this.__listContainer.querySelector(\".nsListItemHover\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tlistItem = this.__getListItemFromContainer(this.__navigationIndex);\r\n\t\t}\r\n\t\treturn listItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.__isMouseHoverAllowed = function(index)\r\n\t{\r\n\t\tvar item = this.__getItemByIndex(index);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\treturn !item[this.__fieldDisableHover];\r\n\t\t}\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSList.prototype.__markRowSelected= function(index)\r\n\t{\r\n\t\tif(index > -1)\r\n\t    {\r\n\t        if(!this.__isRowSelected(index))\r\n\t        {\r\n\t        \tthis.__setMultiSelectedVars(index,true);\r\n\t            this.__setValuesForSelectedRow(index);\r\n\t        \tif(this.__enableVirtualScroll)\r\n\t        \t{\r\n\t        \t\tthis.__virtualRowSelection();\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tvar listItem = this.__getListItemByIndex(index);\r\n\t            \tthis.util.addStyleClass(listItem,\"nsListItemSelected\"); \r\n\t        \t}\r\n\t        }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSList.prototype.__markRowUnselected = function(index)\r\n\t{\r\n\t    if(this.__isRowSelected(index) && this.__isMouseHoverAllowed(index))\r\n\t    {\r\n\t    \tvar isUnselected = this.__setMultiSelectedVars(index,false);\r\n\t        if(isUnselected)\r\n\t        {\r\n\t        \tthis.__setValuesForUnselectedRow(index);\r\n\t        }\r\n\t        if(this.__enableVirtualScroll)\r\n\t    \t{\r\n\t    \t\tthis.__virtualRowSelection();\r\n\t    \t}\r\n\t    \telse\r\n\t    \t{\r\n\t    \t\tvar listItem = this.__getListItemByIndex(index);\r\n\t    \t\tthis.util.removeStyleClass(listItem,\"nsListItemSelected\");\r\n\t    \t}\r\n\t    }\r\n\t};\r\n\t\r\n\tNSList.prototype.__setValuesForSelectedRow = function(index)\r\n\t{\r\n\t\tif(index > -1 && this.__isMouseHoverAllowed(index))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldSelected] = true;\r\n\t\t\t    this.__selectedIndex = index;\r\n\t\t\t    this.__navigationIndex = index;\r\n\t\t\t    this.util.dispatchEvent(this.__baseComponent,this.ITEM_SELECTED,item,{index:index});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setValuesForUnselectedRow = function(index)\r\n\t{\r\n\t\tif(index > -1 && this.__isMouseHoverAllowed(index))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldSelected] = false;\r\n\t\t    \tthis.util.dispatchEvent(this.__baseComponent,this.ITEM_UNSELECTED,item,{index:index});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__clearAllRowSelection = function(setIndexVariables)\r\n\t{\r\n\t\tvar size = this.__selectedIndexes.length;\r\n\t    for (var count = size - 1; count >= 0 ; count--)\r\n\t    {\r\n\t    \tvar index = this.__selectedIndexes[count];\r\n\t        this.__markRowUnselected(index);\r\n\t    }\r\n\t    this.__setMultiSelectedVars(-1,true);\r\n\t    if(setIndexVariables)\r\n\t    {\r\n\t    \tthis.__selectedIndex = -1;\r\n\t        this.__navigationIndex = -1;\r\n\t    }\r\n\t};\r\n\t\r\n\tNSList.prototype.__multiSectionHandler = function(lastIndex)\r\n\t{\r\n\t\t if(lastIndex < 0)\r\n\t\t {\r\n\t\t\t return;\r\n\t\t }\r\n\t\t if (this.__selectedIndexes.length === 0)\r\n\t\t {\r\n\t\t\t this.__isRowSelected(lastIndex);\r\n\t\t     return;\r\n\t\t }\r\n\t\t var firstIndex = this.__selectedIndexes[this.__selectedIndexes.length - 1];\r\n\t\t if(lastIndex === firstIndex)\r\n\t\t {\r\n\t\t\t this.__markRowUnselected(lastIndex);\r\n\t\t\t return;\r\n\t\t }\r\n\t\t var isDown = lastIndex > firstIndex;\r\n\t\t var isSelection = !this.__isRowSelected(lastIndex);\r\n\t\t var counter = firstIndex;\r\n\t\t do\r\n\t\t {\r\n\t\t\t  counter = isDown ? (counter + 1) : (counter - 1);\r\n\t\t\t  if (isSelection)\r\n\t\t\t  {\r\n\t\t\t\t  this.__markRowSelected(counter);\r\n\t\t\t  }\r\n\t\t\t  else\r\n\t\t\t  {\r\n\t\t\t\t  this.__markRowUnselected(counter);\r\n\t\t\t  }\r\n\t\t }\r\n\t\t while(counter != lastIndex);\t \r\n\t};\r\n\t\r\n\tNSList.prototype.__setMultiSelectedVars = function(index,add)\r\n\t{\r\n\t\tif(index === -1)\r\n\t\t{\r\n\t\t\tthis.__selectedItems = [];\t\r\n\t\t\tthis.__selectedIndexes = [];\t\r\n\t\t}\r\n\t\telse if(add)\r\n\t\t{\r\n\t\t\tvar data = this.__getItemByIndex(index);\r\n\t\t\tthis.__selectedItems.push(data);\r\n\t\t\tthis.__selectedIndexes.push(index);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar isUnselected = false;\r\n\t\t\tfor (var count= 0; count < this.__selectedIndexes.length ; count++)\r\n\t        {\r\n\t            if (this.__selectedIndexes[count] === index)\r\n\t            {\r\n\t                this.__selectedItems.splice(count,1);\r\n\t                this.__selectedIndexes.splice(count,1);\r\n\t                isUnselected = true;\r\n\t                break;\r\n\t            }\r\n\t        }\r\n\t\t\treturn isUnselected;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSList.prototype.__isRowSelected= function(index)\r\n\t{\r\n\t    if(index > -1)\r\n\t    {\r\n\t    \tvar item = this.__getItemByIndex(index);\r\n\t    \tif(item)\r\n\t    \t{\r\n\t    \t\treturn item[this.__fieldSelected];\r\n\t    \t}\r\n\t    }   \r\n\t    return false;\r\n\t};\r\n\t\r\n\t/******************************************************Start of Context Menu*************************************************************/\r\n\tNSList.prototype.__initializeContextMenu = function()\r\n\t{\r\n\t\t//if(!this.__contextMenu)\r\n\t\t//{\r\n\t\t\tvar contextMenuSetting = {parent:this.__listContainer,isContextMenu:true,createRunTime:true,sourceProvider:this.__getContextMenuDataProvider.bind(this),targetType:\"LI\"};\r\n\t\t\tif(this.__contextMenuSetting)\r\n\t\t\t{\r\n\t\t\t\tfor(var key in this.__contextMenuSetting)\r\n\t\t\t\t{\r\n\t\t\t\t\t//grid setting should not be overriden by the users\r\n\t\t\t\t\tif(!contextMenuSetting[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontextMenuSetting[key] = this.__contextMenuSetting[key];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__contextMenu = new NSMenu(contextMenuSetting);\r\n\t\t//}\r\n\t};\r\n\t\r\n\tNSList.prototype.__getContextMenuDataProvider = function(listItem)\r\n\t{\r\n\t\tif(listItem)\r\n\t\t{\r\n\t\t\tlistItem = this.util.findParent(listItem,\"LI\");\r\n\t\t\tif(listItem)\r\n\t\t\t{\r\n\t\t\t\tvar index = this.__getIndexFromTarget(listItem);\r\n\t\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\t\tif(item && this.__contextMenuProvider) \r\n\t\t\t\t{\r\n\t\t\t\t\treturn this.__contextMenuProvider(item,index);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t/******************************************************End of Context Menu*************************************************************/\r\n\t/******************************Custom Function *************************************/\r\n\tNSList.prototype.__getIndexFromTarget = function(target)\r\n\t{\r\n\t\tif(target)\r\n\t\t{\r\n\t\t\treturn parseInt(target.getAttribute(\"ns-index\"));\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getListItemFromItem = function(item)\r\n\t{\r\n\t\tvar listItem = null;\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tlistItem = item[this.__fieldItem];\r\n\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t//below case is true if row reference has been removed due to virtual scroll \r\n\t\t\tvar listItemRawIndex = this.__getListItemRawIndex(listItem); \r\n\t\t\tif(!listItem || listItemRawIndex === -1)\r\n\t\t\t{\r\n\t\t\t\tvar arrListItem = this.__listContainer.querySelectorAll('[ns-index=\"' + index + '\"]');\r\n\t\t\t\tif(arrListItem && arrListItem.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tlistItem = arrListItem[0];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn listItem;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getListItemByIndex = function(index)\r\n\t{\r\n\t\tif(index > -1)\r\n\t    {\r\n\t    \tvar item = this.__getItemByIndex(index);\r\n\t    \tif(item)\r\n\t    \t{\r\n\t    \t\treturn item[this.__fieldItem];\r\n\t    \t}\r\n\t    }   \r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getListItemFromContainer = function(index)\r\n\t{\r\n\t\tif(this.__listContainer.children.length > index)\r\n\t\t{\r\n\t\t\treturn this.__listContainer.children[index];\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getItemByIndex = function(indexToFind,source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__objGrid.__getFlatSource();\r\n\t\t}\r\n\t\tif(source && source.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item && item[this.__fieldIndex] === indexToFind)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getIndexByItem = function(itemToFind,source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__objGrid.__getFlatSource();\r\n\t\t}\r\n\t\tif(itemToFind && source && source.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item && item[this.__fieldIndex] === itemToFind[this.__fieldIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item[this.__fieldIndex];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSList.prototype.__addItem = function(arrItem,atIndex)\r\n\t{\r\n\t\tvar flatSource = this.__objGrid.__getFlatSource();\r\n\t\tif(this.util.isUndefined(atIndex) || atIndex === null)\r\n\t\t{\r\n\t\t\tatIndex = flatSource.length;\r\n\t\t}\r\n\t\tif(arrItem && arrItem.length > 0)\r\n\t\t{\r\n\t\t\tif(this.__listContainer && this.__listContainer.children && this.__listContainer.children.length > 0 && this.__listContainer.children.length < 3)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < this.__listContainer.children.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar listItem = this.__listContainer.children[count];\r\n\t\t\t\t\tif(listItem.hasAttribute(\"nsNoData\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__listContainer.removeChild(listItem);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!this.__addRemoveRowCallInternal)\r\n\t   \t \t{\r\n\t\t\t\tthis.__objGrid.__setWrapperSource(arrItem,atIndex,-1,0,true);\r\n\t   \t \t};\r\n\t\t\tvar item = null;\r\n\t\t\tvar length = arrItem.length;\r\n\t\t\tvar index = -1;\r\n\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrItem[count];\r\n\t\t\t\tindex = atIndex + count;\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__dataSource.splice(index, 0, item);\r\n\t\t\t\t\tthis.__arrWrapper.splice(index, 0, item);\r\n\t\t\t\t\tthis.__arrInternalSource.splice(index, 0, item);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t/*flatSource = this.__objGrid.__getFlatSource();\r\n\t\t\tthis.__updateSourceIndex(flatSource);*/\r\n\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrItem[count];\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__createListAt(item,item[this.__fieldIndex]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__moveItem = function(arrItem,toIndex)\r\n\t{\r\n\t\tif(arrItem && arrItem.length > 0 && !this.util.isUndefined(toIndex) && toIndex !== null)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tvar length = arrItem.length;\r\n\t\t\tvar index = -1;\r\n\t\t\tvar fromIndex = -1;\r\n\t\t\tvar listContainer = this.__listContainer;\r\n\t\t\tvar listItem = null;\r\n\t\t\tfor(var count = length - 1;count >= 0;count--)\r\n\t\t\t{\r\n\t\t\t\titem = arrItem[count];\r\n\t\t\t\tindex = toIndex + count;\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tfromIndex = item[this.__fieldIndex];\r\n\t\t\t\t\tthis.util.moveArrayItem(this.__dataSource,fromIndex,index);\r\n\t\t\t\t\tthis.util.moveArrayItem(this.__arrWrapper,fromIndex,index);\r\n\t\t\t\t\tthis.util.moveArrayItem(this.__arrInternalSource,fromIndex,index);\r\n\t\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// donot use item[this.__fieldItem] for getting listItem as after de-serialization the reference get lost \r\n\t\t\t\t\t\t// hence getting the item back from dataSource\r\n\t\t\t\t\t\titem = this.__getItemByIndex(fromIndex);\r\n\t\t\t\t\t\tlistItem = item[this.__fieldItem];\r\n\t\t\t\t\t\tif(listItem)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(listItem.parentNode === listContainer)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tlistContainer.removeChild(listItem);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tindex = (index === 0) ? index : (index - 1);\r\n\t\t\t\t\t\t\tlistContainer.insertBefore(listItem, listContainer.children[index]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateSourceIndex = function(source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__getAllItems();\r\n\t\t}\r\n\t\tvar item = null;\r\n\t\tvar listItem = null;\r\n\t\tvar length = source.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\titem = source[count];\r\n\t\t\tvar index = this.__enableHierarchical ? (count + 1) : count;\r\n\t\t\titem[this.__fieldIndex] = index;\r\n\t\t\tlistItem = item[this.__fieldItem];\r\n\t\t\tif(listItem && this.util.isElementOfType(listItem,\"li\"))\r\n\t\t\t{\r\n\t\t\t\tlistItem.setAttribute(\"ns-index\",index);\r\n\t\t\t\tvar compArrow = listItem.querySelector(\".nsListArrow\");\r\n\t\t\t\tif(compArrow)\r\n\t\t\t\t{\r\n\t\t\t\t\tcompArrow.setAttribute(\"ns-parent-row-count\",index);\r\n\t\t\t\t\tvar arrowID = this.getID() + \"compArrow\" + index;\r\n\t\t\t\t\tcompArrow.setAttribute(\"id\",arrowID);\r\n\t\t\t\t\tvar compSvg = compArrow.querySelector(\"svg\");\r\n\t\t\t\t\tif(compSvg)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar svgID = arrowID + \"svg\";\r\n\t\t\t\t\t\tcompSvg.setAttribute(\"id\",svgID);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar compUse = compArrow.querySelector(\"use\");\r\n\t\t\t\t\tif(compUse)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar useID = arrowID + \"use\";\r\n\t\t\t\t\t\tcompUse.setAttribute(\"id\",useID);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__createArrow = function(item,parentRowCount,parentElement,isCollapsed)\r\n\t{\r\n\t\t if(parentElement)\r\n\t\t {\r\n\t\t\t var cellArrowParent = this.util.createDiv(null,\"nsListArrowParent\");\r\n\t\t\t var arrowID = this.getID() + \"compArrow\" + parentRowCount;\r\n\t\t\t var compArrow = this.util.createDiv(arrowID,\"nsListArrow\");\r\n\t\t\t compArrow.style.paddingTop = \"3px\";\r\n\t\t\t compArrow.setAttribute(\"ns-parent-row-count\",parentRowCount);\r\n\t\t\t \r\n\t\t\t var objSVG = new NSSvg();\r\n\t\t\t this.__objGrid.__createArrow(compArrow,objSVG,arrowID,isCollapsed);\r\n\t\t\t this.util.addEvent(compArrow,\"click\",this.__arrowClickHandler.bind(this));\r\n\t\t\t cellArrowParent.appendChild(compArrow);\r\n\t\t\t parentElement.appendChild(cellArrowParent);\r\n\t\t\t item[this.__fieldItemArrow] = compArrow;\r\n\t\t\t return compArrow;\r\n\t\t }\r\n\t\t return null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__setArrowDirection = function(compArrow,isCollapsed)\r\n\t{\r\n\t\tif(compArrow)\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tvar useID = compArrow.getAttribute(\"id\") + \"use\";\r\n\t\t\tthis.__objGrid.__setArrowDirection(objSVG,useID,isCollapsed);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__isArrowCollapsed = function(compArrow)\r\n\t{\r\n\t\tif(compArrow && compArrow.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t{\r\n\t\t\tvar rowIndex = parseInt(compArrow.getAttribute(\"ns-parent-row-count\"));\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\treturn item[this.__fieldIsCollapsed];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSList.prototype.__arrowClickHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"DIV\");\r\n\t\tif(target && target.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t{\r\n\t\t\tvar rowIndex = target.getAttribute(\"ns-parent-row-count\");\r\n\t\t\tvar isCollapse = this.__isArrowCollapsed(target);\r\n\t\t\trowIndex = parseInt(rowIndex);\r\n\t\t\tif(rowIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\tif(item[this.__childField]  && item[this.__childField].length > 0)\r\n\t\t        {\r\n\t\t\t\t\tthis.__showHideRow(rowIndex,target,!isCollapse);\r\n\t\t        }\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__objGrid.__handleOnDemandClick(item,event);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tevent.stopImmediatePropagation();\r\n\t};\r\n\t\r\n\tNSList.prototype.__expandCollapseAll = function(isCollapse)\r\n\t{\r\n\t\tif(!this.__enableVirtualScroll && this.__getTotalListItems() < this.__totalRecords)\r\n\t\t{\r\n\t\t\tthis.util.warning(\"nsList\",\"Please let all the items to render.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar dataSource = this.__arrInternalSource;\r\n\t\tif(dataSource && dataSource.length > 0)\r\n\t\t{\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__expandCollapseAllVirtual(dataSource,isCollapse);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__expandCollapseAllNormal(dataSource,isCollapse);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__expandCollapseAllNormal = function(dataSource,isCollapse)\r\n\t{\r\n\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t{\r\n\t\t\tvar item = dataSource[count];\r\n\t\t\t//setting __fieldIsCollapsed here assuming that __showHideAllArrows() will be called after this function\r\n\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\tif(parseInt(item[this.__fieldItemLevel]) > 0)\r\n\t\t\t{\r\n\t\t\t\tvar row = item[this.__fieldItem];\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"none\";\r\n\t\t\t\t\titem[this.__fieldItemVisible] = false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"\";\r\n\t\t\t\t\titem[this.__fieldItemVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__showHideAllArrows(isCollapse);\r\n\t};\r\n\t\r\n\tNSList.prototype.__expandCollapseAllVirtual = function(dataSource,isCollapse)\r\n\t{\r\n\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t{\r\n\t\t\tvar item = dataSource[count];\r\n\t\t\t//setting __fieldIsCollapsed here assuming that __showHideAllArrows() will be called after this function\r\n\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\tif(parseInt(item[this.__fieldItemLevel]) > 0)\r\n\t\t\t{\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__fieldItemVisible] = false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__fieldItemVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__showHideAllArrows(isCollapse);\r\n\t\tthis.__updateVisibleIndex(null,0);\r\n\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t};\r\n\t\r\n\tNSList.prototype.__showHideRow = function(rowIndex,compArrow,isCollapse)\r\n\t{\r\n\t\tif(rowIndex > -1)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tif(!compArrow)\r\n\t\t\t{\r\n\t\t\t\tcompArrow = this.__getArrow(item[this.__fieldIndex]);\r\n\t\t\t}\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldItemLevel]);\r\n\t\t\tvar arrChildItems = [];\r\n\t\t\tif(item && item[this.__fieldHasChild])\r\n\t\t\t{\r\n\t\t\t\tvar startIndex = 0;\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildItems = this.__arrInternalSource;\r\n\t\t\t\t\tstartIndex = rowIndex;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildItems = this.__getImmediateChildItems(arrChildItems, item);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__showHideRowVirtual(item,arrChildItems,startIndex,rowLevel,isCollapse);\r\n\t\t\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\t\t\t//this.__updateItemInSource(item);\r\n\t\t\t\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__showHideRowNormal(item,arrChildItems,startIndex,rowLevel,isCollapse);\r\n\t\t\t\t\tthis.__setArrowDirection(compArrow,isCollapse);\r\n\t\t\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__showHideRowNormal = function(item,arrChildItems,startIndex,rowLevel,isCollapse)\r\n\t{\r\n\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t{\r\n\t\t\tif(isCollapse)\r\n\t\t\t{\r\n\t\t\t\tvar retIndex = this.__getActualIndex(arrChildItems,startIndex);\r\n\t\t\t\tif(retIndex !== startIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar rowItem = null;\r\n\t\t\tfor(var count = startIndex;count < arrChildItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\trowItem = arrChildItems[count];\r\n\t\t\t\tvar row = rowItem[this.__fieldItem];\r\n\t\t\t\tif(!row)\r\n\t\t\t\t{\r\n\t\t\t\t\trow = this.__createListAt(rowItem,rowItem[this.__fieldIndex] - 1,false);\r\n\t\t\t\t\trowItem[this.__fieldItem] = row;\r\n\t\t\t\t\tthis.__updateSourceIndex();\r\n\t\t\t\t}\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLevel >= parseInt(rowItem[this.__fieldItemLevel]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trow.style.display = \"none\";\r\n\t\t\t\t\trowItem[this.__fieldItemVisible] = false;\r\n\t\t\t\t\tif(rowItem[this.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trowItem[this.__fieldIsCollapsed] = true;\r\n\t\t\t\t\t\tif(rowItem[this.__fieldItemArrow])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar divArrow = rowItem[this.__fieldItemArrow];\r\n\t\t\t\t\t\t\tif(divArrow)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tthis.__setArrowDirection(divArrow,true);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"\";\r\n\t\t\t\t\trowItem[this.__fieldItemVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__showHideRowVirtual = function(item,arrChildItems,startIndex,rowLevel,isCollapse)\r\n\t{\r\n\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t{\r\n\t\t\tif(isCollapse)\r\n\t\t\t{\r\n\t\t\t\tvar retIndex = this.__getActualIndex(arrChildItems,startIndex);\r\n\t\t\t\tif(retIndex !== startIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor(var count = startIndex;count < arrChildItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar rowItem = arrChildItems[count];\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLevel >= parseInt(rowItem[this.__fieldItemLevel]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trowItem[this.__fieldItemVisible] = false;\r\n\t\t\t\t\tif(rowItem[this.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trowItem[this.__fieldIsCollapsed] = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trowItem[this.__fieldItemVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\tthis.__updateVisibleIndex(null,index - 1);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__showHideAllArrows = function(isCollapse)\r\n\t{\r\n\t\tvar arrDivs = this.__getAllArrows();\r\n\t\tif(arrDivs && arrDivs.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrDivs.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar div = arrDivs[count];\r\n\t\t\t\tif(div && div.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__setArrowDirection(div,isCollapse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__getAllItems = function()\r\n\t{\r\n\t\treturn this.__objGrid.__getFlatSource();\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateListItemText = function(listItem,item,index)\r\n\t{\r\n\t\treturn this.__objGrid.__updateListItemText(listItem,item,index);\r\n\t};\r\n\t\r\n\tNSList.prototype.__getImmediateChildItems = function(arrItems,item)\r\n\t{\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = [];\r\n\t\t}\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChild = this.__arrInternalSource;\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldItemLevel]);\r\n\t\t\tvar startIndex = item[this.__fieldIndex];\r\n\t\t\tvar retIndex = this.__getActualIndex(arrChild,startIndex);\r\n\t\t\tif(retIndex !== startIndex)\r\n\t\t\t{\r\n\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t}\r\n\t\t\tvar length = arrChild.length;\r\n\t\t\tfor(var count = startIndex;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar itemChild = arrChild[count];\r\n\t\t\t\tvar childRowLevel = parseInt(itemChild[this.__fieldItemLevel]);\r\n\t\t\t\tif(rowLevel >= childRowLevel)\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif((rowLevel + 1) === childRowLevel)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrItems.push(itemChild);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrItems;\r\n\t};\r\n\t\r\n\t//generally used for Filter condition\r\n\tNSList.prototype.__getActualIndex = function(arrChild,startIndex,addCompareOne)\r\n\t{\r\n\t\t//(startIndex + 1) as __fieldIndex starts from 1\r\n\t\t//if(arrChild && arrChild.length < startIndex || arrChild[startIndex][this.__fieldIndex] !== (startIndex + 1))\r\n\t\tif(arrChild && arrChild.length > startIndex && arrChild[startIndex][this.__fieldIndex] !== (startIndex + 1))\r\n\t\t{\r\n\t\t\tvar compareIndex = startIndex;\r\n\t\t\tif(addCompareOne)\r\n\t\t\t{\r\n\t\t\t\tcompareIndex += 1;\r\n\t\t\t}\r\n\t\t\tvar rowItem = null;\r\n\t\t\tfor(var count = 0;count < arrChild.length;count++)\r\n\t\t\t{\r\n\t\t\t\trowItem = arrChild[count];\r\n\t\t\t\tif(rowItem[this.__fieldIndex] === compareIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn count;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn startIndex;\r\n\t};\r\n\t\r\n\t\r\n\tNSList.prototype.__getAllChildItems = function(arrItems,item)\r\n\t{\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = [];\r\n\t\t}\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChild = this.__arrInternalSource;\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldItemLevel]);\r\n\t\t\tvar startIndex = item[this.__fieldIndex];\r\n\t\t\tvar length = arrChild.length;\r\n\t\t\tfor(var count = startIndex;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar itemChild = arrChild[count];\r\n\t\t\t\tif(rowLevel >= parseInt(itemChild[this.__fieldItemLevel]))\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tarrItems.push(itemChild);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrItems;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getAllVisibleItems = function()\r\n\t{\r\n\t\tvar totalRecords = 0;\r\n\t\tvar arrItems = this.__getAllItems();\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = arrItems[count];\r\n\t\t\t\tif(item && item[this.__fieldItemVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\ttotalRecords += 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn totalRecords;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getFirstVisibleItemBeforeIndex = function(itemIndex)\r\n\t{\r\n\t\tvar arrItems = this.__getAllItems();\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar retIndex = this.__getActualIndex(arrItems,itemIndex);\r\n\t\t\tif(retIndex !== itemIndex)\r\n\t\t\t{\r\n\t\t\t\titemIndex = (retIndex + 1);\r\n\t\t\t}\r\n\t\t\tfor(var count = itemIndex;count >= 0;count--)\r\n\t\t\t{\r\n\t\t\t\tvar item = arrItems[count];\r\n\t\t\t\tif(item && item[this.__fieldItemVisible] && item[this.__fieldVisibleIndex] > -1)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getVisibleItemByIndex = function(source,index)\r\n\t{\r\n\t\tvar arrItems = source;\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = this.__getAllItems();\r\n\t\t}\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar self = this; \r\n\t\t\tvar findItem = function(itemCompare)\r\n\t\t\t{\r\n\t\t\t\t return (itemCompare[self.__fieldVisibleIndex] === (index + 1));\r\n\t\t\t};\r\n\t\t\treturn arrItems.find(findItem);\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateVisibleIndex = function(source,fromIndex)\r\n\t{\r\n\t\tvar arrItems = source;\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = this.__getAllItems();\r\n\t\t}\r\n\t\tif(this.util.isUndefinedOrNull(fromIndex))\r\n\t\t{\r\n\t\t\tfromIndex = 0;\r\n\t\t}\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar visibleRowIndex = 1;\r\n\t\t\tif(fromIndex > 0)\r\n\t\t\t{\r\n\t\t\t\tvar visibleItem = this.__getFirstVisibleItemBeforeIndex(fromIndex);\r\n\t\t\t\tif(visibleItem)\r\n\t\t\t\t{\r\n\t\t\t\t\tvisibleRowIndex = visibleItem[this.__fieldVisibleIndex];\r\n\t\t\t\t\tfromIndex = visibleItem[this.__fieldIndex] - 1;\r\n\t\t\t\t\tvar retIndex = this.__getActualIndex(arrItems,fromIndex,true);\r\n\t\t\t\t\tif(retIndex !== fromIndex)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfromIndex = retIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar length = arrItems.length;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = fromIndex; count < length; count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrItems[count];\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item[this.__fieldItemVisible])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = visibleRowIndex;\r\n\t\t\t\t\t\tvisibleRowIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateVisibleIndexByListItem = function(source,arrAllItems)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tvar arrItems = arrAllItems;\r\n\t\t\tif(!arrItems)\r\n\t\t\t{\r\n\t\t\t\tarrItems = this.__getAllItems();\r\n\t\t\t}\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar item = null;\r\n\t\t\tvar objVisibleIndex = {};\r\n\t\t\tfor(var count = 0; count < length; count++)\r\n\t\t\t{\r\n\t\t\t\titem = source[count];\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t\t\tobjVisibleIndex[index] = \"NSList\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(arrItems && arrItems.length > 0)\r\n\t\t\t{\r\n\t\t\t\tlength = arrItems.length;\r\n\t\t\t\titem = null;\r\n\t\t\t\tvar visibleRowIndex = 1;\r\n\t\t\t\tfor(var count = 0; count < length; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t\t\tif(this.util.isUndefinedOrNull(objVisibleIndex[index]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = -1;\r\n\t\t\t\t\t\titem[this.__fieldItemVisible] = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = visibleRowIndex;\r\n\t\t\t\t\t\titem[this.__fieldItemVisible] = true;\r\n\t\t\t\t\t\tvisibleRowIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateIndexForAllItems = function(source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__getAllItems();\r\n\t\t}\r\n\t\tvar length = source.length;\r\n\t\tvar item = null;\r\n\t\tfor(var count = 0; count < length; count++)\r\n\t\t{\r\n\t\t\titem = source[count];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldIndex] = count;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__getArrow = function(rowCount)\r\n\t{\r\n\t\tvar arrDivs = this.__getAllArrows();\r\n\t\tif(arrDivs && arrDivs.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrDivs.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar div = arrDivs[count];\r\n\t\t\t\tif(div && div.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar rowParentCount = div.getAttribute(\"ns-parent-row-count\");\r\n\t\t\t\t\tif(rowParentCount && rowParentCount == rowCount)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn div;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getAllArrows = function(divParent)\r\n\t{\r\n\t\tif(!divParent)\r\n\t\t{\r\n\t\t\tdivParent = this.__listContainer;\r\n\t\t}\r\n\t\treturn divParent.querySelectorAll(\".nsListArrow\");\r\n\t};\r\n\t\r\n\tNSList.prototype.__getTotalListItems = function()\r\n\t{\r\n\t\tif(this.__listContainer && this.__listContainer.children)\r\n\t\t{\r\n\t\t\treturn this.__listContainer.children.length;\r\n\t\t}\r\n\t\treturn 0;\r\n\t};\r\n\t\r\n\tNSList.prototype.__updateTotalRecords = function(totalCount)\r\n\t{\r\n\t\tif(this.util.isUndefined(totalCount) || totalCount === null)\r\n\t\t{\r\n\t\t\ttotalCount = this.__arrInternalSource.length; \r\n\t\t}\r\n\t\tthis.__totalRecords = totalCount;\r\n\t};\r\n\t\r\n\tNSList.prototype.__getListItemRawIndex = function(listItem)\r\n\t{\r\n\t\tif(listItem && listItem.parentNode)\r\n\t\t{\r\n\t\t\tvar index = [].slice.call(listItem.parentNode.children).indexOf(listItem);\r\n\t\t\treturn index;\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSList.prototype.__checkForVirtualMode = function()\r\n\t{\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tif(this.__enablePagination)\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVirtualScroll = false;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSList.prototype.__setVirtualScroll_ScrollTop = function(scrollTop)\r\n\t{\r\n\t\tif(this.__enableCustomScrollBar)\r\n\t\t{\r\n\t\t\tif(this.__scroller)\r\n\t\t\t{\r\n\t\t\t\tthis.__scroller.setScrollTop(scrollTop);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tvar NSFlatList = function(nsList)\r\n\t{\r\n\t\tthis.__nsList = nsList;\r\n\t\tthis.util = nsList.util;\r\n\t\t/********************************Common Functions for Grid ****************************************/\r\n\t\tthis.__initialize = function()\r\n\t\t{\r\n\t\t};\r\n\t\t\r\n\t\tthis.dataSource = function(source)\r\n\t\t{\r\n\t\t\tthis.__nsList.__arrWrapper = this.__nsList.__dataSource.slice(0);\r\n\t\t\tthis.__setWrapperSource(this.__nsList.__arrWrapper,0,-1,0,true);\r\n\t\t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrWrapper.slice(0);\r\n\t\t\tthis.__nsList.__updateTotalRecords();\r\n\t\t};\r\n\t\t\r\n\t\tthis.addItemsAsChildren = function(item,arrChildren)\r\n\t\t{\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex)\r\n\t\t{\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tif(!offset)\r\n\t\t\t\t{\r\n\t\t\t\t\toffset = 0;\r\n\t\t\t\t}\r\n\t\t\t\tvar length = source.length;\r\n\t\t\t\tvar count = 0;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar index = -1; \r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tindex = offset + count;\r\n\t\t\t\t\tthis.__setItemProperty(item,index,setFieldIndex);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__createList= function(dataSet,startIndex,endIndex)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tvar index = -1;\r\n\t\t    for(var count = startIndex; count < endIndex; count++)\r\n\t\t     {\r\n\t    \t\titem = dataSet[count];\r\n\t    \t\tindex =  item[this.__nsList.__fieldIndex];\r\n\t    \t\tthis.__nsList.__updateItem(item,index);\r\n\t    \t\tthis.__nsList.__createListItem(item);\r\n\t\t     }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createListItem = function(listItem,item)\r\n\t\t{\r\n\t\t};\r\n\t\r\n\t\tthis.__addSVGInPage = function()\r\n\t\t{\r\n\t\t};\r\n\t\r\n\t\tthis.__setListItemProperties = function(listItem,item)\r\n\t\t{\r\n\t\t\tif(listItem && item)\r\n\t\t\t{\r\n\t\t\t\tvar index = item[this.__nsList.__fieldIndex];\r\n\t\t\t\tlistItem.setAttribute(\"ns-index\",index);\r\n\t\t\t\titem[this.__nsList.__fieldItem] = listItem;\r\n\t\t\t\tthis.util.removeAllChildren(listItem);\r\n\t\t\t\tvar divCell = this.util.createDiv(null,\"nsListChild\");\r\n\t\t\t\tthis.util.addStyleClass(divCell,this.__nsList.__CLASS_CELL_CHILD);\r\n\t\t\t\tlistItem.appendChild(divCell);\r\n\t\t\t\tthis.__nsList.__addCellText(listItem,item,divCell);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__updateListItemText = function(listItem,item,index)\r\n\t\t{\r\n\t\t\tif(listItem && item)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeAllChildren(listItem);\r\n\t\t\t\tthis.__setListItemProperties(listItem,item);\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__getFlatSource= function()\r\n\t\t{\r\n\t\t\treturn this.__nsList.__arrWrapper;\r\n\t\t};\r\n\t\t/********************************Common Functions for Grid ****************************************/\r\n\t\tthis.__setItemProperty = function(item,rowIndex,setFieldIndex)\r\n\t\t{\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(setFieldIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__fieldIndex] = rowIndex;\r\n\t\t\t\t}\r\n\t\t\t\titem[this.__nsList.__fieldVisibleIndex] = rowIndex + 1;\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__resetListItem = function(listItem,index,item)\r\n\t\t{\r\n\t\t\tlistItem.style.display = \"\";\r\n\t\t\tlistItem.setAttribute(\"ns-index\",index);\r\n\t\t\tthis.util.removeStyleClass(listItem,\"nsListItemSelected\");\r\n\t\t\tthis.__nsList.__updateItem(item,index);\r\n\t\t\tthis.__setListItemProperties(listItem,item);\r\n\t\t};\r\n\t};\r\n\t\r\n\tvar NSHierarchicalList = function(nsList)\r\n\t{\r\n\t\tthis.__nsList = nsList;\r\n\t\tthis.util = nsList.util;\r\n\t\tthis.__ARROW_COLLAPSE_PATH = \"M 0 9.99994L 6.10352e-005 -3.05176e-005L 5 5.00006L 0 9.99994 Z\";\r\n\t\tthis.__ARROW_EXPANDED_PATH = \"M 0 3.05176e-005L 9.99994 9.15527e-005L 4.99988 5.00003L 0 3.05176e-005 Z\";\r\n\t\tthis.__CLASS_ARROW = \"nsListArrowFill\";\r\n\t\tthis.__rowCounter = -1;\r\n\t\tthis.__enableOnDemandHierarchy = false;\r\n\t\tthis.__onDemandChildDetectionField = \"hasChildren\";\r\n\t\tthis.__onDemandChildFetchCallback = null;\r\n\t\t/********************************Common Functions for Grid ****************************************/\r\n\t\tthis.__initialize = function()\r\n\t\t{\r\n\t\t\tvar setting = this.__nsList.__setting;\r\n\t\t\tif(setting.hasOwnProperty(\"enableOnDemandHierarchy\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableOnDemandHierarchy = Boolean.parse(setting[\"enableOnDemandHierarchy\"]);\r\n\t\t\t}\r\n\t\t\tif(this.__enableOnDemandHierarchy)\r\n\t\t\t{\r\n\t\t\t\tif(setting.hasOwnProperty(\"onDemandChildDetectionField\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__onDemandChildDetectionField = setting[\"onDemandChildDetectionField\"];\r\n\t\t\t\t}\r\n\t\t\t\tif(setting.hasOwnProperty(\"onDemandChildFetchCallback\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__onDemandChildFetchCallback = setting[\"onDemandChildFetchCallback\"];\r\n\t\t\t\t\tthis.__onDemandChildFetchCallback = this.util.getFunction(this.__onDemandChildFetchCallback);\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__onDemandChildDetectionField)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.throwNSError(\"NSList\",\"Value for onDemandChildDetectionField is not valid\");\r\n\t\t\t\t}\r\n\t\t\t\tif(!this.__onDemandChildFetchCallback)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.throwNSError(\"NSList\",\"Value for onDemandChildFetchCallback is not valid\");\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.warning(\"NSList\",\"As enableVirtualScroll is true so OnDemandHierarchy will have no impact.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.dataSource = function(source)\r\n\t\t{\r\n\t\t\tthis.__nsList.__arrWrapper = this.__nsList.__dataSource.slice(0);\r\n\t\t\tthis.__setWrapperSource(this.__nsList.__arrWrapper,0,-1,0,true,true,true);\r\n\t\t\tthis.__nsList.__updateTotalRecords(this.__rowCounter);\r\n\t\t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrFlatHierarchicalSource.slice(0);\r\n\t\t};\r\n\t\t\r\n\t\tthis.addItemsAsChildren = function(item,arrChildren)\r\n\t\t{\r\n\t\t\tif(item && arrChildren && arrChildren.length > 0)\r\n\t\t\t{\r\n\t\t\t\tif(!item[this.__nsList.__childField])\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__childField] = [];\r\n\t\t\t\t}\r\n\t\t\t\titem[this.__nsList.__childField].push.apply(item[this.__nsList.__childField], arrChildren);\r\n\t\t\t\tthis.__setWrapperSource(this.__nsList.__arrWrapper,0,-1,0,true,false,false);\r\n\t\t\t\tthis.__nsList.__updateTotalRecords(this.__rowCounter);\r\n\t\t\t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrFlatHierarchicalSource.slice(0);\r\n\t\t\t\titem[this.__nsList.__fieldItemVisible] = true;\r\n\t\t\t\titem[this.__nsList.__fieldIsCollapsed] = false;\r\n\t\t   \t\tvar listItem = this.__nsList.__getListItemFromItem(item);\r\n\t\t   \t\tvar rowIndex = this.__nsList.__getIndexByItem(item);\r\n\t\t   \t\tthis.__nsList.__showHideRow(rowIndex,null,false);\r\n\t\t   \t\tconsole.log(this.__nsList.__arrFlatHierarchicalSource);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__setWrapperSource = function(source,offset,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t\t{\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tif(level === 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!offset)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\toffset = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__nsList.__arrFlatHierarchicalSource = [];\r\n\t\t\t\t\tthis.__rowCounter = offset;\r\n\t\t\t\t}\r\n\t\t\t\tvar length = source.length;\r\n\t\t\t\tvar count = 0;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tfor (count = 0; count < length; count++) \r\n\t\t\t\t{\r\n\t\t\t\t\titem = source[count];\r\n\t\t\t\t\tthis.__rowCounter++;\r\n\t\t\t\t\tthis.__nsList.__arrFlatHierarchicalSource.push(item);\r\n\t\t\t\t\tthis.__setItemProperty(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__createList= function(dataSet,startIndex,endIndex)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tvar index = -1;\r\n\t\t    for(var count = startIndex; count < endIndex; count++)\r\n\t\t    {\r\n\t    \t\titem = dataSet[count];\r\n\t    \t\tif(item)\r\n\t    \t\t{\r\n\t    \t\t\tindex =  item[this.__nsList.__fieldIndex];\r\n\t        \t\tthis.__nsList.__updateItem(item,index);\r\n\t        \t\tthis.__nsList.__createListItem(item);\r\n\t    \t\t}\r\n\t\t    }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createListItem = function(listItem,item)\r\n\t\t{\r\n\t\t};\r\n\t\r\n\t\tthis.__addSVGInPage = function()\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tobjSVG.addPath(\"svgListArrowDown\",this.__ARROW_EXPANDED_PATH,\"0 0 16 16\");\r\n\t\t\tobjSVG.addPath(\"svgListArrowRight\",this.__ARROW_COLLAPSE_PATH,\"0 0 16 16\");\r\n\t\t};\r\n\t\r\n\t\tthis.__setListItemProperties = function(listItem,item)\r\n\t\t{\r\n\t\t\tif(listItem && item)\r\n\t\t\t{\r\n\t\t\t\tvar index = item[this.__nsList.__fieldIndex];\r\n\t\t\t\tvar level = item[this.__nsList.__fieldItemLevel];\r\n\t\t\t\tvar parentIndex = item[this.__nsList.__fieldParentIndex];\r\n\t\t\t\tlistItem.setAttribute(\"ns-index\",index);\r\n\t\t\t\tlistItem.setAttribute(\"ns-level\",level);\r\n\t\t\t\tif(item[this.__nsList.__fieldHasParent])\r\n\t\t\t    {\r\n\t\t\t\t\tlistItem.setAttribute(\"ns-parent-index\",parentIndex);\r\n\t\t\t    }\r\n\t\t\t\titem[this.__nsList.__fieldItem] = listItem;\r\n\t\t\t\tthis.util.removeAllChildren(listItem);\r\n\t\t\t\tvar divCell = this.util.createDiv(null,\"nsListChild\");\r\n\t\t\t\tlistItem.appendChild(divCell);\r\n\t\t\t\t\r\n\t\t\t\tvar hierarchicalPadding = 0;\r\n\t\t\t\tvar divText = null;\r\n\t\t\t\tif(item && item.hasOwnProperty(this.__nsList.__labelField) && item[this.__nsList.__labelField])\r\n\t\t\t\t{\r\n\t\t\t        if((item[this.__nsList.__childField]  && item[this.__nsList.__childField].length > 0) || (this.__isOnDemandHasChildren(item)))\r\n\t\t\t        {\r\n\t\t\t        \tthis.util.addStyleClass(divCell,this.__nsList.__CLASS_GROUP_CELL);\r\n\t\t\t        \tthis.__nsList.__createArrow(item,index,divCell,item[this.__nsList.__fieldIsCollapsed]);\r\n\t\t\t        \tvar cellText = this.util.createDiv(null,this.__nsList.__CLASS_CELL_CHILD);\r\n\t\t\t        \tthis.util.addStyleClass(cellText,\"nsListGroupCellText\");\r\n\t\t\t        \tcellText.style.verticalAlign = \"top\";\r\n\t\t\t        \tdivText = cellText;\r\n\t\t\t        \tdivCell.appendChild(cellText);\r\n\t\t\t        }\r\n\t\t\t        else\r\n\t\t\t        {\r\n\t\t\t        \tthis.util.addStyleClass(divCell,this.__nsList.__CLASS_CELL_CHILD);\r\n\t\t\t        \tdivText = divCell;\r\n\t\t\t        \t//24 = 16(Arrow Width) + 6(Arrow Parent Padding) + 2(divCell horizontalGap between elements shown in debugger)\r\n\t\t\t        \thierarchicalPadding = 24;\r\n\t\t\t        }\r\n\t\t\t        this.__nsList.__addCellText(listItem,item,divText);\r\n\t\t        \tif(level === 0)\r\n\t\t        \t{\r\n\t\t        \t\tlistItem.style.paddingLeft = \"1px\";\r\n\t\t        \t}\r\n\t\t        \telse\r\n\t\t        \t{\r\n\t\t        \t\tvar paddingLeft = (10 * level) + hierarchicalPadding;\r\n\t\t        \t\tlistItem.style.paddingLeft = paddingLeft + \"px\";\r\n\t\t        \t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__updateListItemText = function(listItem,item,index)\r\n\t\t{\r\n\t\t\tif(listItem && item)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeAllChildren(listItem);\r\n\t\t\t\tthis.__setListItemProperties(listItem,item);\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__getFlatSource= function()\r\n\t\t{\r\n\t\t\treturn this.__nsList.__arrFlatHierarchicalSource;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleOnDemandClick = function(item,event)\r\n\t\t{\r\n\t\t\tif(item && this.__isOnDemandHasChildren(item))\r\n\t\t\t{\r\n\t\t\t\tif(this.__onDemandChildFetchCallback)\r\n\t\t\t\t{\r\n\t\t\t\t\tevent = this.util.getEvent(event);\r\n\t\t\t\t\tvar rowLevel = item[this.__nsList.__fieldItemLevel];\r\n\t\t\t\t\tvar rowIndex = this.__nsList.__getIndexByItem(item);\r\n\t\t\t\t\tthis.__onDemandChildFetchCallback(item,rowIndex,rowLevel,event);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t/********************************Common Functions for Grid ****************************************/\r\n\t\tthis.__setItemProperty = function(item,parentIndex,level,setFieldIndex,setIsCollapsed,setItemVisible)\r\n\t\t{\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isUndefinedOrNull(setIsCollapsed))\r\n\t\t\t\t{\r\n\t\t\t\t\tsetIsCollapsed = true;\r\n\t\t\t\t}\r\n\t\t\t\tif(this.util.isUndefinedOrNull(setItemVisible))\r\n\t\t\t\t{\r\n\t\t\t\t\tsetItemVisible = true;\r\n\t\t\t\t}\r\n\t\t\t\tvar totalRowCount = this.__rowCounter;\r\n\t\t\t\tif(setFieldIndex || this.util.isUndefinedOrNull(item[this.__nsList.__fieldIndex]))\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__fieldIndex] = totalRowCount;\r\n\t\t\t\t}\r\n\t\t\t\titem[this.__nsList.__fieldVisibleIndex] = totalRowCount;\r\n\t\t\t\titem[this.__nsList.__fieldItemLevel] = level;\r\n\t\t\t\tvar hasChild = false;\r\n\t\t\t\tif(item.hasOwnProperty(this.__nsList.__childField) && item[this.__nsList.__childField] && item[this.__nsList.__childField].length > 0)\r\n\t\t\t    {\r\n\t\t\t    \thasChild = true;\r\n\t\t\t    \tthis.__setWrapperSource(item[this.__nsList.__childField],0,totalRowCount,level + 1,setFieldIndex,setIsCollapsed,setItemVisible);\r\n\t\t\t    }\r\n\t\t\t\titem[this.__nsList.__fieldParentIndex] = parentIndex;\r\n\t\t\t\tif(parentIndex > -1)\r\n\t\t\t    {\r\n\t\t\t\t\titem[this.__nsList.__fieldHasParent] = true;\r\n\t\t\t    }\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__fieldHasParent] = false;\r\n\t\t\t\t}\r\n\t\t\t\titem[this.__nsList.__fieldHasChild] = hasChild;\r\n\t\t\t\tif(setItemVisible || this.util.isUndefinedOrNull(item[this.__nsList.__fieldItemVisible]))\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__fieldItemVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t\tif(setIsCollapsed || this.util.isUndefinedOrNull(item[this.__nsList.__fieldIsCollapsed]))\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__nsList.__fieldIsCollapsed] = this.__isOnDemandHasChildren(item);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createArrow = function(compArrow,objSVG,arrowID,isCollapsed)\r\n\t\t{\r\n\t\t\t var svg = objSVG.addSVG(compArrow,arrowID + \"svg\",this.__CLASS_ARROW,null,null,null,null,null,null,true);\r\n\t\t\t if(isCollapsed)\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgListArrowRight\");\r\n\t\t\t }\r\n\t\t\t else\r\n\t\t\t {\r\n\t\t\t\t objSVG.addUse(svg,arrowID + \"use\",null,\"#svgListArrowDown\");\r\n\t\t\t }\r\n\t\t};\r\n\t\r\n\t\tthis.__setArrowDirection = function(objSVG,useID,isCollapsed)\r\n\t\t{\r\n\t\t\tif(isCollapsed)\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgListArrowRight\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjSVG.changeUseHref(useID,\"#svgListArrowDown\");\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__resetListItem = function(listItem,index,item)\r\n\t\t{\r\n\t\t\tlistItem.style.display = \"\";\r\n\t\t\tlistItem.setAttribute(\"ns-index\",index);\r\n\t\t\tthis.util.removeStyleClass(listItem,\"nsListItemSelected\");\r\n\t\t\tthis.__nsList.__updateItem(item,index);\r\n\t\t\tthis.__setListItemProperties(listItem,item);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isOnDemandHasChildren = function(item)\r\n\t\t{\r\n\t\t\treturn (this.__enableOnDemandHierarchy && item[this.__onDemandChildDetectionField]);\r\n\t\t};\r\n\t};\r\n\t\r\n\tvar NSListFilter = function(nsList)\r\n\t{\r\n\t\tthis.__nsList = nsList;\r\n\t\t\r\n\t\tthis.util = nsList.util;\r\n\t\tthis.__filteredColumn = [];\r\n\t\tthis.__config = {};\r\n\t\tthis.__nsDragDrop = null;\r\n\t\t\r\n\t\tthis.__initialize = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\t\r\n\t\tthis.filter = function(strData,filterSetting,enableHighlighting,recordLimit)\r\n\t\t{\r\n\t\t\tif(!filterSetting)\r\n\t\t\t{\r\n\t\t\t\tfilterSetting = {};\r\n\t\t\t}\r\n\t\t\tif(this.util.isUndefinedOrNull(enableHighlighting))\r\n\t\t\t{\r\n\t\t\t\tenableHighlighting = true;\r\n\t\t\t}\r\n\t\t\tvar config = {\r\n\t\t\t\t\tcaseSensitive: this.util.isUndefinedOrNull(filterSetting[\"caseSensitive\"]) ? false : Boolean.parse(filterSetting[\"caseSensitive\"]),\r\n\t\t\t\t\tmultiline: this.util.isUndefinedOrNull(filterSetting[\"multiline\"]) ? false : Boolean.parse(filterSetting[\"multiline\"]),\r\n\t\t\t\t\tmatchType: filterSetting[\"matchType\"] || new NSFilter().CONTAINS\r\n\t\t\t};\r\n\t\t\tvar filter = {};\r\n\t\t\tvar setting = {};\r\n\t\t\tvar field = this.__nsList.__labelField;\r\n\t\t\tfilter[field] = strData;\r\n\t\t\tsetting[field] = {caseSensitive:config[\"caseSensitive\"],multiline:config[\"multiline\"],matchType:config[\"matchType\"]};\r\n\t\t\tif(filter && Object.keys(filter).length > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__handleFiltering(filter,setting,enableHighlighting,recordLimit);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__resetFiltering();\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.reset = function()\r\n\t\t{\r\n\t\t\tthis.__resetFiltering();\r\n\t\t};\r\n\t\t\r\n\t\tthis.__handleFiltering = function(filter,setting,enableHighlighting,recordLimit)\r\n\t\t{\r\n\t\t\tthis.__filteredColumn = [];\r\n\t\t\tif(filter)\r\n\t\t    {\r\n\t\t\t\t var field = this.__nsList.__labelField;\r\n\t\t\t\t var source = this.__nsList.__arrWrapper;\r\n\t\t\t\t var isHierarchical = false;\r\n\t\t\t\t if(this.__nsList.__enableHierarchical)\r\n\t\t\t\t {\r\n\t\t\t\t\t isHierarchical = true;\r\n\t\t\t\t }\r\n\t\t\t   \t var nsFilter = new NSFilter(source,filter,setting,recordLimit,isHierarchical,this.__nsList.__childField);\r\n\t\t\t   \t this.__nsList.__arrInternalSource = nsFilter.execute();\r\n\t\t\t   \t if(enableHighlighting)\r\n\t\t\t   \t {\r\n\t\t\t   \t\tfor(var key in filter) \r\n\t\t  \t        {\r\n\t\t  \t        \tthis.__filteredColumn.push({field:key,text:filter[key]});\r\n\t\t  \t        }\r\n\t\t\t   \t }\r\n\t\t\t   \t if(isHierarchical)\r\n\t\t\t   \t {\r\n\t\t\t   \t\tthis.__nsList.__objGrid.__setWrapperSource(this.__nsList.__arrInternalSource,0,-1,0,false);\r\n\t\t\t   \t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrFlatHierarchicalSource.slice(0); \r\n\t\t\t   \t }\r\n\t\t\t   \t this.__nsList.__updateTotalRecords();\r\n\t\t\t   \t this.__nsList.__renderBody();\r\n\t\t\t   \t this.__nsList.__updateVisibleIndexByListItem(this.__nsList.__arrInternalSource);\r\n\t\t    }\r\n\t\t};\r\n\t\r\n\t\tthis.__resetFiltering = function()\r\n\t\t{\r\n\t\t\tif(this.__nsList.__dataSource)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrWrapper.slice(0);\r\n\t\t\t\tthis.__filteredColumn = [];\r\n\t\t\t\tif(this.__nsList.__enableHierarchical)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsList.__objGrid.__setWrapperSource(this.__nsList.__arrInternalSource,0,-1,0,false);\r\n\t\t\t\t\tthis.__nsList.__arrInternalSource = this.__nsList.__arrFlatHierarchicalSource.slice(0); \r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsList.__updateTotalRecords();\r\n\t\t\t\tthis.__nsList.__renderBody();\r\n\t\t\t\tthis.__nsList.__updateVisibleIndexByListItem(this.__nsList.__arrInternalSource);\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tthis.__highlightDiv = function(divText)\r\n\t\t{\r\n\t\t\tvar length = this.__filteredColumn.length;\r\n\t\t\tfor (var count = 0; count < length; count++) \r\n\t\t    {\r\n\t\t\t\tvar text = this.__filteredColumn[count].text;\r\n\t\t\t\tthis.util.highlightText(divText,text,\"nsTextHighlight\");\r\n\t\t    }\r\n\t\t};\r\n\t\t\r\n\t\tthis.__initialize();\r\n\t};\r\n\t\r\n\tvar NSListDragDrop = function(nsList)\r\n\t{\r\n\t\tthis.__nsList = nsList;\r\n\t\tthis.util = nsList.util;\r\n\t\t\r\n\t\tthis.__disableDraggableFunction = null;\r\n\t\tthis.__disableDropableFunction = null;\r\n\t\t\r\n\t\tthis.initialize = function()\r\n\t\t{\r\n\t\t\tvar container = this.__nsList.__listContainer;\r\n\t\t\tvar setting = {container:container,childNodeType:\"LI\",isContainerDraggable:this.__nsList.__isDraggable,isContainerDroppable:this.__nsList.__isDroppable,\r\n\t\t\t\t\t\t   enableDragByHandle:this.__nsList.__enableDragByHandle,dragHandlerClass:this.__nsList.__dragHandlerClass,\r\n\t\t\t\t\t\t   enableDragAfterHold:this.__nsList.__enableDragAfterHold,enableCloneMode:this.__nsList.__enableCloneMode,holdTime:this.__nsList.__holdTime,createCloneCallback:this.__createClone.bind(this),\r\n\t\t\t\t\t\t   createPlaceholderCallback:this.__createPlaceholder.bind(this),nodeDroppableCallback:this.__isListItemDroppable.bind(this),\r\n\t\t\t\t\t\t   nodeDraggableCallback:this.__isListItemDraggable.bind(this),insertNodeCallback:this.__insertListItemHandler.bind(this),\r\n\t\t\t\t\t\t   moveNodeCallback:this.__moveListItemHandler.bind(this),removeNodeCallback:this.__removeListItemHandler.bind(this)};\r\n\t\t\tthis.__nsDragDrop = new NSDragDrop(setting);\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.ITEM_DROPPING,this.__itemDroppingHandler.bind(this));\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.ITEM_DROPPED,this.__itemDroppedHandler.bind(this));\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.DRAG_STARTING,this.__dragStartingHandler.bind(this));\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.DRAG_STARTED,this.__dragStartHandler.bind(this));\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.DRAGGING,this.__draggingHandler.bind(this));\r\n\t\t\tthis.util.addEvent(container,this.__nsDragDrop.DRAG_END,this.__dragEndHandler.bind(this));\r\n\t\t};\r\n\t\t\r\n\t\tthis.__initialize = function()\r\n\t\t{\r\n\t\t\tvar setting = this.__nsList.__setting;\r\n\t\t\tif(setting.hasOwnProperty(\"disableDraggableFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__disableDraggableFunction = setting[\"disableDraggableFunction\"];\r\n\t\t\t\tthis.__disableDraggableFunction = this.util.getFunction(this.__disableDraggableFunction);\r\n\t\t\t}\r\n\t\t\tif(setting.hasOwnProperty(\"disableDropableFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__disableDropableFunction = setting[\"disableDropableFunction\"];\r\n\t\t\t\tthis.__disableDropableFunction = this.util.getFunction(this.__disableDropableFunction);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__dragStartingHandler = function(event)\r\n\t\t{\r\n\t\t\tvar listItem = event.node;\r\n\t\t\tvar arrItems = this.__getSelectedItems(listItem);\r\n\t\t\tvar data = {parentID:this.__nsList.__listContainer.getAttribute(\"id\"),arrItems:arrItems};\r\n\t\t\tthis.__nsDragDrop.setDragData(data);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__dragStartHandler = function(event)\r\n\t\t{\r\n\t\t\tvar listItem = event.node;\r\n\t\t\tvar data = this.__nsDragDrop.getDragData();\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t\t\tthis.util.dispatchEvent(this.__nsList.__baseComponent,this.__nsList.DRAG_STARTED,arrItems,{items:arrItems});\r\n\t\t};\r\n\t\t\r\n\t\tthis.__draggingHandler = function(event)\r\n\t\t{\r\n\t\t\tvar listData = event.item;\r\n\t\t\tvar data = this.__nsDragDrop.getDragData();\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t\t\tlistData.arrItems = arrItems;\r\n\t \t    this.util.dispatchEvent(this.__nsList.__baseComponent,this.__nsList.DRAGGING,listData,{item:listData});\r\n\t\t};\r\n\t\t\r\n\t\tthis.__dragEndHandler = function(event)\r\n\t\t{\r\n\t\t\tvar data = this.__nsDragDrop.getDragData();\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t \t    this.util.dispatchEvent(this.__nsList.__baseComponent,this.__nsList.DRAG_END,arrItems,{items:arrItems});\r\n\t\t};\r\n\t\t\r\n\t\tthis.__itemDroppingHandler = function(event)\r\n\t\t{\r\n\t\t\tvar cancelled = this.util.dispatchEvent(this.__nsList.__baseComponent,this.__nsList.ITEM_DROPPING,event.item,{item:event.item},true,true);\r\n\t\t\tif(cancelled)\r\n\t\t\t{\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tthis.__itemDroppedHandler = function(event)\r\n\t\t{\r\n\t\t\tthis.util.dispatchEvent(this.__nsList.__baseComponent,this.__nsList.ITEM_DROPPED,event.item,{item:event.item},true,false);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createClone = function(listItem,containerConfiguration)\r\n\t\t{\r\n\t\t\tvar listContainer = this.__nsList.__listContainer.cloneNode(false);\r\n\t\t\tvar data = this.__nsDragDrop.getDragData();\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t\t\tvar clonedNode = null;\r\n\t\t\t//make a clone only when clone Mode is ON or the list is not droppable\r\n\t\t\tif(this.__nsList.__enableCloneMode || !this.__nsList.__isDroppable)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tclonedNode = arrItems[count][this.__nsList.__fieldItem].cloneNode(true);\r\n\t\t\t\t\tclonedNode.setAttribute(\"id\",\"comp\" + listContainer.id + \"ClonedNode\" + count);\r\n\t\t\t\t\tlistContainer.appendChild(clonedNode);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tclonedNode = arrItems[count][this.__nsList.__fieldItem];\r\n\t\t\t\t\tlistContainer.appendChild(clonedNode);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlistContainer.style.width = containerConfiguration.width + \"px\";\r\n\t\t\treturn listContainer;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__createPlaceholder = function(listItem)\r\n\t\t{\r\n\t\t\tvar listItem = this.util.createElement(\"li\",null,\"nsListEmptyItem\");\r\n\t\t\tlistItem.innerHTML = \"<div class='nsListEmptyChild'>&nbsp;</div>\";\r\n\t\t\treturn listItem;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isListItemDroppable = function(listItem)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemFromTarget(listItem);\r\n\t\t\treturn this.__isItemDroppable(listItem,item);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isListItemDraggable = function(listItem)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemFromTarget(listItem);\r\n\t\t\treturn this.__isItemDraggable(listItem,item);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__insertListItemHandler = function(container,newListItem,index,currentListItem,data)\r\n\t\t{\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t\t\tthis.__nsList.__addItem(arrItems,index);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__moveListItemHandler = function(container,newListItem,index,currentListItem,data)\r\n\t\t{\r\n\t\t\tvar arrItems = data.arrItems;\r\n\t\t\tthis.__nsList.__moveItem(arrItems,index);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__removeListItemHandler = function(container,listItem,data)\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getSelectedItems = function(target)\r\n\t\t{\r\n\t\t\tvar list = this.__nsList;\r\n\t\t\tvar listContainer = list.__listContainer;\r\n\t\t\tvar index = parseInt(list.__getIndexFromTarget(target));\r\n\t\t\tvar item = list.__getItemByIndex(index);\r\n\t\t\tvar arrItems = [];\r\n\t\t\tvar arrSelectedItems = list.getSelectedItems();\r\n\t\t\tvar itemSelected = false; \r\n\t\t\tif(arrSelectedItems && arrSelectedItems.length > 0)\r\n\t\t\t{\r\n\t\t\t\tvar tempItem = null;\r\n\t\t\t\tfor(var count = 0;count < arrSelectedItems.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\ttempItem = this.__cloneItem(arrSelectedItems[count]);\r\n\t\t\t\t\tif(tempItem[list.__fieldIndex] === item[list.__fieldIndex])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titemSelected = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tarrItems.push(tempItem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!itemSelected || !arrItems || arrItems.length === 0 || !arrItems[0])\r\n\t\t\t{\r\n\t\t\t\tvar tempItem = this.__cloneItem(item);\r\n\t\t\t\tarrItems = [tempItem];\r\n\t\t\t}\r\n\t\t\treturn arrItems;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__cloneItem = function(item)\r\n\t\t{\r\n\t\t\tvar list = this.__nsList;\r\n\t\t\tvar tempItem = null;\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\ttempItem = this.util.cloneObject(item);\r\n\t\t\t\tif(list.__enableHierarchical && tempItem[list.__childField] && tempItem[list.__childField].length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrChild = tempItem[list.__childField];\r\n\t\t\t\t\tvar length = arrChild.length;\r\n\t\t\t\t\tvar childItem = null;\r\n\t\t\t\t\tvar tempChildItem = null;\r\n\t\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tchildItem = arrChild[count];\r\n\t\t\t\t\t\ttempChildItem = this.__cloneItem(childItem);\r\n\t\t\t\t\t\tif(tempChildItem)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ttempItem[list.__childField][count] = tempChildItem;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn tempItem;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__getItemFromTarget = function(listItem)\r\n\t\t{\r\n\t\t\tvar itemIndex = this.__nsList.__getIndexFromTarget(listItem);\r\n\t\t\treturn this.__nsList.__getItemByIndex(itemIndex);\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isItemDraggable = function(listItem,item) \r\n\t    {\r\n\t\t\tvar retValue = true;\r\n\t\t\tif(this.__disableDraggableFunction)\r\n\t\t\t{\r\n\t\t\t\tretValue = this.__disableDraggableFunction(item,this.__nsList.__labelField,item[this.__nsList.__fieldIndex],item[this.__nsList.__fieldDisableHover],listItem);\r\n\t\t\t\tretValue = !retValue;\r\n\t\t\t}\r\n\t    \treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__isItemDroppable = function(event) \r\n\t    {\r\n\t\t\tvar retValue = true;\r\n\t\t\tif(this.__disableDropableFunction)\r\n\t\t\t{\r\n\t\t\t\tvar target = this.util.getTarget(event);\r\n\t\t\t\ttarget = this.util.findParent(target,\"li\");\r\n\t\t\t\tvar index = this.__nsList.__getIndexFromTarget(target);\r\n\t\t\t\tvar item = this.__nsList.__getItemByIndex(index);\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tretValue = this.__disableDropableFunction(item,this.__nsList.__labelField,item[this.__nsList.__fieldIndex],item[this.__nsList.__fieldDisableHover],target);\r\n\t\t\t\t\tretValue = !retValue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t    \treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t\tthis.__initialize();\r\n\t};\r\n\treturn NSList;\r\n})();\r\nnsModuleExport(this,\"NSList\",NSList);\r\n\"use strict\";\r\nvar NSGrid = (function()\r\n{\r\n\tfunction NSGrid(component,setting) \r\n\t{\r\n\t\t//this.base.call(this);\r\n\t\tthis.GRID_TYPE_HIERARCHICAL = \"hierarchical\";\r\n\t\tthis.GRID_TYPE_GROUP = \"group\";\r\n\t\tthis.GRID_TYPE_NORMAL = \"normal\";\r\n\t\tthis.GRID_TYPE_MASTER_DETAIL = \"masterdetail\";\r\n\t\tthis.PAGINATION_TYPE_SCROLL = \"scroll\";\r\n\t\tthis.PAGINATION_TYPE_PAGES = \"pages\";\r\n\t\tthis.PAGINATION_MODE_AUTO = \"auto\";\r\n\t\tthis.PAGINATION_MODE_MANUAL = \"manual\";\r\n\t\tthis.RESPONSIVE_MODE_STACK = \"stack\";\r\n\t\tthis.RESPONSIVE_MODE_COLUMN_TOGGLE = \"columnToggle\";\r\n\t\tthis.MULTICOLUMN_KEY_SHIFT = \"shift\";\r\n\t\tthis.MULTICOLUMN_KEY_CTRL = \"ctrl\";\r\n\t\tthis.MULTICOLUMN_KEY_ALT = \"alt\";\r\n\t\t\r\n\t\tthis.NAVIGATION_UP = \"up\";\r\n\t\tthis.NAVIGATION_DOWN = \"down\";\r\n\t\t\r\n\t\t//this.initializeDOM(ns.NSDATAGRID_CSS);\r\n\t\t\r\n\t\tthis.__OUTER_CONTAINER_ID = \"divDataSet\";\r\n\t\tthis.__TITLE_CONTAINER_ID = \"divTitleBar\";\r\n\t\tthis.__TABLE_HEADER_CONTAINER_WRAPPER_ID = \"divHeaderContainerWrapper\";\r\n\t\tthis.__TABLE_BODY_CONTAINER_WRAPPER_ID = \"divBodyContainerWrapper\";\r\n\t\tthis.__TABLE_FOOTER_CONTAINER_WRAPPER_ID = \"divFooterContainerWrapper\";\r\n\t\tthis.__TABLE_LEFT_HEADER_CONTAINER_ID = \"divLeftHeaderContainer\";\r\n\t\tthis.__TABLE_LEFT_HEADER_ID = \"tblLeftHeader\";\r\n\t\tthis.__TABLE_LEFT_BODY_CONTAINER_ID = \"divLeftBodyContainer\";\r\n\t\tthis.__TABLE_LEFT_BODY_ID = \"tblLeftBody\";\r\n\t\tthis.__TABLE_LEFT_FOOTER_CONTAINER_ID = \"divLeftFooterContainer\";\r\n\t\tthis.__TABLE_LEFT_FOOTER_ID = \"tblLeftFooter\";\r\n\t\tthis.__TABLE_CENTER_HEADER_CONTAINER_ID = \"divCenterHeaderContainer\";\r\n\t\tthis.__TABLE_CENTER_HEADER_ID = \"tblCenterHeader\";\r\n\t\tthis.__TABLE_CENTER_BODY_CONTAINER_ID = \"divCenterBodyContainer\";\r\n\t\tthis.__TABLE_CENTER_BODY_ID = \"tblCenterBody\";\r\n\t\tthis.__TABLE_CENTER_FOOTER_CONTAINER_ID = \"divCenterFooterContainer\";\r\n\t\tthis.__TABLE_CENTER_FOOTER_ID = \"tblCenterFooter\";\r\n\t\tthis.__TABLE_RIGHT_HEADER_CONTAINER_ID = \"divRightHeaderContainer\";\r\n\t\tthis.__TABLE_RIGHT_HEADER_ID = \"tblRightHeader\";\r\n\t\tthis.__TABLE_RIGHT_BODY_CONTAINER_ID = \"divRightBodyContainer\";\r\n\t\tthis.__TABLE_RIGHT_BODY_ID = \"tblRightBody\";\r\n\t\tthis.__TABLE_RIGHT_FOOTER_CONTAINER_ID = \"divRightFooterContainer\";\r\n\t\tthis.__TABLE_RIGHT_FOOTER_ID = \"tblRightFooter\";\r\n\t\tthis.__PAGINATION_CONTROL_ID = \"divPagination\";\r\n\t\t\r\n\t\tthis.__CLASS_TABLE = \"nsDataGridTable\";\r\n\t\tthis.__CLASS_TITLEBAR = \"nsDataGridTitleBar\";\r\n\t\tthis.__CLASS_TABLE_HEADER_CELL = \"nsDataGridHeader\";\r\n\t\tthis.__CLASS_TABLE_HEADER_DROPPABLE_CELL = \"nsDataGridDroppableHeader\";\r\n\t\tthis.__CLASS_BODY_CONTAINER = \"nsDataGridBodyContainer\";\r\n\t\tthis.__CLASS_ODD_ROW = \"nsDataGridOddRow\";\r\n\t\tthis.__CLASS_EVEN_ROW = \"nsDataGridEvenRow\";\r\n\t\tthis.__CLASS_SELECTED_ROW = \"nsDataGridSelection\";\r\n\t\tthis.__CLASS_GROUP_CELL = \"nsGroupCell\";\r\n\t\tthis.__CLASS_CELL_CHILD = \"nsCellChild\";\r\n\t\t\r\n\t\tthis.__DEFAULT_COLUMN_WIDTH = 100;\r\n\t\tthis.__INFINITE_SCROLL_PADDING = 40;\r\n\t\tthis.__INFINITE_SCROLL_INITIAL_LOAD = 250;\r\n\t\t\r\n\t\tthis.__columns = [];\r\n\t\tthis.__orignalColumns = [];\r\n\t\tthis.__orignalItemKey = [];\r\n\t\tthis.__navigationIndex = -1;\r\n\t\tthis.__selectedIndex = -1;\r\n\t\tthis.__selectedItem = null;\r\n\t\tthis.__selectedIndexes = [];\r\n\t\tthis.__selectedItems = [];\r\n\t\tthis.__lastNavigationDirection = null;\r\n\t\r\n\t\tthis.__title = null;\r\n\t\tthis.__type = this.GRID_TYPE_NORMAL;\r\n\t\tthis.__dataSource = null;\r\n\t\tthis.__arrColumns = null;\r\n\t\tthis.__context = window;\r\n\t\tthis.__enableHierarchical = false;\r\n\t\tthis.__enableGrouping = false;\r\n\t\tthis.__enableMasterDetail = false;\r\n\t\tthis.__enableMouseHover = false;\r\n\t\tthis.__mouseHoverColor = \"#CCCCCC\";\r\n\t\tthis.__enableColumnMouseHover = false;\r\n\t\tthis.__enableMultipleSelection = false;\r\n\t\tthis.__enableKeyboardNavigation = false;\r\n\t\tthis.__enableCustomScrollBar = false;\r\n\t\tthis.__columnResizable = false;\r\n\t\tthis.__columnDraggable = false;\r\n\t\tthis.__columnSortable = true;\r\n\t\tthis.__columnAutoSize = false;\r\n\t\tthis.__enableContextMenu = false;\r\n\t\tthis.__enableVariableRowHeight = false;\r\n\t\tthis.__enableFilter = false;\r\n\t\tthis.__filterFunction = null;\r\n\t\tthis.__hierarchyFilterChildrenFunction = null;\r\n\t\tthis.__enableAdvancedFilter = false;\r\n\t\tthis.__enableToolTipForTruncateText = false;\r\n\t\tthis.__childField = \"children\";\r\n\t\tthis.__rowKeyField = null;\r\n\t\tthis.__isParentRowField = \"ns-isParentRow\";\r\n\t\tthis.__groupByField = null;\r\n\t\tthis.__columnMinWidth = 50;\r\n\t\tthis.__pageSize = 50;\r\n\t\tthis.__rowHeight = -1;\r\n\t\tthis.__noDataMessage = \"No matching records found\";\r\n\t\t//stores initial Column Count \r\n\t\tthis.__initialColumnCount = 0;\r\n\t\tthis.__initialTableWidth = 0;\r\n\t\tthis.__enablePagination = false;\r\n\t\tthis.__enableVirtualScroll = false;\r\n\t\tthis.__enableDataRefreshOnScrollEnd = false;\r\n\t\tthis.__enableServerCall = false;\r\n\t\tthis.__enableExport = false;\r\n\t\tthis.__enableResponsive = false;\r\n\t\tthis.__enableColumnSetting = false;\r\n\t\tthis.__enableRowSelection = true;\r\n\t\tthis.__enableCellSelection = false;\r\n\t\tthis.__enableMultiCellSelection = false;\r\n\t\tthis.__enableMultiSort = false;\r\n\t\tthis.__enableEditable = false;\r\n\t\tthis.__showExpandCollapseIcon = true;\r\n\t\tthis.__isPopUp = false; \r\n\t\tthis.__isPaginationTypeScroll = true;\r\n\t\tthis.__isPaginationModeAuto = true;\r\n\t\t\r\n\t\tthis.__isResponsiveModeStack = true;\r\n\t\tthis.__isResponsiveModeColumnToggle = false;\r\n\t\tthis.__totalRecords = 0;\r\n\t\tthis.__contextMenuProvider = null;\r\n\t\tthis.__contextMenuSetting = null;\r\n\t\tthis.__responsiveMode = this.RESPONSIVE_MODE_STACK;\r\n\t\tthis.__paginationFetchRecordCallBack = null;\r\n\t\tthis.__eventDispatcher = null;\r\n\t\tthis.__heightOffset = null;\r\n\t\tthis.__editorSetting = null;\r\n\t\t//for Virtual Scroll\r\n\t\tthis.__virtualScrollSetting = {};\r\n\t\tthis.__nsVirtualScroll = null; \r\n\t\tthis.__virtualRowHeight = 0;\r\n\t\t//for DataRefreshOnScrollEnd\r\n\t\tthis.__dataRefreshfireDelay = 100;\r\n\t\t\r\n\t\tthis.__scrollOffsetPosition = 0;\r\n\t\tthis.__componentResizingInterval = -1;\r\n\t\tthis.__divPagination = null;\r\n\t\t\r\n\t\tthis.__divOuterContainer = null;\r\n\t\tthis.__divTableWrapper = null;\r\n\t\tthis.__divTableHeaderContainerWrapper = null;\r\n\t\tthis.__divTableBodyContainerWrapper = null;\r\n\t\tthis.__divTableFooterContainerWrapper = null;\r\n\t\tthis.__divCenterTableHeaderContainer = null;\r\n\t\tthis.__tblCenterHeader = null;\r\n\t\tthis.__tblCenterHeaderBody = null;\r\n\t\tthis.__divCenterTableBodyContainer = null;\r\n\t\tthis.__tblCenterBody = null;\r\n\t\tthis.__tblCenterBodyBody = null;\r\n\t\tthis.__divCenterTableFooterContainer = null;\r\n\t\tthis.__tblCenterFooter = null;\r\n\t\tthis.__tblCenterFooterBody = null;\r\n\t\t//stores whether mouse is on GridLine\r\n\t\tthis.__onGridLine = false;\r\n\t\tthis.__addRemoveRowCallInternal = false;\r\n\t\tthis.__lastBodyCellFocus = null;\r\n\t\tthis.__isColumnResizing = false;\r\n\t\t\r\n\t\tthis.__bodyScrollPos = 0;\r\n\t\t//for Page type Pagination\r\n\t\tthis.__nsPagination = null;\r\n\t\t//for Infinite Scroll Pagination\r\n\t\tthis.__bottomPercentageForAddRows = 15;\r\n\t\tthis.__processArrayAsync = null;\r\n\t\tthis.__rowsRendered = false;\r\n\t\tthis.__stopScroll = false;\r\n\t\tthis.__lastScrollPos = [0,0];\r\n\t\t//for Fixed Column \r\n\t\tthis.__leftFixedColumn = 0;\r\n\t\tthis.__rightFixedColumn = 0;\r\n\t\tthis.__enableFixedColumnAnimation = false;\r\n\t\tthis.__arrFixedLeftCells = [];\r\n\t\tthis.__arrFixedRightCells = [];\r\n\t\tthis.__fixedTimerTimeout = -1;\r\n\t\tthis.__enableFooter = false;\r\n\t\tthis.__tableRectFixedColumn = null;\r\n\t\t//for Row Mover\r\n\t\tthis.__enableRowMove = false;\r\n\t\tthis.__isSameTableMove = false;\r\n\t\tthis.__rowMoverDropEndHandler = null;\r\n\t\t//flag to figure out that text of cell is cached or not\r\n\t\t//generally for IE this should be true to improve performance except when we are using Virtual scrolling\r\n\t\tthis.__renderInCachedMode = false;\r\n\t\tthis.__customClass = {};\r\n\t\t//for Multicolumn Sort\r\n\t\tthis.__multiColumnKey = this.MULTICOLUMN_KEY_SHIFT;\r\n\t\tthis.__isMultiColumnKeyPressed = false;\r\n\t\tthis.__dateComponent = null;\r\n\t\t\r\n\t\tthis.__headerExtraRowCount = 0;\r\n\t\t\r\n\t\tthis.__loader = null;\r\n\t\tthis.__scroller = null;\r\n\t\tthis.__scrollerSetting = {};\r\n\t\tthis.__groupCollection = null;\r\n\t\tthis.__groupSource = null;\r\n\t\tthis.__contextMenu = null;\r\n\t\tthis.__exportMenu = null;\r\n\t\tthis.__exportFileName = null;\r\n\t\tthis.__exportMenuDataSource = [{id: 0,title: 'XLS',iconHTML: '<i class=\"fa fa-file-excel-o fa-lg\"></i>'},\r\n\t\t                               {id: 1,title: 'CSV',iconHTML: '<i class=\"fa fa-file-excel-o fa-lg\"></i>',separatorBelow:true},\r\n\t\t                               {id: 2,title: 'DOC',iconHTML: '<i class=\"fa fa-file-word-o fa-lg\"></i>'},\r\n\t\t                               {id: 3,title: 'TEXT',iconHTML: '<i class=\"fa fa-file-text-o fa-lg\"></i>',separatorBelow:true},\r\n\t\t                               {id: 4,title: 'XML',iconHTML: '<i class=\"fa fa-file-code-o fa-lg\"></i>'},\r\n\t\t                               {id: 5,title: 'JSON',iconHTML: '<i class=\"fa fa-file-o\" fa-lg></i>',separatorBelow:true},\r\n\t\t                               {id: 6,title: 'PDF',iconHTML: '<i class=\"fa fa-file-pdf-o fa-lg\"></i>'},\r\n\t\t                               {id: 7,title: 'IMAGE',iconHTML: '<i class=\"fa fa-file-picture-o fa-lg\"></i>',separatorBelow:true},\r\n\t\t                               {id: 8,title: 'XLSX',iconHTML: '<i class=\"fa fa-file-excel-o fa-lg\"></i>'},\r\n\t\t                               {id: 9,title: 'DOCX',iconHTML: '<i class=\"fa fa-file-word-o fa-lg\"></i>'}];\r\n\t\tthis.__imgUtil = null;\r\n\t\tthis.__arrWrapper = null;\r\n\t\tthis.__arrInternalSource = null;\r\n\t\tthis.__arrFlatHierarchicalSource = [];\r\n\t\tthis.__arrFilteredGroupedSource = [];\r\n\t\t// This flag stops componentResized code to be called first time \r\n\t\tthis.__isComponentResizedCallCorrect = false;\r\n\t\tthis.__customScrollBarSetting = {};\r\n\t\t//Custom Scrollbar Tooltip\r\n\t\tthis.__enableScrollBarTip = false;\r\n\t\tthis.__scrollBarTipLabelFunction = null;\r\n\t\tthis.__divScrollTipContainer = null;\r\n\t\tthis.__divScrollTipText = null;\r\n\t\tthis.__scrollTipInterval = null;\r\n\t\t //queue up the functions not called as Creation Complete called later\r\n\t\tthis.__queueFunc = [];\r\n\t\t//if columns total width is less than parent still Table will fill all the width if this flag is true \r\n\t\tthis.__fillParentWidth = true;\r\n\t\tthis.__enableAutoResize = false;\r\n\t\t\r\n\t\tthis.__fieldPrefix = \"ns_field\";\r\n\t\tthis.__fieldIndex = this.__fieldPrefix + \"_row_index\";\r\n\t\tthis.__fieldVisibleIndex = this.__fieldPrefix + \"_row_visible_index\";\r\n\t\tthis.__fieldRow = this.__fieldPrefix + \"_row\";\r\n\t\tthis.__fieldRowHtml = this.__fieldPrefix + \"_row\";\r\n\t\tthis.__fieldRowLevel = this.__fieldPrefix + \"_row_level\";\r\n\t\tthis.__fieldRowVisible = this.__fieldPrefix + \"_row_visible\";\r\n\t\tthis.__fieldRowHover = this.__fieldPrefix + \"_row_hover\";\r\n\t\tthis.__fieldParentIndex = this.__fieldPrefix + \"_parent_index\";\r\n\t\tthis.__fieldHasChild = this.__fieldPrefix + \"_row_hasChild\";\r\n\t\tthis.__fieldHasParent = this.__fieldPrefix + \"_row_hasParent\";\r\n\t\tthis.__fieldIsCollapsed = this.__fieldPrefix + \"_row_isCollapsed\";\r\n\t\tthis.__fieldRowArrow = this.__fieldPrefix + \"row_arrow\";\r\n\t\tthis.__fieldCellText = this.__fieldPrefix + \"cell_text\";\r\n\t\tthis.__fieldSelected = this.__fieldPrefix + \"_selected\";\r\n\t\tthis.__fieldColIndex = this.__fieldPrefix + \"_col_index\";\r\n\t\tthis.__fieldColSortedAsc = this.__fieldPrefix + \"_col_sorted_asc\";\r\n\t\tthis.__fieldColVisible = this.__fieldPrefix + \"_col_visible\";\r\n\t\t\r\n\t\tthis.__isShiftPressed = false;\r\n\t\tthis.__isCtrlPressed = false;\r\n\t\t\r\n\t\tthis.__synchronizeTablesRef = null;\r\n\t\tthis.__divCenterTableBodyMouseUpRef = null;\r\n\t\tthis.__bodyScrollRef = null;\r\n\t\tthis.__keyDownRef = null;\r\n\t\tthis.__keyUpRef = null;\r\n\t\tthis.__tableCellNavigatorEventRef = null;\r\n\t\tthis.__tableCellSelectionEventRef = null;\r\n\t\t\r\n\t\t//mobile touch events\r\n\t\tthis.__enableTouchEvents = true;\r\n\t\tthis.__objTouchEvents = new Map();\r\n\t\t\r\n\t\tthis.__objGrid = null;\r\n\t\tthis.__nsGridColumnMove = null;\r\n\t\tthis.__nsGridColumnResize = null;\r\n\t\tthis.__nsGridSort = null;\r\n\t\tthis.__nsGridFilter = null;\r\n\t\tthis.__nsGridKeyboard = null;\r\n\t\tthis.__nsToolTipInElement = null;\r\n\t\tthis.__nsTableCellNavigator = null;\r\n\t\tthis.__nsCellSelection = null;\r\n\t\tthis.__multiCellSelectionSetting = null;\r\n\t\tthis.__icons = {menu:null,filter:null,sortAscending:null,sortDescending:null,columnMove:null,exportButton:null,columnSetting:null,rowExpanded:null,rowCollapsed:null};\r\n\t\tthis.__nsGridEditor = null;\r\n\t\tthis.__nsPopUpColumnSetting = null;\r\n\t\tthis.__setting = setting;\r\n\t\tthis.base.__setBaseComponent.call(this,component,true);\r\n\t};\r\n\tnsExtendPrototype(NSContainerBase,NSGrid);\r\n\tNSGrid.prototype.constructor = NSGrid;\r\n\t\r\n\tNSGrid.prototype.initializeComponent = function() \r\n\t{\r\n\t\tthis.base.initializeComponent.call(this);\r\n\t\tthis.__setFields();\r\n\t\tthis.__setSetting();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setComponentProperties = function() \r\n\t{\r\n\t\tthis.base.setComponentProperties.call(this);\r\n\t\tthis.__initializePluggins();\r\n\t\tthis.__setGridType();\r\n\t\tthis.__objGrid.__initialize();\r\n\t\tthis.__addListenerForBody();\r\n\t\tthis.__setPaginationType();\r\n\t\tthis.__setPaginationMode();\r\n\t\tthis.__setResponsiveMode();\r\n\t\tthis.__checkForVirtualMode();\r\n\t\tthis.__addSVGInPage();\r\n\t\tthis.__addStyleInDOM();\r\n\t\tif(this.__arrColumns)\r\n\t\t{\r\n\t\t\tthis.setColumn(this.__arrColumns);\r\n\t\t}\r\n\t\tif(this.__dataSource)\r\n\t\t{\r\n\t\t\tthis.dataSource(this.__dataSource);\r\n\t\t}\r\n\t\tif(this.__queueFunc && this.__queueFunc.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = this.__queueFunc.length - 1;count > -1;count--)\r\n\t\t\t{\r\n\t\t\t\tthis.__queueFunc[count]();\r\n\t\t\t\tthis.__queueFunc.splice(count, 1);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty)\r\n\t{\r\n\t\tif(setProperty)\r\n\t\t{\r\n\t\t\tthis.__setting[attrName] = newVal;\r\n\t\t\tthis.__objGrid.propertyChange(attrName, oldVal, newVal, setProperty);\r\n\t\t}\r\n\t\tthis.base.propertyChange.call(this,attrName, oldVal, newVal, setProperty);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.blurHandler = function(event)\r\n\t{\r\n\t\tthis.base.blurHandler.call(this);\r\n\t\tthis.__dispatchInternalEvent(\"blur\");\r\n\t};\r\n\t\r\n\tNSGrid.prototype.componentResized = function(event,force) \r\n\t{\r\n\t\t//console.log(\"In Grid componentResized\");\r\n\t\tif(this.__enableAutoResize || force)\r\n\t\t{\r\n\t\t\tif(this.__isComponentResizedCallCorrect || this.__isPopUp)\r\n\t\t\t{\r\n\t\t\t\tvar baseMeasurement = this.__baseComponent.getBoundingClientRect();\r\n\t\t\t\tif(!this.__lastBaseMeasurement || this.__lastBaseMeasurement.height !== baseMeasurement.height || this.__lastBaseMeasurement.width !== baseMeasurement.width)\r\n\t\t\t\t{\r\n\t\t\t\t\t//if (this.__componentResizingInterval != -1)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\tclearTimeout(this.__componentResizingInterval);\r\n\t\t\t\t\t\tthis.__componentResizingInterval = -1;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\tvar self = this;\r\n\t\t\t\t\tif(this.util.hasStyleClass(this.__baseComponent,\"nsMobileStackGrid\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__componentResizingInterval = setTimeout(\r\n\t\t\t\t\t\tfunction()\r\n\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\tself.__componentResizingInterval = -1;\r\n\t\t\t\t\t\t\tif(self.__divOuterContainer)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tconsole.log(\"In Resize\" + self.__tblCenterBody.style.width);\r\n\t\t\t\t\t\t\t\tself.__setComponentHeight.bind(self)();\r\n\t\t\t\t\t\t\t\tself.__setOuterContainerMeasurement.bind(self)();\r\n\t\t\t\t\t\t\t\tvar scrollBarWidth = self.util.getScrollBarWidth(self.__getVerticalScrollableContainer());\r\n\t\t\t\t\t\t\t\tvar width = self.__divOuterContainer.getBoundingClientRect().width - scrollBarWidth;\r\n\t\t\t\t\t\t\t\tself.__setTableWidth.call(self,width);\r\n\t\t\t\t\t\t\t\tself.__setBodyMeasurement();\r\n\t\t\t\t\t\t\t\tself.__lastBaseMeasurement = self.__baseComponent.getBoundingClientRect();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},500);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__componentResizingInterval = setTimeout(\r\n\t\t\t\t\t\tfunction()\r\n\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\tself.__componentResizingInterval = -1;\r\n\t\t\t\t\t\t\tself.reRender.call(self);\r\n\t\t\t\t\t\t\tself.base.componentResized.call(self,event);\r\n\t\t\t\t\t\t},500);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__isComponentResizedCallCorrect = true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setHeightOffset = function(offset)\r\n\t{\r\n\t\tthis.__heightOffset = offset;\r\n\t\tthis.__setComponentHeight();\r\n\t\tthis.reRender();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setSetting = function()\r\n\t{\r\n\t\tvar setting = this.__setting;\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(this.hasAttribute(\"nsTitle\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__title = this.getAttribute(\"nsTitle\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"type\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__type = this.getAttribute(\"type\");\r\n\t\t\t\tif(!this.__type)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__type = this.GRID_TYPE_NORMAL;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"context\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__context = this.getAttribute(\"context\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableMouseHover\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMouseHover = Boolean.parse(this.getAttribute(\"enableMouseHover\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"mouseHoverColor\") && this.getAttribute(\"mouseHoverColor\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__mouseHoverColor = this.getAttribute(\"mouseHoverColor\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableMultipleSelection\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMultipleSelection = Boolean.parse(this.getAttribute(\"enableMultipleSelection\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableKeyboardNavigation\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableKeyboardNavigation =  Boolean.parse(this.getAttribute(\"enableKeyboardNavigation\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableColumnMouseHover\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableColumnMouseHover =  Boolean.parse(this.getAttribute(\"enableColumnMouseHover\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"childField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__childField = this.getAttribute(\"childField\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"rowKeyField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__rowKeyField = this.getAttribute(\"rowKeyField\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__rowKeyField = this.__fieldIndex;\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"groupByField\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__groupByField = this.getAttribute(\"groupByField\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columnMinWidth\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__columnMinWidth = this.getAttribute(\"columnMinWidth\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableCustomScrollBar\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableCustomScrollBar =  Boolean.parse(this.getAttribute(\"enableCustomScrollBar\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"customScrollBarSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__scrollerSetting = this.getAttribute(\"customScrollBarSetting\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columnResizable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__columnResizable =  Boolean.parse(this.getAttribute(\"columnResizable\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columnDraggable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__columnDraggable = Boolean.parse(this.getAttribute(\"columnDraggable\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columnAutoSize\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__columnAutoSize = Boolean.parse(this.getAttribute(\"columnAutoSize\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columnSortable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__columnSortable = Boolean.parse(this.getAttribute(\"columnSortable\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enablePagination\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enablePagination = Boolean.parse(this.getAttribute(\"enablePagination\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"paginationType\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__paginationType = this.getAttribute(\"paginationType\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"paginationMode\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__paginationMode =  this.getAttribute(\"paginationMode\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableAsyncLoadPagination\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableAsyncLoadPagination = Boolean.parse(this.getAttribute(\"enableAsyncLoadPagination\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"pageSize\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__pageSize = parseInt(this.getAttribute(\"pageSize\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"totalRecords\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__totalRecords =  parseInt(this.getAttribute(\"totalRecords\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"paginationFetchRecordCallBack\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__paginationFetchRecordCallBack =  this.getAttribute(\"paginationFetchRecordCallBack\");\r\n\t\t\t\tthis.__paginationFetchRecordCallBack = this.util.getFunction(this.__paginationFetchRecordCallBack);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableContextMenu\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableContextMenu = Boolean.parse(this.getAttribute(\"enableContextMenu\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"contextMenuProvider\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__contextMenuProvider =  this.getAttribute(\"contextMenuProvider\");\r\n\t\t\t\tthis.__contextMenuProvider = this.util.getFunction(this.__contextMenuProvider);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableFilter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableFilter = Boolean.parse(this.getAttribute(\"enableFilter\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"filterFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__filterFunction = this.getAttribute(\"filterFunction\");\r\n\t\t\t\tthis.__filterFunction = this.util.getFunction(this.__filterFunction);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"hierarchyFilterChildrenFunction\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__hierarchyFilterChildrenFunction = this.getAttribute(\"hierarchyFilterChildrenFunction\");\r\n\t\t\t\tthis.__hierarchyFilterChildrenFunction = this.util.getFunction(this.__hierarchyFilterChildrenFunction);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableAdvancedFilter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableAdvancedFilter = Boolean.parse(this.getAttribute(\"enableAdvancedFilter\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableVirtualScroll\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVirtualScroll = Boolean.parse(this.getAttribute(\"enableVirtualScroll\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableDataRefreshOnScrollEnd\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableDataRefreshOnScrollEnd = Boolean.parse(this.getAttribute(\"enableDataRefreshOnScrollEnd\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"dataRefreshfireDelay\") && parseInt(this.getAttribute(\"dataRefreshfireDelay\")) > -1)\r\n\t\t\t{\r\n\t\t\t\tthis.__dataRefreshfireDelay = parseInt(this.getAttribute(\"dataRefreshfireDelay\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"bottomPercentageForAddRows\") && parseInt(this.getAttribute(\"bottomPercentageForAddRows\") > 0))\r\n\t\t\t{\r\n\t\t\t\tthis.__bottomPercentageForAddRows = parseInt(this.getAttribute(\"bottomPercentageForAddRows\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableServerCall\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableServerCall = Boolean.parse(this.getAttribute(\"enableServerCall\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"rowHeight\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__rowHeight =  parseInt(this.getAttribute(\"rowHeight\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableColumnSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableColumnSetting =  Boolean.parse(this.getAttribute(\"enableColumnSetting\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableExport\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableExport =  Boolean.parse(this.getAttribute(\"enableExport\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"exportFileName\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__exportFileName = this.getAttribute(\"exportFileName\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableResponsive\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableResponsive =  Boolean.parse(this.getAttribute(\"enableResponsive\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableRowSelection\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableRowSelection =  Boolean.parse(this.getAttribute(\"enableRowSelection\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableCellSelection\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableCellSelection =  Boolean.parse(this.getAttribute(\"enableCellSelection\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableMultiCellSelection\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMultiCellSelection =  Boolean.parse(this.getAttribute(\"enableMultiCellSelection\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"responsiveMode\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__responsiveMode = this.getAttribute(\"responsiveMode\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"noDataMessage\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__noDataMessage = this.getAttribute(\"noDataMessage\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"leftFixedColumn\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__leftFixedColumn =  parseInt(this.getAttribute(\"leftFixedColumn\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"rightFixedColumn\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__rightFixedColumn =  parseInt(this.getAttribute(\"rightFixedColumn\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableFixedColumnAnimation\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableFixedColumnAnimation =  Boolean.parse(this.getAttribute(\"enableFixedColumnAnimation\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableRowMove\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableRowMove =  Boolean.parse(this.getAttribute(\"enableRowMove\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"isSameTableMove\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__isSameTableMove =  Boolean.parse(this.getAttribute(\"isSameTableMove\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"rowMoverDropEndHandler\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__rowMoverDropEndHandler = this.getAttribute(\"rowMoverDropEndHandler\");\r\n\t\t\t\tthis.__rowMoverDropEndHandler = this.util.getFunction(this.__rowMoverDropEndHandler);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"renderInCachedMode\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__renderInCachedMode =  Boolean.parse(this.getAttribute(\"renderInCachedMode\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableVariableRowHeight\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVariableRowHeight =  Boolean.parse(this.getAttribute(\"enableVariableRowHeight\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableToolTipForTruncateText\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableToolTipForTruncateText =  Boolean.parse(this.getAttribute(\"enableToolTipForTruncateText\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"heightOffset\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__heightOffset =  this.getAttribute(\"heightOffset\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableMultiSort\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableMultiSort =  Boolean.parse(this.getAttribute(\"enableMultiSort\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableEditable\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableEditable =  Boolean.parse(this.getAttribute(\"enableEditable\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"editorSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__editorSetting =  this.getAttribute(\"editorSetting\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"multiColumnKey\") && this.getAttribute(\"multiColumnKey\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__multiColumnKey =  this.getAttribute(\"multiColumnKey\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableFooter =  Boolean.parse(this.getAttribute(\"enableFooter\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"dataSource\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__dataSource = this.getAttribute(\"dataSource\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"columns\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__arrColumns = this.getAttribute(\"columns\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"headerExtraRowCount\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__headerExtraRowCount = parseInt(this.getAttribute(\"headerExtraRowCount\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"customClass\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__customClass = this.getAttribute(\"customClass\");\r\n\t\t\t\tif(!this.__customClass)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__customClass = {};\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"theme\") && this.getAttribute(\"theme\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__theme = this.getAttribute(\"theme\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"showExpandCollapseIcon\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__showExpandCollapseIcon = this.util.isUndefinedOrNull(this.getAttribute(\"showExpandCollapseIcon\")) ? true : Boolean.parse(this.getAttribute(\"showExpandCollapseIcon\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"dateComponent\") && this.getAttribute(\"dateComponent\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__dateComponent = this.getAttribute(\"dateComponent\");\r\n\t\t\t}\r\n\t\t\t//isPopUp should be true if the grid is used in cases like autocomplete so that componentResized is called multiple times so that width is adjusted properly\r\n\t\t\tif(this.hasAttribute(\"isPopUp\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__isPopUp =  Boolean.parse(this.getAttribute(\"isPopUp\"));\r\n\t\t\t}\r\n\t\t\t//eventDispatcher to support different frameworks \r\n\t\t\tif(this.hasAttribute(\"eventDispatcher\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__eventDispatcher =  this.getAttribute(\"eventDispatcher\");\r\n\t\t\t\tthis.__eventDispatcher = this.util.getFunction(this.__eventDispatcher);\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"multiCellSelectionSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__multiCellSelectionSetting = this.getAttribute(\"multiCellSelectionSetting\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__multiCellSelectionSetting = {scrollableElement:null,enableFillHandle:false,enableKeyboardNavigation:true,enableCopy:true,enablePaste:true,cellClass:null,areaClass:null,areaClassLeft:null,areaClassRight:null,areaClassTop:null,areaClassBottom:null};\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"icons\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__icons =  this.getAttribute(\"icons\");\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableTouchEvents\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableTouchEvents = Boolean.parse(this.getAttribute(\"enableTouchEvents\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"enableAutoResize\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__enableAutoResize = Boolean.parse(this.getAttribute(\"enableAutoResize\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"fillParentWidth\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__fillParentWidth = Boolean.parse(this.getAttribute(\"fillParentWidth\"));\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"customScrollBarSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__customScrollBarSetting = this.getAttribute(\"customScrollBarSetting\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__customScrollBarSetting = {verticalScrollButtons: {enable: true},horizontalScrollButtons:{enable: true}};\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"virtualScrollSetting\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__virtualScrollSetting = this.getAttribute(\"virtualScrollSetting\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__virtualScrollSetting = {pageSize: null,pagesRendered: null,enableScrollDelay: false,scrollInterval: null,resizeInterval: null,enableLoader: false,getLoaderComponent: null};\r\n\t\t\t}\r\n\t\t\tif(this.hasAttribute(\"components\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__components = this.getAttribute(\"components\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__components = {datePicker: null};\r\n\t\t\t}\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tif(this.hasAttribute(\"enableScrollBarTip\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__enableScrollBarTip =  Boolean.parse(this.getAttribute(\"enableScrollBarTip\"));\r\n\t\t\t\t}\r\n\t\t\t\tif(this.hasAttribute(\"scrollBarTipLabelFunction\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__scrollBarTipLabelFunction = this.getAttribute(\"scrollBarTipLabelFunction\");\r\n\t\t\t\t\tthis.__scrollBarTipLabelFunction = this.util.getFunction(this.__scrollBarTipLabelFunction);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.hasAttribute = function(attributeName)\r\n\t{\r\n\t\treturn (this.__setting.hasOwnProperty(attributeName) || this.__setting.hasOwnProperty(attributeName.toLowerCase()));\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getAttribute = function(attributeName)\r\n\t{\r\n\t\tvar value = this.__setting[attributeName];\r\n\t\tif(this.util.isUndefined(value))\r\n\t\t{\r\n\t\t\tvalue = this.__setting[attributeName.toLowerCase()];\r\n\t\t}\r\n\t\treturn value;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.deviceViewChanged = function(conditionTrue,queryIndex,query) \r\n\t{\r\n\t\tqueryIndex = parseInt(queryIndex);\r\n\t\tvar self = this;\r\n\t\tvar refresh = function()\r\n\t\t{\r\n\t\t\tif(self.__nsVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tself.__nsVirtualScroll.refresh(true);\r\n\t\t\t\tself.__divCenterTableBodyContainer.scrollTop = 0;\r\n\t\t\t}\r\n\t\t};\r\n\t\tif(this.__isResponsiveModeStack)\r\n\t\t{\r\n\t\t\tif(conditionTrue)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(this.__baseComponent,\"nsMobileStackGrid\");\r\n\t\t\t\trefresh();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeStyleClass(this.__baseComponent,\"nsMobileStackGrid\");\r\n\t\t\t\trefresh();\r\n\t\t\t}\r\n\t\t\tthis.componentResized(null,true);\r\n\t\t}\r\n\t\telse if(this.__isResponsiveModeColumnToggle)\r\n\t\t{\r\n\t\t\tvar className = \"nsMobileColumnToggleGrid\";\r\n\t\t\tvar postFix = \"\";\r\n\t\t\tswitch(queryIndex)\r\n\t\t\t{\r\n\t\t\t\tcase 0:\r\n\t\t\t\t\tpostFix = \">960\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tpostFix = \"960\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tpostFix = \"800\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tpostFix = \"640\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tpostFix = \"480\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tpostFix = \"320\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tvar reset = function()\r\n\t\t\t{\r\n\t\t\t\tself.util.removeStyleClass(self.__baseComponent,\"nsMobileColumnToggleGrid960\");\r\n\t\t\t\tself.util.removeStyleClass(self.__baseComponent,\"nsMobileColumnToggleGrid800\");\r\n\t\t\t\tself.util.removeStyleClass(self.__baseComponent,\"nsMobileColumnToggleGrid640\");\r\n\t\t\t\tself.util.removeStyleClass(self.__baseComponent,\"nsMobileColumnToggleGrid480\");\r\n\t\t\t\tself.util.removeStyleClass(self.__baseComponent,\"nsMobileColumnToggleGrid320\");\r\n\t\t\t};\r\n\t\t\tif(postFix)\r\n\t\t\t{\r\n\t\t\t\treset();\r\n\t\t\t\tif(postFix != \">960\" && conditionTrue)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addStyleClass(this.__baseComponent,className + postFix);\r\n\t\t\t\t}\r\n\t\t\t\trefresh();\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.base.deviceViewChanged.call(this,conditionTrue,query);\r\n\t};\r\n\t\r\n\t//call this function when outer container width or height changes and enableAutoResize is false\r\n\tNSGrid.prototype.reRender = function()\r\n\t{\r\n\t\tif(this.__divOuterContainer)\r\n\t\t{\r\n\t\t\tthis.__setComponentHeight();\r\n\t\t\tthis.__setOuterContainerMeasurement();\r\n\t\t\t//done the below so that if the width of cell is in % then it will take its corresponding value after resize\r\n\t\t\tthis.__setTableWidth(null);\r\n\t\t\tthis.__renderBody(false);\r\n\t\t\tthis.__lastBaseMeasurement = this.__baseComponent.getBoundingClientRect();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getGridState = function()\r\n\t{\r\n\t\tvar data = {};\r\n\t\tdata.columns = this.__columns;\r\n\t\treturn data;\r\n\t};\r\n\t\r\n\t//setState name conflicts with react setState method\r\n\tNSGrid.prototype.setGridState = function(data)\r\n\t{\r\n\t\tif(data)\r\n\t\t{\r\n\t\t\tif(data[\"columns\"] && data[\"columns\"].length > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__createColumnProvider(data[\"columns\"]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setColumn = function(arrColumns)\r\n\t{\r\n\t\t//moving __initializePluggins here to ensure that the Pluggins are downloaded and then they are initialized\r\n\t\tthis.__initializePluggins();\r\n\t\tif(arrColumns && arrColumns.length > 0)\r\n\t\t{\r\n\t\t\tthis.__orignalColumns = arrColumns;\r\n\t\t\tthis.__objGrid.__checkForAdditionalColumns();\r\n\t\t\tthis.__processPinnedColumn();\r\n\t\t\tfor(var count = 0;count < this.__orignalColumns.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = this.__orignalColumns[count];\r\n\t\t\t\t//reset column visibility initially\r\n\t\t\t\tthis.__setColumnVisibility(count,true,item);\r\n\t\t\t\tthis.__processColumnObject(item,count);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__orignalColumns = [];\r\n\t\t}\r\n\t\tthis.__columns = this.__orignalColumns.slice(0);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setContextMenuSetting = function(contextMenuSetting)\r\n\t{\r\n\t\tthis.__contextMenuSetting = contextMenuSetting;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.dataSource = function(source,isReset)\r\n\t{\r\n\t\tif(!this.util.isUndefined(source))\r\n\t\t{\r\n\t\t\t//var start = new Date().getTime();\r\n\t\t\tif(this.util.isUndefinedOrNull(isReset))\r\n\t\t\t{\r\n\t\t\t\tisReset = true;\r\n\t\t\t}\r\n\t\t\tthis.__dataSource = source;\r\n\t\t\tif(this.__isCreationCompleted)\r\n\t\t\t{\r\n\t\t\t\tthis.__rowsRendered = false;\r\n\t\t\t\tif(isReset)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__setComponentHeight();\r\n\t\t\t\t}\r\n\t\t\t\tthis.__resetPluggins();\r\n\t\t\t\tthis.__createStructure();\r\n\t\t\t\tthis.__callPlugginsInitialize();\r\n\t\t\t\tthis.__addColumnPseudoStyle();\r\n\t\t\t\tif(this.__dataSource && this.__dataSource.length > 0 && this.__dataSource[0])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__orignalItemKey = Object.keys(this.__dataSource[0]);\r\n\t\t\t\t\tthis.__objGrid.dataSource();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__arrWrapper = [];\r\n\t\t\t\t\tthis.__arrInternalSource = [];\r\n\t\t\t\t\tthis.__updateTotalRecords(0);\r\n\t\t\t\t}\r\n\t\t\t\tthis.__setMeasurement();\r\n\t\t\t\tif(isReset)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsGridSort.reset();\r\n\t\t\t\t}\r\n\t\t\t\tthis.__setHeaderSortFunction();\r\n\t\t\t\tif(isReset || !this.__processDefaultSort())\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__renderBody(false);\r\n\t\t\t\t}\r\n\t\t\t\tthis.__handleHiddenColumn();\r\n\t\t\t\tthis.__addRowHeightInDOM();\r\n\t\t\t\t//setTimeout(function(){ self.__dispatchEvent(NSGrid.GRID_RENDERED); }, 700);\r\n\t\t\t\tif(this.__enableAutoResize)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.attachResizeListener();\r\n\t\t\t\t}\r\n\t\t\t\tthis.__objGrid.afterGridRendered();\r\n\t\t\t\tthis.__dispatchEvent(NSGrid.GRID_RENDERED);\r\n\t\t\t\t\r\n\t\t\t\t/*var end = new Date().getTime();\r\n\t\t\t\tvar time = end - start;\r\n\t\t\t\tconsole.debug('Execution time: ' + (time / 1000.0));*/\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t//always add as the first item so that when execute we can start from end and remove the elements\r\n\t\t\t\tthis.__queueFunc.splice(0, 0, this.dataSource.bind(this,source,isReset));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.__dataSource;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getOrignalItem = function(item)\r\n\t{\r\n\t\tif(item && this.__orignalItemKey && this.__orignalItemKey.length > 0)\r\n\t\t{\r\n\t\t\tvar retItem = {};\r\n\t\t\tvar key = null;\r\n\t\t\tfor(var count = 0;count < this.__orignalItemKey.length;count++)\r\n\t\t\t{\r\n\t\t\t\tkey = this.__orignalItemKey[count];\r\n\t\t\t\tif(!this.util.startsWith(key,this.__fieldPrefix))\r\n\t\t\t\t{\r\n\t\t\t\t\tretItem[key] = item[key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn retItem;\r\n\t\t}\r\n\t\treturn item;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.addRows = function(source)\r\n\t{\r\n\t\tthis.__stopScroll = true;\r\n\t\tif(source && source.length > 0)\r\n\t\t{\r\n\t\t\tvar startIndex = this.__arrInternalSource.length;\r\n\t\t\tif(!this.__addRemoveRowCallInternal)\r\n\t   \t \t{\r\n\t\t\t\tthis.__objGrid.__setWrapperSource(source,startIndex,-1,0,true);\r\n\t   \t \t}\r\n\t\t\t//this logic might be wrong for filtered result or sorted list\r\n\t\t\tthis.__arrInternalSource = this.__arrInternalSource.concat(source);\r\n\t\t\tthis.__createBodyBody(this.__arrInternalSource,startIndex,this.__arrInternalSource.length);\r\n\t   \t \tif(!this.__addRemoveRowCallInternal)\r\n\t   \t \t{\r\n\t   \t \t\tthis.__arrWrapper = this.__arrWrapper.concat(source);\r\n\t   \t \t\tthis.__updateTotalRecords();\r\n\t   \t \t}\r\n\t   \t \tthis.__addRemoveRowCallInternal = false;\r\n\t\t}\r\n\t\tthis.__stopScroll = false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.removeRows = function(arrIndex)\r\n\t{\r\n\t\tif(!this.__enableHierarchical && !this.__enableGrouping && !this.__enableMasterDetail && arrIndex && arrIndex.length > 0)\r\n\t\t{\r\n\t\t\tarrIndex.sort();\r\n\t   \t \tfor (var rowIndex = arrIndex.length - 1; rowIndex >= 0; rowIndex--)\r\n\t\t    {\r\n\t   \t \t\tvar index = arrIndex[rowIndex];\r\n\t   \t \t\tif(index > 0 && index < this.__arrInternalSource.length)\r\n\t   \t \t\t{\r\n\t\t   \t \t\t//if virtual scroll or Pagination of type Page is enabled then do not remove rows\r\n\t\t   \t \t\tif(!(this.__enableVirtualScroll || (this.__enablePagination && !this.__isPaginationTypeScroll)))\r\n\t\t   \t \t\t{\r\n\t\t   \t \t\t\tthis.__tblCenterBodyBody.deleteRow(index);\r\n\t\t   \t \t\t}\r\n\t\t   \t \t\tthis.__arrInternalSource.splice(index, 1);\r\n\t\t   \t \t\tthis.__arrWrapper.splice(index, 1);\r\n\t   \t \t\t}\r\n\t\t    }\r\n\t   \t \tif(!this.__addRemoveRowCallInternal)\r\n\t\t \t{\r\n\t\t \t\tthis.__updateTotalRecords();\r\n\t\t \t}\r\n\t\t \tthis.__addRemoveRowCallInternal = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.groupBy = function(groupByField)\r\n\t{\r\n\t\tif(this.__enableGrouping && groupByField && groupByField.length > 0)\r\n\t\t{\r\n\t\t\tif(this.__setting)\r\n\t\t\t{\r\n\t\t\t\tthis.__setting[\"groupByField\"] = groupByField;\r\n\t\t\t}\r\n\t\t\tthis.propertyChange(\"groupByField\",this.__groupByField,groupByField,true);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.expandAll = function()\r\n\t{\r\n\t\tif(this.__enableHierarchical || this.__enableGrouping || this.__enableMasterDetail)\r\n\t\t{\r\n\t\t\tthis.__expandCollapseAll(false);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.collapseAll = function()\r\n\t{\r\n\t\tif(this.__enableHierarchical || this.__enableGrouping || this.__enableMasterDetail)\r\n\t\t{\r\n\t\t\tthis.__expandCollapseAll(true);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.expandByRow = function(element,rowIndex)\r\n\t{\r\n\t\tthis.expandCollapseByRow(element,rowIndex,false);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.collapseByRow = function(element,rowIndex)\r\n\t{\r\n\t\tthis.expandCollapseByRow(element,rowIndex,true);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.expandByKeyField = function(keyFieldValue) \r\n\t{\r\n\t\tthis.expandCollapseByKeyField(keyFieldValue,false);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.collapseByKeyField = function(keyFieldValue) \r\n\t{\r\n\t\tthis.expandCollapseByKeyField(keyFieldValue,true);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.expandCollapseByKeyField = function(keyFieldValue,isCollapse)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(keyFieldValue))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tvar index = this.__getIndexByItem(item);\r\n\t\t\t\tthis.expandCollapseByRow(null,index,isCollapse);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.expandCollapseByRow = function(element,rowIndex,isCollapse)\r\n\t{\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\telement = this.util.findParent(element,\"TR\");\r\n\t\t\tif(element)\r\n\t\t\t{\r\n\t\t\t\trowIndex = parseInt(element.getAttribute(\"ns-index\"));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(rowIndex > 0)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(isCollapse)) {\r\n\t\t\t\tisCollapse = this.__isRowCollapsed(null,rowIndex);\r\n\t\t\t\tisCollapse = !isCollapse;\r\n\t\t\t}\r\n\t\t\trowIndex = parseInt(rowIndex);\r\n\t\t\tthis.__showHideRow(rowIndex,element,isCollapse);\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tthis.__objGrid.arrowClickHandler(item,isCollapse);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tthis.util.warning(\"NSGrid\",\"Row Index starts with index 1.\");\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getRowInfo = function(row)\r\n\t{\r\n\t\tif(row)\r\n\t\t{\r\n\t\t\tvar objInfo = {};\r\n\t\t\tobjInfo.rowIndex = parseInt(row.getAttribute(\"ns-index\"));\r\n\t\t\tobjInfo.rowLevel = parseInt(row.getAttribute(\"ns-level\"));\r\n\t\t\tobjInfo.rowParentIndex = parseInt(row.getAttribute(\"ns-parent-index\"));\r\n\t\t\tobjInfo.item = this.__getItemByIndex(objInfo.rowIndex);\r\n\t\t\tobjInfo.rowOrignalIndex = objInfo.item[this.__fieldVisibleIndex];\r\n\t\t\treturn objInfo;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getCellInfo = function(cell)\r\n\t{\r\n\t\tif(cell)\r\n\t\t{\r\n\t\t\tvar objInfo = {};\r\n\t\t\tvar row = this.util.findParent(cell,\"TR\");\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tobjInfo = this.getRowInfo(row);\r\n\t\t\t\tobjInfo.row = row;\r\n\t\t\t\tobjInfo.cellIndex = cell.cellIndex;\r\n\t\t\t\treturn objInfo;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getItemInfo = function(objItem)\r\n\t{\r\n\t\tvar objReturn = null;\r\n\t\tif(!this.util.isUndefinedOrNull(objItem))\r\n\t\t{\r\n\t\t\tvar target = null;\r\n\t\t\tvar event = this.util.getEvent(objItem);\r\n\t\t\tif(event)\r\n\t\t\t{\r\n\t\t\t\ttarget = this.util.getTarget(event);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttarget = objItem;\r\n\t\t\t}\r\n\t\t\tif(target && this.util.isElement(target))\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isElementOfType(target,\"TR\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjReturn = this.getRowInfo(target);\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.util.isElementOfType(\"TD\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjReturn = this.getCellInfo(target);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget = this.util.findParent(target,\"TD\");\r\n\t\t\t\t\tobjReturn = this.getCellInfo(target);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(this.util.isNumber(objItem))\r\n\t\t\t{\r\n\t\t\t\tvar index = parseInt(objItem);\r\n\t\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\t/*if(item[this.__fieldRow])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tobjReturn = this.getRowInfo(item[this.__fieldRow]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{*/\r\n\t\t\t\t\t\tobjReturn = {};\r\n\t\t\t\t\t\tobjReturn.rowIndex = item[this.__fieldIndex];\r\n\t\t\t\t\t\tobjReturn.rowOrignalIndex = item[this.__fieldVisibleIndex];\r\n\t\t\t\t\t\tobjReturn.rowLevel = item[this.__fieldRowLevel];\r\n\t\t\t\t\t\tobjReturn.rowParentIndex = item[this.__fieldParentIndex];\r\n\t\t\t\t\t\tobjReturn.parentItem = this.__getItemByIndex(objReturn.rowParentIndex);\r\n\t\t\t\t\t\tobjReturn.item = item;\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if (this.util.isObject(objItem) && objItem.hasOwnProperty(this.__fieldIndex)) \r\n\t\t\t{\r\n            \tvar objReturn = {};\r\n                objReturn.rowIndex = objItem[this.__fieldIndex];\r\n                objReturn.rowOrignalIndex = objItem[this.__fieldVisibleIndex];\r\n                objReturn.rowLevel = objItem[this.__fieldRowLevel];\r\n                objReturn.rowParentIndex = objItem[this.__fieldParentIndex];\r\n                objReturn.item = objItem;\r\n            }\r\n\t\t}\r\n\t\treturn objReturn;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getItemInfoByKeyField = function(keyFieldValue)\r\n\t{\r\n\t\tvar objReturn = null;\r\n\t\tif(!this.util.isUndefinedOrNull(keyFieldValue))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tobjReturn = this.getItemInfo(item);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn objReturn;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.cascadeValues = function(event,callBack)\r\n\t{\r\n\t\tif(this.__enableGrouping)\r\n\t\t{\r\n\t\t\tvar control = this.util.getTarget(event);\r\n\t\t\tvar cell = this.util.findParent(control,\"TD\");\r\n\t\t\tvar objCellInfo = this.getCellInfo(cell);\r\n\t\t\tvar row = objCellInfo.row;\r\n\t\t\tvar cellIndex = objCellInfo.cellIndex;\r\n\t\t\tvar colItem = this.__columns[cellIndex];\r\n\t\t\tvar dataField = colItem.dataField;\r\n\t\t\tvar cascadeValue = this.util.getControlValue(control);\r\n\t\t\tvar flatSource = this.__objGrid.__getFlatSource();\r\n\t\t\tvar rowIndex = objCellInfo.rowIndex;\r\n\t\t\tvar retIndex = this.__getActualIndex(flatSource,rowIndex);\r\n\t\t\tif(retIndex !== rowIndex)\r\n\t\t\t{\r\n\t\t\t\trowIndex = (retIndex + 1);\r\n\t\t\t}\r\n\t\t\tvar groupItem = objCellInfo[\"item\"];//flatSource[rowIndex];\r\n\t\t\tif(groupItem)\r\n\t\t\t{\r\n\t\t\t\tgroupItem[dataField] = cascadeValue;\r\n\t\t\t}\r\n\t\t\tfor(var count = rowIndex;count < flatSource.length;count ++)\r\n\t\t\t{\r\n\t\t\t\tvar item = flatSource[count];\r\n\t\t\t\tvar childRow = item[this.__fieldRow];\r\n\t\t\t\tif(item[this.__fieldRowLevel] !== objCellInfo.rowLevel)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar isSetValue = false;\r\n\t                var setValue = null;\r\n\t                if(childRow && item[this.__fieldRowVisible])\r\n\t                {\r\n\t                   var childCell = childRow.cells[cellIndex];\r\n\t                   if(childCell.getElementsByTagName(control.tagName).length > 0)\r\n\t                   {\r\n\t                      var childControl = childCell.getElementsByTagName(control.tagName)[0];\r\n\t                      if(childControl)\r\n\t                      {\r\n\t                             if(callBack)\r\n\t                             {\r\n\t                                callBack(control,childControl,item,dataField,cellIndex,colItem,childCell,row);\r\n\t                                isSetValue = false;\r\n\t                             }\r\n\t                             else\r\n\t                             {\r\n\t                                setValue = this.util.setControlValue(childControl,cascadeValue);\r\n\t                                isSetValue = true;\r\n\t                             }\r\n\t                      }\r\n\t                   }\r\n\t                   else if(callBack)\r\n\t\t               {\r\n\t\t                  callBack(control,null,item,dataField,cellIndex,colItem,null,row);\r\n\t\t                  isSetValue = false;\r\n\t\t               }\r\n\t\t               else\r\n\t\t               {\r\n\t\t            \t  setValue = cascadeValue;\r\n\t\t                  isSetValue = true;\r\n\t\t               }\r\n\t                }\r\n\t                else if(callBack)\r\n\t                {\r\n\t                    callBack(control,null,item,dataField,cellIndex,colItem,null,row);\r\n\t                    isSetValue = false;\r\n\t                }\r\n\t                else\r\n\t                {\r\n\t                   setValue = cascadeValue;\r\n\t                   isSetValue = true;\r\n\t                }\r\n\t                if(isSetValue)\r\n\t                {\r\n\t                   item[dataField] = setValue;\r\n\t                }\r\n\t                this.updateItemInDataSource(item);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setFontSize = function(fontSize)\r\n\t{\r\n\t\tif(this.__tblCenterHeader)\r\n\t\t{\r\n\t\t\tthis.__tblCenterHeader.style.fontSize = fontSize;\r\n\t\t}\r\n\t\tif(this.__tblCenterBody)\r\n\t\t{\r\n\t\t\tthis.__tblCenterBody.style.fontSize = fontSize;\r\n\t\t}\r\n\t};\r\n\t\r\n\t//assuming column is added at last\r\n\t//if reposition then use swapColumn\r\n\tNSGrid.prototype.addColumn = function(objColumn)\r\n\t{\r\n\t\tif(objColumn)\r\n\t\t{\r\n\t\t\tthis.__processColumnObject(objColumn,this.__columns.length);\r\n\t\t\tif(!this.__isColumnExist(objColumn[\"dataField\"]))\r\n\t\t\t{\r\n\t\t\t\tthis.__editColumnArray(\"add\",objColumn);\r\n\t\t\t\tvar headerRow = this.__getHeaderHeaderRow(this.__tblCenterHeader);\r\n\t\t\t\tif(headerRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\t\t\t\tvar rendererRow = this.__getHeaderFilterRow(this.__tblCenterHeader);\r\n\t\t\t\t\tif(headerBodyRow)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__createHeaderColGroup(objColumn);\r\n\t\t\t\t\t\tthis.__createHeaderHeaderCell(objColumn,headerRow);\r\n\t\t\t\t\t    this.__createHeaderBodyCell(objColumn,headerBodyRow,rendererRow,this.__columns.length - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar bodyRow = this.__getBodyHeaderRow(this.__tblCenterBody);\r\n\t\t    \tif(bodyRow)\r\n\t\t\t\t{\r\n\t\t    \t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\t    \t\tif(arrRows && arrRows.length > 0)\r\n\t\t    \t\t{\r\n\t\t    \t\t\tvar arrItems = this.__arrInternalSource;\r\n\t\t\t    \t\tthis.__createBodyColGroup(objColumn);\r\n\t\t\t    \t\tthis.__createBodyHeaderCell(objColumn,bodyRow);\r\n\t\t\t    \t\tvar row = null;\r\n\t\t\t    \t\tvar item = null;\r\n\t\t\t    \t\tfor (var rowCount = 0; rowCount < arrRows.length; rowCount++) \r\n\t\t\t    \t\t{\r\n\t\t\t    \t\t\trow = arrRows[rowCount];\r\n\t\t\t    \t\t\titem = arrItems[rowCount];\r\n\t\t\t    \t\t\tvar colIndex = this.__columns.length - 1;\r\n\t\t\t    \t\t\tvar cell = this.__createBodyRowCell(row,colIndex,true);\r\n\t\t\t    \t\t\tthis.__setBodyCellProperty(row,cell,item,objColumn,colIndex,-1,0,true);\r\n\t\t\t    \t    }\r\n\t\t    \t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.__alignTables(false);\r\n\t\t\t\tthis.__setHeaderSortFunctionForItem(objColumn);\r\n\t\t\t\tthis.__addColumnPseudoStyle();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.showColumn(objColumn[\"dataField\"]);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tthis.util.warning(\"NSGrid\",\"Please pass valid Column object to be added.\");\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\t//programmatic method to call deviceViewChanged\r\n\tNSGrid.prototype.changeDeviceView = function(conditionTrue)\r\n\t{\r\n\t\tthis.deviceViewChanged(conditionTrue);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.hideColumn = function(column)\r\n\t{\r\n\t\tvar index = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\tif(index > -1)\r\n\t\t{\r\n\t\t\tif(this.__isColumnValidForSwapOrRemove(index,\"hidden\"))\r\n\t\t\t{\r\n\t\t\t\t//this.__removeHeaderCell(index);\r\n\t\t\t\t//this.__removeBodyColumn(index);\r\n\t\t\t\t//this.__removeFooterColumn(index);\r\n\t\t\t\tthis.__editColumnArray(\"hide\",index);\r\n\t\t\t\tthis.__setColumnVisibility(index,false);\r\n\t\t\t\tthis.__alignTables(false);\r\n\t\t\t\tthis.__addColumnPseudoStyle();\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.showColumn = function(column)\r\n\t{\r\n\t\tvar index = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\tif(index > -1)\r\n\t\t{\r\n\t\t\tthis.__editColumnArray(\"show\",index);\r\n\t\t\tthis.__setColumnVisibility(index,true,column);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.swapColumns = function(sourceColumn,destinationColumn)\r\n\t{\r\n\t\tvar sourceIndex = this.__getColumnIndexForSwapOrRemove(sourceColumn);\r\n\t\tvar destinationIndex = this.__getColumnIndexForSwapOrRemove(destinationColumn);\r\n\t\tif(sourceIndex > -1 && destinationIndex > -1)\r\n\t\t{\r\n\t\t\tvar sourceValid = this.__isColumnValidForSwapOrRemove(sourceIndex,\"swapped\");\r\n\t\t\tvar destinationValid = this.__isColumnValidForSwapOrRemove(destinationIndex,\"swapped\");\r\n\t\t\tif(sourceValid && destinationValid)\r\n\t\t\t{\r\n\t\t\t\tthis.__swapOrMoveHeaderCell(\"swap\",sourceIndex,destinationIndex);\r\n\t\t\t\tthis.__swapOrMoveBodyCell(\"swap\",sourceIndex,destinationIndex);\r\n\t\t\t\tthis.__swapOrMoveFooterCell(\"swap\",sourceIndex,destinationIndex);\r\n\t\t\t\tthis.__alignTables(false);\r\n\t\t\t\tthis.__columns[sourceIndex][this.__fieldColIndex] = destinationIndex;\r\n\t\t\t\tthis.__columns[destinationIndex][this.__fieldColIndex] = sourceIndex;\r\n\t\t\t\tthis.util.swapArrayItems(this.__columns,sourceIndex,destinationIndex);\r\n\t\t\t\tthis.__addColumnPseudoStyle();\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.moveColumn = function(column,toIndex)\r\n\t{\r\n\t\tvar sourceIndex = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\ttoIndex = this.__getColumnIndexForSwapOrRemove(toIndex);\r\n\t\tif(sourceIndex > -1 && toIndex > -1 && sourceIndex !== toIndex)\r\n\t\t{\r\n\t\t\tvar sourceValid = this.__isColumnValidForSwapOrRemove(sourceIndex,\"moved\");\r\n\t\t\tvar destinationValid = this.__isColumnValidForSwapOrRemove(toIndex,\"moved\");\r\n\t\t\tif(sourceValid && destinationValid)\r\n\t\t\t{\r\n\t\t\t\tthis.__swapOrMoveHeaderCell(\"move\",sourceIndex,toIndex);\r\n\t\t\t\tthis.__swapOrMoveBodyCell(\"move\",sourceIndex,toIndex);\r\n\t\t\t\tthis.__swapOrMoveFooterCell(\"move\",sourceIndex,toIndex);\r\n\t\t\t\tvar currentColumn = this.__columns[toIndex];\r\n\t\t\t\tvar direction = \"no\";\r\n\t\t\t\tif((currentColumn && currentColumn.pinned) || this.__columns[sourceIndex].pinned)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__columns[sourceIndex].pinned = null;\r\n\t\t\t\t\tif(currentColumn.pinned)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdirection = currentColumn.pinned;\r\n\t\t\t\t\t\tthis.__columns[sourceIndex].pinned = currentColumn.pinned;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__updateFixedColCounts();\r\n\t\t\t\t\tthis.__createFixedRows();\r\n\t\t\t\t}\r\n\t\t\t\tthis.__alignTables(false);\r\n\t\t\t\t//this.__setFixedCellsPosition();\r\n\t\t\t\tthis.__columns[sourceIndex][this.__fieldColIndex] = toIndex;\r\n\t\t\t\tthis.util.moveArrayItem(this.__columns,sourceIndex,toIndex);\r\n\t\t\t\tvar smallIndex = Math.min(sourceIndex,toIndex);\r\n\t\t\t\tfor(var count = smallIndex;count < this.__columns.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__columns[count][this.__fieldColIndex] = count;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__addColumnPseudoStyle();\r\n\t\t\t\tthis.__updateColumnClassForFixedColumns(toIndex,direction);\r\n\t\t\t\tthis.__addStyleForFixedColumns();\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.sortBy = function(column,isAscending)\r\n\t{\r\n\t\tvar index = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\tif(index > -1 && headerBodyRow)\r\n\t\t{\r\n\t\t\tvar arrHeaderCells = headerBodyRow.cells;\r\n\t\t\tvar cell = arrHeaderCells[index];\r\n\t\t    var columnDetail = this.__getColumnObject(cell.getAttribute(\"currentColumnIndex\"));\r\n\t\t    this.__nsGridSort.handle(cell,columnDetail,false,isAscending);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.autoResizeColumn = function(column)\r\n\t{\r\n\t\tvar index = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\tthis.__nsGridColumnResize.autoResize(index);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.pinColumn = function(column,direction)\r\n\t{\r\n\t\tvar index = this.__getColumnIndexForSwapOrRemove(column);\r\n\t\tvar columnDetail = this.__getColumnObject(index);\r\n\t\tif(columnDetail)\r\n\t\t{\r\n\t\t\tif(columnDetail.pinned != direction)\r\n\t\t\t{\r\n\t\t\t\tvar toIndex = -1;\r\n\t\t\t\tswitch(direction)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase \"left\":\r\n\t\t\t\t\t\tfor(var count = 0;count < this.__columns.length;count++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(this.__columns[count].pinned != \"left\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\ttoIndex = count;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"right\":\r\n\t\t\t\t\t\t//this.__columns = this.__orignalColumns.slice(0);\r\n\t\t\t\t\t\tfor(var count = this.__columns.length - 1;count > -1;count--)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(this.__columns[count].pinned != \"right\")\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\ttoIndex = count;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tvar update = false;\r\n\t\t\t\tif(toIndex > -1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.moveColumn(index,toIndex)) {\r\n\t\t\t\t\t\tupdate = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tupdate = true;\r\n\t\t\t\t\ttoIndex = index;\r\n\t\t\t\t}\r\n\t\t\t\tif(update) {\r\n\t\t\t\t\tcolumnDetail.pinned = direction;\r\n\t\t\t\t\tthis.__updateFixedColCounts();\r\n\t\t\t\t\tthis.__createFixedRows();\r\n\t\t\t\t\t//this.__setFixedCellsPosition();\r\n\t\t\t\t\tthis.__updateColumnClassForFixedColumns(toIndex,direction);\r\n\t\t\t\t\tthis.__addStyleForFixedColumns();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.updateRowByIndex = function(index)\r\n\t{\r\n\t\tvar item = this.__getItemByIndex(index);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar row = this.__getRowFromItem(item);\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar cells = row.cells;\r\n\t\t\t\tfor (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t        {\r\n\t\t\t\t\tvar cell = cells[colIndex];\r\n\t\t        \tvar colItem = this.__columns[colIndex];\r\n\t\t        \tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t\t        }\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.updateRowByKeyField = function(keyFieldValue)\r\n\t{\r\n\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tvar row = this.__getRowFromItem(item);\r\n\t\t\tif(row && parseInt(row.getAttribute(\"ns-index\")) === item[this.__fieldIndex])\r\n\t\t\t{\r\n\t\t\t\tvar cells = row.cells;\r\n\t\t\t\tfor (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t        {\r\n\t\t\t\t\tvar cell = cells[colIndex];\r\n\t\t        \tvar colItem = this.__columns[colIndex];\r\n\t\t        \tthis.__updateCellText(row,cell,item,colItem,item[this.__fieldIndex],colIndex);\r\n\t\t        }\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.updateCellByIndex = function(index,dataField)\r\n\t{\r\n\t\tvar item = this.__getItemByIndex(index);\r\n\t\tvar colItem = this.__getColumnObjectByDataField(dataField);\r\n\t\tif(item && colItem)\r\n\t\t{\r\n\t\t\tvar colIndex = colItem[this.__fieldColIndex];\r\n\t\t\tvar row = this.__getRowFromItem(item);\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar cells = row.cells;\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\tthis.__updateCellText(row,cell,item,colItem,index,colIndex);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.updateCellByKeyField = function(keyFieldValue,dataField)\r\n\t{\r\n\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\tvar colItem = this.__getColumnObjectByDataField(dataField);\r\n\t\tif(item && colItem)\r\n\t\t{\r\n\t\t\tvar colIndex = colItem[this.__fieldColIndex];\r\n\t\t\tvar row = this.__getRowFromItem(item);\r\n\t\t\tif(row)\r\n\t\t\t{\r\n\t\t\t\tvar cells = row.cells;\r\n\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\tthis.__updateCellText(row,cell,item,colItem,item[this.__fieldIndex],colIndex);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.updateItemInDataSource = function(item)\r\n\t{\r\n\t\tthis.__updateItemInSource(item);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getGroupedSource = function()\r\n\t{\r\n\t\treturn this.__arrFilteredGroupedSource;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setSelectedItems = function(arrItems)\r\n\t{\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__getAllItems();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tthis.__clearAllRowSelection(true);\r\n\t\t\t\tvar length = arrItems.length;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tindex = this.__getIndexByItem(item);\r\n\t\t\t\t\tif(index > -1 && source && index < source.length)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__setIndex(index,true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.addSelectedItems = function(arrItems)\r\n\t{\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__getAllItems();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tvar length = arrItems.length;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tindex = this.__getIndexByItem(item);\r\n\t\t\t\t\tif(index > -1 && source)// && index < source.length\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__setIndex(index,true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.removeSelectedItems = function(arrItems)\r\n\t{\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__getAllItems();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tvar length = arrItems.length;\r\n\t\t\t\tvar item = null;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tindex = this.__getIndexByItem(item);\r\n\t\t\t\t\tif(index > -1 && source)// && index < source.length\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__markRowUnselected(index);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setSelectedItem = function(item)\r\n\t{\r\n\t\tthis.setSelectedItems([item]);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setSelectedIndexes = function(arrSelectedIndex)\r\n\t{\r\n\t\tif(arrSelectedIndex && arrSelectedIndex.length > 0)\r\n\t\t{\r\n\t\t\tvar source = this.__getAllItems();\r\n\t\t\tif(source)\r\n\t\t\t{\r\n\t\t\t\tvar length = arrSelectedIndex.length;\r\n\t\t\t\tvar index = -1;\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tindex = arrSelectedIndex[count];\r\n\t\t\t\t\tif(index > -1 && source && index < source.length)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__setIndex(index,true);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setSelectedIndex = function(selectedIndex)\r\n\t{\r\n\t\tthis.setSelectedIndexes([selectedIndex]);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.unSelectItems = function(arrItems)\r\n\t{\r\n\t\tthis.removeSelectedItems(arrItems);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.unSelectItem = function(arrItems)\r\n\t{\r\n\t\tthis.unSelectItems([arrItems]);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.unSelectIndexes = function(arrSelectedIndex)\r\n\t{\r\n\t\t\r\n\t};\r\n\t\r\n\tNSGrid.prototype.unSelectIndex = function(selectedIndex)\r\n\t{\r\n\t\tthis.unSelectIndexes([selectedIndex]);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getSelectedIndex = function()\r\n\t{\r\n\t\treturn this.__selectedIndex;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getSelectedItem = function()\r\n\t{\r\n\t\treturn this.__selectedItem;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getSelectedIndexes = function()\r\n\t{\r\n\t\treturn this.__selectedIndexes;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getSelectedItems = function()\r\n\t{\r\n\t\treturn this.__selectedItems;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.deselectAll = function()\r\n\t{\r\n\t\tthis.__clearAllRowSelection(true);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.filter = function(filter,setting,enableHighlighting,recordLimit)\r\n\t{\r\n\t\tthis.__nsGridFilter.__handleFiltering(filter,setting,enableHighlighting,recordLimit);\r\n\t\tthis.__nsGridFilter.setFiltersInControls(filter);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.resetFilters = function()\r\n\t{\r\n\t\tthis.__nsGridFilter.clearFilters();\r\n\t\tthis.__nsGridFilter.resetFilters();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getFilteredData = function()\r\n\t{\r\n\t\treturn this.__arrInternalSource;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.highlightText = function(dataField,text)\r\n\t{\r\n\t\tvar colItem = this.__getColumnObjectByDataField(dataField);\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tvar index = colItem[this.__fieldColIndex];\r\n\t\t\tvar arrRows = this.__tblCenterBodyBody.rows;\r\n\t\t\tvar length = arrRows.length;\r\n\t\t\tfor(var rowIndex = 0; rowIndex < length; rowIndex++)\r\n\t\t    {\r\n\t\t\t\tvar cell = arrRows[rowIndex].cells[index];\r\n\t\t\t\tif(cell)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divText = cell.querySelector(\".\" + this.__CLASS_CELL_CHILD);\r\n\t\t\t\t\tif(divText)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.util.unHighlightText(divText,\"nsTextHighlight\");\r\n\t\t\t\t\t\tthis.util.highlightText(divText,text,\"nsTextHighlight\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.unHighlightText = function()\r\n\t{\r\n\t\tvar arrRows = this.__tblCenterBodyBody.rows;\r\n\t\tvar length = arrRows.length;\r\n\t\tfor(var rowIndex = 0; rowIndex < length; rowIndex++)\r\n\t    {\r\n\t\t\tvar colLength = this.__columns.length;\r\n\t\t\tfor(var colIndex = 0; colIndex < colLength; colIndex++)\r\n\t\t    {\r\n\t\t\t\tvar cell = arrRows[rowIndex].cells[colIndex];\r\n\t\t\t\tif(cell)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divText = cell.querySelector(\".\" + this.__CLASS_CELL_CHILD);\r\n\t\t\t\t\tif(divText)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.util.unHighlightText(divText,\"nsTextHighlight\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t    }\r\n\t    }\r\n\t};\r\n\t\r\n\t//call this function if the Grid has Fixed Columns and the header calculation is not perfect due to external elements\r\n\t//call this function after all the elements are rendered by javascript\r\n\tNSGrid.prototype.fixFixedHeader = function()\r\n\t{\r\n\t\tthis.__renderBody(false);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setSelectedRows = function(arrIndex)\r\n\t{\r\n\t\t/*if(arrIndex && arrIndex.length > 0)\r\n\t\t{\r\n\t\t\tarrIndex.sort();\r\n\t   \t \tfor (var rowIndex = arrIndex.length - 1; rowIndex >= 0; rowIndex--)\r\n\t\t    {\r\n\t   \t \t\tvar index = arrIndex[rowIndex];\r\n\t   \t \t\tif(index > 0 && index < this.__arrInternalSource.length)\r\n\t   \t \t\t{\r\n\t\t   \t \t\t//if virtual scroll or Pagination of type Page is enabled then do not remove rows\r\n\t\t   \t \t\tif(!(this.__enableVirtualScroll || (this.__enablePagination && !this.__isPaginationTypeScroll)))\r\n\t\t   \t \t\t{\r\n\t\t   \t \t\t\tthis.__tblCenterBodyBody.deleteRow(index);\r\n\t\t   \t \t\t}\r\n\t\t   \t \t\tthis.__arrInternalSource.splice(index, 1);\r\n\t\t   \t \t\tthis.__arrWrapper.splice(index, 1);\r\n\t   \t \t\t}\r\n\t\t    }\r\n\t   \t \tif(!this.__addRemoveRowCallInternal)\r\n\t\t \t{\r\n\t\t \t\tthis.__updateTotalRecords();\r\n\t\t \t}\r\n\t\t \tthis.__addRemoveRowCallInternal = false;\r\n\t\t}*/\r\n\t};\r\n\t\r\n\tNSGrid.prototype.scrollToIndex = function(selectedIndex,animationRequired)\r\n\t{\r\n\t\tselectedIndex = parseInt(selectedIndex);\r\n\t\tvar source = this.__objGrid.__getFlatSource();\r\n\t\tif(selectedIndex > -1 && source && selectedIndex < source.length)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(selectedIndex);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__enableCustomScrollBar)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar targetDimension = this.__virtualRowHeight * selectedIndex;\r\n\t\t\t\t\t\tthis.__setCustomScrollBarScrollTop(targetDimension);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.__nsVirtualScroll)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//because in list index is index+1\r\n\t\t\t\t\t\t\tthis.__nsVirtualScroll.scrollToIndex(selectedIndex,animationRequired);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar targetDimension = -1;\r\n\t\t\t\t\tif(item[this.__fieldRowHtml])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttargetDimension = (item[this.__fieldRowHtml].offsetTop);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar scrollTarget = this.__divCenterTableBodyContainer;\r\n\t\t\t\t\tif(animationRequired)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar animation = new this.util.animation(scrollTarget,[\r\n\t\t\t       \t  \t    {\r\n\t\t\t       \t  \t      time: 500,\r\n\t\t\t       \t  \t      property:\"scrollTop\",\r\n\t\t\t       \t  \t      target: targetDimension,\r\n\t\t\t       \t  \t    }\r\n\t\t\t       \t  \t]);\r\n\t\t\t   \t  \t  \tanimation.animate();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tscrollTarget.scrollTop = targetDimension;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.setNoDataMessage = function(message)\r\n\t{\r\n\t\tif(message && message.length > 0)\r\n\t\t{\r\n\t\t\tthis.__noDataMessage = message;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.renderHeaderExtraRows = function()\r\n\t{\r\n\t\tthis.__createHeaderExtraRows();\r\n\t};\r\n\t\r\n\t//Editor related public functions\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editByIndex(cellIndex,rowIndex),this.editByIndex(rowIndex,dataField)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editByIndex(rowIndex)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editByIndex = function(index,dataField)\r\n\t{\r\n\t\tif(this.util.isUndefinedOrNull(dataField))\r\n\t\t{\r\n\t\t\tthis.__nsGridEditor.edit(index);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__nsGridEditor.edit(dataField,index);\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editByKeyField(keyFieldValue,dataField)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editByKeyField(keyFieldValue)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editByKeyField = function(keyFieldValue,dataField)\r\n\t{\r\n\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\tvar rowIndex = this.__getIndexByItem(item);\r\n\t\tthis.editByIndex(rowIndex,dataField);\r\n\t};\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editByItem(item,dataField)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editByItem(item)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editByItem = function(item,dataField)\r\n\t{\r\n\t\tvar rowIndex = this.__getIndexByItem(item);\r\n\t\tthis.editByIndex(rowIndex,dataField);\r\n\t};\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editStopByIndex(cellIndex,rowIndex,isCancel),this.editStopByIndex(rowIndex,dataField,isCancel)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editStopByIndex(rowIndex,null,isCancel)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editStopByIndex = function(index,dataField,isCancel)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tisCancel = Boolean.parse(isCancel);\r\n\t\tvar callLater = function(param1,param2)\r\n\t\t{\r\n\t\t\tif(isCancel)\r\n\t\t\t{\r\n\t\t\t\tself.__nsGridEditor.cancelEdit(param1,param2);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tself.__nsGridEditor.saveEdit(param1,param2);\r\n\t\t\t}\r\n\t\t};\r\n\t\tif(this.util.isUndefinedOrNull(dataField))\r\n\t\t{\r\n\t\t\tcallLater(index);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcallLater(dataField,index);\r\n\t\t}\r\n\t};\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editStopByKeyField(keyFieldValue,dataField,isCancel)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editStopByKeyField(keyFieldValue,null,isCancel)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editStopByKeyField = function(keyFieldValue,dataField,isCancel)\r\n\t{\r\n\t\tvar item = this.__getItemBykeyField(keyFieldValue);\r\n\t\tvar rowIndex = this.__getIndexByItem(item);\r\n\t\tthis.editStopByIndex(rowIndex,dataField,isCancel);\r\n\t};\r\n\t\r\n\t/*\r\n\t * for editType = cell \r\n\t * combination can be this.editStopByItem(item,dataField,isCancel)\r\n\t * \r\n\t * for editType = row \r\n\t * combination can be this.editStopByItem(item,null,isCancel)\r\n\t * \r\n\t */\r\n\tNSGrid.prototype.editStopByItem = function(item,dataField,isCancel)\r\n\t{\r\n\t\tvar rowIndex = this.__getIndexByItem(item);\r\n\t\tthis.editStopByIndex(rowIndex,dataField,isCancel);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.getEditorInstances = function(element,dataField)\r\n\t{\r\n\t\tif(this.__nsGridEditor)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(dataField))\r\n\t\t\t{\r\n\t\t\t\treturn this.__nsGridEditor.getEditorInstances(element);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGridEditor.getEditorInstances(dataField,element);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.addItemsAsChildren = function(item,arrChildren)\r\n\t{\r\n\t\tthis.__objGrid.addItemsAsChildren(item,arrChildren);\r\n\t};\r\n\t//end of editor related public functions\r\n\t\r\n\tNSGrid.prototype.removeComponent = function()\r\n\t{\r\n\t\tif(this.__scroller)\r\n\t\t{\r\n\t\t\tthis.__scroller.remove();\r\n\t\t\tthis.__scroller = null;\r\n\t\t}\r\n\t\tif(this.__contextMenu)\r\n\t\t{\r\n\t\t\tthis.__contextMenu.remove();\r\n\t\t\tthis.__contextMenu = null;\r\n\t\t}\r\n\t\tif(this.__exportMenu)\r\n\t\t{\r\n\t\t\tthis.__exportMenu.remove();\r\n\t\t\tthis.__exportMenu = null;\r\n\t\t}\r\n\t\tif(this.__bodyScrollRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__getVerticalScrollableContainer(),\"scroll\",this.__bodyScrollRef);\r\n\t\t\tthis.__bodyScrollRef = null;\r\n\t\t}\r\n\t\tif(this.__synchronizeTablesRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(this.__getHorizontalScrollableContainer(),\"scroll\",this.__synchronizeTablesRef);\r\n\t\t\tthis.__synchronizeTablesRef = null;\r\n\t\t}\r\n\t\tif(this.__divCenterTableBodyMouseUpRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document,\"mouseup\",this.__divCenterTableBodyMouseUpRef);\r\n\t\t\tthis.__divCenterTableBodyMouseUpRef = null;\r\n\t\t}\r\n\t\tif(this.__keyDownRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document.body,\"keydown\",this.__keyDownRef);\r\n\t\t\tthis.__keyDownRef = null;\r\n\t\t}\r\n\t\tif(this.__keyUpRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(document.body,\"keyup\",this.__keyUpRef);\r\n\t\t\tthis.__keyUpRef = null;\r\n\t\t}\r\n\t\tif(this.__nsGridFilter)\r\n\t\t{\r\n\t\t\tthis.__nsGridFilter.remove();\r\n\t\t}\r\n\t\tif(this.__nsPopUpColumnSetting)\r\n\t\t{\r\n\t\t\tthis.__nsPopUpColumnSetting.remove();\r\n\t\t\tthis.__nsPopUpColumnSetting = null;\r\n\t\t}\r\n\t\tif(this.__nsVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__nsVirtualScroll.destroy();\r\n\t\t\tthis.__nsVirtualScroll = null;\r\n\t\t}\r\n\t\tif(this.__divOuterContainer && this.__divOuterContainer.parentElement) {\r\n\t\t\tthis.__divOuterContainer.parentElement.removeChild(this.__divOuterContainer);\r\n\t\t}\r\n\t\tthis.base.removeComponent.call(this);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setFields = function()\r\n\t{\r\n\t\tvar id = this.getID();\r\n\t\tthis.__fieldPrefix = \"ns_field\";\r\n\t\tthis.__fieldIndex = this.__fieldPrefix + \"_row_index\" + id;\r\n\t\tthis.__fieldVisibleIndex = this.__fieldPrefix + \"_row_visible_index\" + id;\r\n\t\tthis.__fieldRow = this.__fieldPrefix + \"_row\" + id;\r\n\t\tthis.__fieldRowHtml = this.__fieldPrefix + \"_row\" + id;\r\n\t\tthis.__fieldRowLevel = this.__fieldPrefix + \"_row_level\" + id;\r\n\t\tthis.__fieldRowVisible = this.__fieldPrefix + \"_row_visible\" + id;\r\n\t\tthis.__fieldRowHover = this.__fieldPrefix + \"_row_hover\" + id;\r\n\t\tthis.__fieldParentIndex = this.__fieldPrefix + \"_parent_index\" + id;\r\n\t\tthis.__fieldHasChild = this.__fieldPrefix + \"_row_hasChild\" + id;\r\n\t\tthis.__fieldHasParent = this.__fieldPrefix + \"_row_hasParent\" + id;\r\n\t\tthis.__fieldIsCollapsed = this.__fieldPrefix + \"_row_isCollapsed\" + id;\r\n\t\tthis.__fieldRowArrow = this.__fieldPrefix + \"row_arrow\" + id;\r\n\t\tthis.__fieldCellText = this.__fieldPrefix + \"cell_text\" + id;\r\n\t\tthis.__fieldSelected = this.__fieldPrefix + \"_selected\" + id;\r\n\t\tthis.__fieldColIndex = this.__fieldPrefix + \"_col_index\" + id;\r\n\t\tthis.__fieldColSortedAsc = this.__fieldPrefix + \"_col_sorted_asc\" + id;\r\n\t\tthis.__fieldColVisible = this.__fieldPrefix + \"_col_visible\" + id;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__processColumnObject = function(objColumn,index)\r\n\t{\r\n\t\tif(objColumn)\r\n\t\t{\r\n\t\t\tobjColumn[this.__fieldColIndex] = index;\r\n\t\t\tif(objColumn.hasOwnProperty(\"width\"))\r\n\t\t\t{\r\n\t\t\t\tvar widthUnit = this.util.getDimensionUnit(objColumn[\"width\"]);\r\n\t\t\t\tif(widthUnit === 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"width\"] = objColumn[\"width\"] + \"px\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(this.__columnSortable)\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"sortable\"] = this.util.isUndefinedOrNull(objColumn[\"sortable\"]) ? true : Boolean.parse(objColumn[\"sortable\"]);\r\n\t\t\t}\r\n\t\t\tobjColumn[\"sortDescending\"] = Boolean.parse(objColumn[\"sortDescending\"]);\r\n\t\t\tobjColumn[\"truncateToFit\"] = Boolean.parse(objColumn[\"truncateToFit\"]);\r\n\t\t\tobjColumn[\"headerTruncateToFit\"] = Boolean.parse(objColumn[\"headerTruncateToFit\"]);\r\n\t\t\tobjColumn[\"sortField\"] = objColumn[\"sortField\"] ? objColumn[\"sortField\"] :  objColumn[\"dataField\"];\r\n\t\t\tif(this.__columnResizable)\r\n\t\t\t{\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"resizable\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"resizable\"] = Boolean.parse(objColumn[\"resizable\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"resizable\"] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"resizable\"] = false;\r\n\t\t\t}\r\n\t\t\tif(this.__columnDraggable)\r\n\t\t\t{\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"draggable\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"draggable\"] = Boolean.parse(objColumn[\"draggable\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"draggable\"] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"draggable\"] = false;\r\n\t\t\t}\r\n\t\t\tif(this.__columnAutoSize && objColumn[\"resizable\"])\r\n\t\t\t{\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"autoSize\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"autoSize\"] = Boolean.parse(objColumn[\"autoSize\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"autoSize\"] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"autoSize\"] = false;\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"showMenu\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"showMenu\"] = Boolean.parse(objColumn[\"showMenu\"]);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"showMenu\"] = false;\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"minWidth\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"minWidth\"] = this.util.getDimensionAsNumber(null,objColumn[\"minWidth\"]);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"minWidth\"] = this.__columnMinWidth;\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"groupRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"groupRenderer\"] = this.util.getFunction(objColumn[\"groupRenderer\"]);\r\n\t\t\t}\r\n\t\t\t//itemRendrer property gets precedence over template\r\n\t\t\tif(objColumn.hasOwnProperty(\"itemRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"itemRenderer\"] = this.util.getFunction(objColumn[\"itemRenderer\"]);\r\n\t\t\t}\r\n\t\t\telse if(objColumn.hasOwnProperty(\"template\") && objColumn[\"template\"])\r\n\t\t\t{\r\n\t\t\t\t//setData should be before template for checking\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"setData\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"setData\"] = this.util.getFunction(objColumn[\"setData\"]);\r\n\t\t\t\t}\r\n\t\t\t\tobjColumn.templateRenderer = this.util.getTemplate(objColumn[\"template\"]);\r\n\t\t\t}\r\n\t\t\telse if(objColumn.hasOwnProperty(\"labelFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"labelFunction\"] = this.util.getFunction(objColumn[\"labelFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"headerRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"headerRenderer\"] = this.util.getFunction(objColumn[\"headerRenderer\"]);\r\n\t\t\t}\r\n\t\t\telse if(objColumn.hasOwnProperty(\"headerTemplate\") && objColumn[\"headerTemplate\"])\r\n\t\t\t{\r\n\t\t\t\tobjColumn.headerTemplate = this.util.getTemplate(objColumn[\"headerTemplate\"]);\r\n\t\t\t}\r\n\t\t\tif(!objColumn.hasOwnProperty(\"toolTipField\") && objColumn.hasOwnProperty(\"toolTipRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"toolTipRenderer\"] = this.util.getFunction(objColumn[\"toolTipRenderer\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"extraRowHeaderRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"extraRowHeaderRenderer\"] = this.util.getFunction(objColumn[\"extraRowHeaderRenderer\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"footerRenderer\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"footerRenderer\"] = this.util.getFunction(objColumn[\"footerRenderer\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"exportGetBodyTextFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"exportGetBodyTextFunction\"] = this.util.getFunction(objColumn[\"exportGetBodyTextFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"exportGetFooterTextFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"exportGetFooterTextFunction\"] = this.util.getFunction(objColumn[\"exportGetFooterTextFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"excelStyleHeaderFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"excelStyleHeaderFunction\"] = this.util.getFunction(objColumn[\"excelStyleHeaderFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"excelStyleBodyFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"excelStyleBodyFunction\"] = this.util.getFunction(objColumn[\"excelStyleBodyFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(objColumn.hasOwnProperty(\"excelStyleFooterFunction\"))\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"excelStyleFooterFunction\"] = this.util.getFunction(objColumn[\"excelStyleFooterFunction\"]);\r\n\t\t\t}\r\n\t\t\tif(this.__isResponsiveModeColumnToggle)\r\n\t\t\t{\r\n\t\t\t\tif(!objColumn.hasOwnProperty(\"priority\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn.priority = 6;\r\n\t\t\t\t}\r\n\t\t\t\tobjColumn.priority = parseInt(objColumn.priority);\r\n\t\t\t}\r\n\t\t\tvar isColumnFixed = this.__isColumnFixed(index);\r\n\t\t\tif(!isColumnFixed)\r\n\t\t\t{\r\n\t\t\t\tif(objColumn.hasOwnProperty(\"hideable\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"hideable\"] = Boolean.parse(objColumn[\"hideable\"]);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tobjColumn[\"hideable\"] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn[\"hideable\"] = false;\r\n\t\t\t}\r\n\t\t\tthis.__processIconsInColumn(objColumn);\r\n\t\t\tthis.__nsGridFilter.processColumnObject(objColumn);\r\n\t\t\tthis.__nsGridEditor.processColumnObject(objColumn);\r\n\t\t}\r\n\t\treturn objColumn;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__processPinnedColumn = function()\r\n\t{\r\n\t\tif(this.__orignalColumns && this.__orignalColumns.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < this.__leftFixedColumn;count++)\r\n\t\t\t{\r\n\t\t\t\tthis.__orignalColumns[count].pinned = \"left\";\r\n\t\t\t}\r\n\t\t\tfor(var count = this.__orignalColumns.length - 1,colCount = 0;count > -1 && colCount < this.__rightFixedColumn;count--,colCount++)\r\n\t\t\t{\r\n\t\t\t\tthis.__orignalColumns[count].pinned = \"right\";\r\n\t\t\t}\r\n\t\t\tvar arrLeft = [];\r\n\t\t\tvar arrCenter = [];\r\n\t\t\tvar arrRight = [];\r\n\t\t\tfor(var count = 0;count < this.__orignalColumns.length;count++)\r\n\t\t\t{\r\n\t\t\t\tif(this.__orignalColumns[count].pinned)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__orignalColumns[count].pinned == \"left\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrLeft.push(this.__orignalColumns[count]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(this.__orignalColumns[count].pinned == \"right\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrRight.push(this.__orignalColumns[count]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrCenter.push(this.__orignalColumns[count]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tarrCenter.push(this.__orignalColumns[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__orignalColumns = arrLeft.concat(arrCenter).concat(arrRight); \r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateFixedColCounts = function()\r\n\t{\r\n\t\tthis.__leftFixedColumn = 0;\r\n\t\tthis.__rightFixedColumn = 0;\r\n\t\tfor(var count = 0;count < this.__columns.length;count++)\r\n\t\t{\r\n\t\t\tif(this.__columns[count].pinned)\r\n\t\t\t{\r\n\t\t\t\tif(this.__columns[count].pinned == \"left\")\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__leftFixedColumn++;\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.__columns[count].pinned == \"right\")\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__rightFixedColumn++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__processIconsInColumn = function(objColumn)\r\n\t{\r\n\t\tif(objColumn)\r\n\t\t{\r\n\t\t\tvar itemIcons = objColumn[\"icons\"];\r\n\t\t\tvar icons = null;\r\n\t\t\tif(itemIcons)\r\n\t\t\t{\r\n\t\t\t\ticons = {};\r\n\t\t\t\ticons.menu = itemIcons[\"menu\"] || this.__icons[\"menu\"];\r\n\t\t\t\ticons.filter = itemIcons[\"filter\"] || this.__icons[\"filter\"];\r\n\t\t\t\ticons.sortAscending = itemIcons[\"sortAscending\"] || this.__icons[\"sortAscending\"];\r\n\t\t\t\ticons.sortDescending = itemIcons[\"sortDescending\"] || this.__icons[\"sortDescending\"];\r\n\t\t\t\ticons.columnMove = itemIcons[\"columnMove\"] || this.__icons[\"columnMove\"];\r\n\t\t\t}\r\n\t\t\telse if(this.__icons)\r\n\t\t\t{\r\n\t\t\t\ticons = this.util.cloneObject(this.__icons,true);\r\n\t\t\t\tdelete icons.exportButton;\r\n\t\t\t\tdelete icons.rowExpanded;\r\n\t\t\t\tdelete icons.rowCollapsed;\r\n\t\t\t}\r\n\t\t\tif(icons)\r\n\t\t\t{\r\n\t\t\t\tobjColumn.icons = icons;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isColumnExist = function(dataField)\r\n\t{\r\n\t\tif(dataField && this.__columns && this.__columns.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0; count < this.__columns.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar objColumn = this.__columns[count];\r\n\t\t\t\tif(objColumn[\"dataField\"] == dataField)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createStructure = function()\r\n\t{\r\n\t\tvar divOuterContainer = this.__createOuterContainer();\r\n\t\tvar divTitleBar = this.__createTitleBar(divOuterContainer);\r\n\t\tthis.__createTableStructure(divOuterContainer);\r\n\t\tif(divTitleBar && this.__title && this.__title.length > 0)\r\n\t\t{\r\n\t\t\tvar spanTitle = divTitleBar.firstChild;\r\n\t\t\tvar body = document.body || document.getElementsByTagName('body')[0];\r\n\t\t\tvar bodyPaddingLeft = this.util.getDimensionAsNumber(body,this.util.getStyleValue(body,\"padding-left\"));\r\n\t\t\tvar bodyPaddingTop = this.util.getDimensionAsNumber(body,this.util.getStyleValue(body,\"padding-top\"));\r\n\t\t\tvar bodyMarginLeft = this.util.getDimensionAsNumber(body,this.util.getStyleValue(body,\"margin-left\"));\r\n\t\t\tvar bodyMarginTop = this.util.getDimensionAsNumber(body,this.util.getStyleValue(body,\"margin-top\"));\r\n\t\t\tvar paddingLeft = this.util.getDimensionAsNumber(this.__baseComponent,this.util.getStyleValue(this.__baseComponent,\"padding-left\"));\r\n\t\t\tvar paddingTop = this.util.getDimensionAsNumber(this.__baseComponent,this.util.getStyleValue(this.__baseComponent,\"padding-top\"));\r\n\t\t\tvar marginLeft = this.util.getDimensionAsNumber(this.__baseComponent,this.util.getStyleValue(this.__baseComponent,\"margin-left\"));\r\n\t\t\tvar marginTop = this.util.getDimensionAsNumber(this.__baseComponent,this.util.getStyleValue(this.__baseComponent,\"margin-top\"));\r\n\t\t\tvar setting = {offsetX:(-1 * (bodyPaddingLeft + bodyMarginLeft + paddingLeft + marginLeft)),offsetY:(-1 * (bodyPaddingTop + bodyMarginTop + paddingTop + marginTop))};\r\n\t\t\tthis.util.addAnimatedLineOnHover(spanTitle,setting);\r\n\t\t}\r\n\t\tthis.__createCustomScroller();\r\n\t\tthis.__createScrollTip();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createOuterContainer = function()\r\n\t{\r\n\t\tif(this.__divOuterContainer)\r\n\t\t{\r\n\t\t\tthis.removeComponent();\r\n\t\t\tthis.__divOuterContainer = null;\r\n\t\t}\r\n\t\tthis.__divOuterContainer = this.util.createDiv(this.getID() + this.__OUTER_CONTAINER_ID,\"nsDataGridContainer\");\r\n\t\tthis.__applyTheme(this.__divOuterContainer,\"nsDataGridContainer\");\r\n\t\tthis.__applyCustomClass(this.__divOuterContainer,\"outerContainer\");\r\n\t\tthis.__setOuterContainerMeasurement();\r\n\t\tthis.addChild(this.__divOuterContainer);\r\n\t\treturn this.__divOuterContainer;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setOuterContainerMeasurement = function()\r\n\t{\r\n\t\tif(this.__divOuterContainer)\r\n\t\t{\r\n\t\t\tvar width = this.util.getStyleValue(this.__baseComponent,\"width\");\r\n\t\t\tvar height = this.util.getStyleValue(this.__baseComponent,\"height\");\r\n\t\t\tvar rectBase = this.__baseComponent.getBoundingClientRect();\r\n\t\t\tif(rectBase.width > 0)\r\n\t\t\t{\r\n\t\t\t\twidth = rectBase.width + \"px\";\r\n\t\t\t}\r\n\t\t\tif(rectBase.height > 0)\r\n\t\t\t{\r\n\t\t\t\theight = rectBase.height + \"px\";\r\n\t\t\t}\r\n\t\t\tthis.__divOuterContainer.style.width = width;\r\n\t\t\tthis.__divOuterContainer.style.height = height;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createTitleBar= function(parentElement)\r\n\t{\r\n\t\tif(parentElement && ((this.__title && this.__title.length > 0) || this.__enableExport || this.__enableColumnSetting))\r\n\t\t{\r\n\t\t\tvar divTitleBar = this.util.createDiv(this.getID() + this.__TITLE_CONTAINER_ID,this.__CLASS_TITLEBAR);\r\n\t\t\tthis.util.addStyleClass(divTitleBar,\"nsDataGridTitleBarTheme\");\r\n\t\t\tthis.__applyCustomClass(divTitleBar,\"titleBar\");\r\n\t\t\tif(this.__title && this.__title.length > 0)\r\n\t\t\t{\r\n\t\t\t\tvar spanTitle = document.createElement(\"span\");\r\n\t\t\t\tvar titleText = document.createTextNode(this.__title);\r\n\t\t\t\tspanTitle.appendChild(titleText);\r\n\t\t\t\tdivTitleBar.appendChild(spanTitle);\r\n\t\t\t}\r\n\t\t\tvar spanRight = document.createElement(\"span\");\r\n\t\t\tspanRight.style.float = \"right\";\r\n\t\t\tdivTitleBar.appendChild(spanRight);\r\n\t\t\tif(this.__enableColumnSetting)\r\n\t\t\t{\r\n\t\t\t\tvar spanExport = document.createElement(\"span\");\r\n\t\t\t\tspanExport.style.cursor = \"pointer\";\r\n\t\t\t\tif(this.__icons.columnSetting)\r\n\t\t\t\t{\r\n\t\t\t\t\tspanExport.innerHTML = this.__icons.columnSetting;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar objSVG = new NSSvg();\r\n\t\t\t\t\tvar exportID = new NSSvgShapes().__COLUMNSETTING_ICON_ID;\r\n\t\t\t\t\tvar svg = objSVG.addSVG(spanExport,exportID + \"exportsvg\",\"nsColumnSetting\");\r\n\t\t\t\t\tthis.util.addStyleClass(svg,\"nsColumnSettingTheme\");\r\n\t\t\t\t\tobjSVG.addUse(svg,exportID + \"use\",null,\"#\" + exportID);\r\n\t\t\t\t}\r\n\t\t\t\tspanRight.appendChild(spanExport);\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tthis.util.addEvent(spanExport,\"click\",function(event){\r\n\t\t\t\t\tself.__createColumnSettingUI.call(self,spanExport,event);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif(this.__enableExport)\r\n\t\t\t{\r\n\t\t\t\tvar spanExport = document.createElement(\"span\");\r\n\t\t\t\tspanExport.style.paddingLeft = \"5px\";\r\n\t\t\t\tspanExport.style.cursor = \"pointer\";\r\n\t\t\t\tif(this.__icons.exportButton)\r\n\t\t\t\t{\r\n\t\t\t\t\tspanExport.innerHTML = this.__icons.exportButton;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar objSVG = new NSSvg();\r\n\t\t\t\t\tvar exportID = new NSSvgShapes().__EXPORT_ICON_ID;\r\n\t\t\t\t\tvar svg = objSVG.addSVG(spanExport,exportID + \"exportsvg\",\"nsExportIcon\");\r\n\t\t\t\t\tthis.util.addStyleClass(svg,\"nsExportIconTheme\");\r\n\t\t\t\t\tobjSVG.addUse(svg,exportID + \"use\",null,\"#\" + exportID);\r\n\t\t\t\t}\r\n\t\t\t\tspanRight.appendChild(spanExport);\r\n\t\t\t\tif(!this.__exportMenu)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar exportMenuSetting = {parent:spanExport,dataSource:this.__exportMenuDataSource,isContextMenu:false,createRunTime:false,eventType:\"click\",defaultHandler:this.__exportHandler.bind(this),\r\n\t\t\t\t\t\t\tposition:this.util.POS_BOTTOMLEFT};\r\n\t\t\t\t\tthis.__exportMenu = new NSMenu(exportMenuSetting);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tparentElement.appendChild(divTitleBar);\r\n\t\t\treturn divTitleBar;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createColumnSettingUI = function(parentElement,event)\r\n\t{\r\n\t\tif(!this.__nsPopUpColumnSetting)\r\n\t\t{\r\n\t\t\tvar self = this;\r\n\t\t\tvar itemRenderer = function(item,labelField,fieldIndex,isDisabled,listItem)\r\n\t\t\t{\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divRenderer = self.util.createElement(\"span\",null,\"nsFilterListRenderer\");\r\n\t\t\t\t\tvar label = self.util.createElement(\"label\");\r\n\t\t\t\t\tvar checkBox = self.util.createElement(\"input\",null,\"nsFilterListRendererCheckBox\");\r\n\t\t\t\t\tcheckBox.setAttribute(\"type\",\"checkbox\");\r\n\t\t\t\t\tvar visible = item[this.__fieldColVisible];\r\n\t\t\t\t\tif(self.util.isUndefinedOrNull(visible))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvisible = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcheckBox.checked = visible;\r\n\t\t\t\t\tthis.util.addEvent(checkBox,\"click\",checkBoxClickHandler.bind(self,item));\r\n\t\t\t\t\tlabel.style.fontWeight = \"400\";\r\n\t\t\t\t\tlabel.style.cursor = \"pointer\";\r\n\t\t\t\t\tcheckBox.style.marginRight = \"5px\";\r\n\t\t\t\t\tlabel.appendChild(checkBox);\r\n\t\t\t\t\tlabel.appendChild(document.createTextNode(item[\"headerText\"] || item[\"dataField\"]));\r\n\t\t\t\t\tdivRenderer.appendChild(label);\r\n\t\t\t\t\treturn divRenderer;\r\n\t\t\t\t}\r\n\t\t\t\treturn null;\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tvar checkBoxClickHandler = function(item,event)\r\n\t\t\t{\r\n\t\t\t\tvar target = self.util.getTarget(event);\r\n\t\t\t\tvar checked = target.checked;\r\n\t\t\t\tvar index = this.__getColumnIndexByObject(item);\r\n\t\t\t\tvar counter = 0;\r\n\t\t\t\tfor(var count = 0;count < arrSource.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(self.util.isUndefinedOrNull(arrSource[count][this.__fieldColVisible]) || arrSource[count][this.__fieldColVisible])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcounter++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar strMsg = \"Atleast 1 Column should be selected in Column Configuration\";\r\n\t\t\t\tif(counter == 1 && !checked)\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget.checked = !checked;\r\n\t\t\t\t\tconsole.log(strMsg);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\titem[this.__fieldColVisible] = checked;\r\n\t\t\t\tthis.__setColumnVisibility(index,checked,item);\r\n\t\t\t\t//if(checked)\r\n\t\t\t\t//{\r\n\t\t\t\t\tself.__alignTables(true);\r\n\t\t\t\t\tself.__addStyleForFixedColumns();\r\n\t\t\t\t\t//self.__setFixedCellsPosition();\r\n\t\t\t\t//}\r\n\t\t\t};\r\n\t\t\tvar popUpSetting = {id:this.getID() + \"columnSettingContainer\",type:\"div\",width:275,position:this.util.POS_BOTTOMLEFT,closeOnOutsideClick:true,hideOrRemoveOnOutsideClick:\"hide\",closeRequired:true};\r\n\t\t\tthis.__nsPopUpColumnSetting = new this.util.nsPopUp(popUpSetting);\r\n\t\t\tthis.__nsPopUpColumnSetting.create();\r\n\t\t\tvar popUp = this.__nsPopUpColumnSetting.getPopUp();\r\n\t\t\tvar self = this;\r\n\t\t\tthis.util.addEvent(popUp,\"click\",function(event){\r\n\t\t\t\tevent = self.util.getEvent(event);\r\n\t\t\t\tevent.stopImmediatePropagation();\r\n\t\t\t});\r\n\t\t\tvar divList = this.util.createDiv();\r\n\t\t\tvar lstColumn = this.util.createElement(\"div\",null,\"nsFilterList\");\r\n\t\t\tlstColumn.style.height = \"300px\";\r\n\t\t\tdivList.appendChild(lstColumn);\r\n\t\t\tpopUp.appendChild(divList);\r\n\t\t\tvar arrSource = this.__getColumnSettingSource();\r\n\t\t\tvar setting = {labelField:\"label\",enableVirtualScroll:false,enableDragDrop:false,enableDragByHandle:false,enableMultipleSelection:true,enableKeyboardNavigation:false,\r\n\t\t\t\t\t   customScrollerRequired:false,enableMouseHover:true,enableMouseHoverAnimation:false,itemRenderer:itemRenderer.bind(this)};\r\n\t\t\tsetting[\"dataSource\"] = arrSource;\r\n\t\t\tvar objNSList = new NSList(lstColumn,setting);\r\n\t\t}\r\n\t\tthis.__nsPopUpColumnSetting.show();\r\n\t\tthis.__nsPopUpColumnSetting.placePopUp(event);\r\n\t\tevent.stopPropagation();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnSettingSource = function()\r\n\t{\r\n\t\tvar arrSource = [];\r\n\t\tfor(var count = 0;count < this.__columns.length;count++)\r\n\t\t{\r\n\t\t\tvar objColumn = this.__columns[count];\r\n\t\t\tif(objColumn[\"hideable\"])\r\n\t\t\t{\r\n\t\t\t\tarrSource.push(objColumn);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrSource;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createTableStructure= function(parentElement)\r\n\t{\r\n\t\tif(parentElement)\r\n\t\t{\r\n\t\t\tthis.__divTableWrapper = this.util.createDiv(this.getID() + \"TableWrapper\",\"nsTableWrapper\");\r\n\t\t\tparentElement.appendChild(this.__divTableWrapper);\r\n\t\t\tthis.__divTableHeaderContainerWrapper = this.util.createDiv(this.getID() + this.__TABLE_HEADER_CONTAINER_WRAPPER_ID,\"nsGridHeaderContainer\");\r\n\t\t\tthis.__divTableWrapper.appendChild(this.__divTableHeaderContainerWrapper);\r\n\t\t\tthis.__divTableBodyContainerWrapper = this.util.createDiv(this.getID() + this.__TABLE_BODY_CONTAINER_WRAPPER_ID,\"nsGridBodyContainer\");\r\n\t\t\tthis.__divTableWrapper.appendChild(this.__divTableBodyContainerWrapper);\r\n\t\t\tthis.__divTableFooterContainerWrapper = this.util.createDiv(this.getID() + this.__TABLE_FOOTER_CONTAINER_WRAPPER_ID,\"nsGridFooterContainer\");\r\n\t\t\tthis.__divTableWrapper.appendChild(this.__divTableFooterContainerWrapper);\r\n\t\t\tthis.__createHeader();\r\n\t\t\tthis.__createBody();\r\n\t\t\tthis.__createFooter();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createPaginationControl= function(parentElement)\r\n\t{\r\n\t\tif(parentElement)\r\n\t\t{\r\n\t\t\tif(this.__divPagination)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeAllChildren(this.__divPagination);\r\n\t\t\t\tthis.__divPagination.parentElement.removeChild(this.__divPagination);\r\n\t\t\t\tthis.__divPagination = null;\r\n\t\t\t}\r\n\t\t\tthis.__divPagination = this.util.createDiv(this.getID() + this.__PAGINATION_CONTROL_ID,\"nsGridPagination\");\r\n\t\t\tparentElement.appendChild(this.__divPagination);\r\n\t\t\tvar setting = {\r\n\t\t\t\t\tparent:this.__divPagination,\r\n\t\t\t\t\ttotalRecords : this.__totalRecords,\r\n\t\t\t\t\tpageSize : this.__pageSize,\r\n\t\t\t\t\t//containerStyle:\"pagination\",\r\n\t\t\t\t\t//activeStyle:\"active\",\r\n\t\t\t\t\t//disabledStyle:\"disabled\",\r\n\t\t\t\t\ttextFirst:\"Home\",\r\n\t\t\t\t\ttextLast:\"Last\",\r\n\t\t\t\t\ttextPrev:\"Prev\",\r\n\t\t\t\t\ttextNext:\"Next\",\r\n\t\t\t\t\tshowFirstLast:true\r\n\t\t\t};\r\n\t\t\tthis.__nsPagination = new NSPagination(setting);\r\n\t\t\tthis.__nsPagination.util.addEvent(this.__divPagination,this.__nsPagination.PAGE_CHANGE,this.__pageChangeHandler.bind(this));\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__pageChangeHandler= function(event)\r\n\t{\r\n\t\tif(!event)\r\n\t\t{\r\n\t\t\tevent = {oldIndex:0,newIndex:1,fromRecord:0,toRecord:this.__pageSize - 1};\r\n\t\t}\r\n\t\tconsole.log(\"OldPage::\" + event.oldIndex + \",NewPage::\" + event.newIndex);\r\n\t\tif(this.__paginationFetchRecordCallBack && this.__totalRecords > event.fromRecord)\r\n\t\t{\r\n\t\t\tthis.__paginationFetchRecordCallBack(event.fromRecord,event.toRecord,this.__pageSize);\r\n\t\t}\r\n\t};\r\n\t\r\n\t/******************************Header Creation *************************************/\r\n\tNSGrid.prototype.__createHeader = function()\r\n\t{\r\n\t\tthis.__divCenterTableHeaderContainer = this.__createHeaderContainer(this.__divTableHeaderContainerWrapper,this.__divCenterTableHeaderContainer,this.getID() + this.__TABLE_CENTER_HEADER_CONTAINER_ID,this.getID() + this.__TABLE_CENTER_HEADER_ID);\r\n\t\tthis.__tblCenterHeader = this.__divCenterTableHeaderContainer.firstChild;\r\n\t\tvar divHeaderCorner = this.util.createDiv(null,\"nsHeaderBarCorner\");\r\n\t\tthis.__divTableHeaderContainerWrapper.appendChild(divHeaderCorner);\r\n\t\tthis.__createHeaderRows();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderContainer= function(tableContainer,headerContainer,containerID,tableID)\r\n\t{\r\n\t\tif(headerContainer)\r\n\t\t{\r\n\t\t\theaderContainer.parentNode.removeChild(headerContainer);\r\n\t\t}\r\n\t\theaderContainer = this.__createTableAndParent(containerID,\"nsDataGridHeaderContainer\",tableID);\r\n\t\ttableContainer.appendChild(headerContainer);\r\n\t\treturn headerContainer;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderRows= function()\r\n\t{\r\n\t\tif(this.__tblCenterHeader && this.__columns && this.__columns.length > 0)\r\n\t\t{\r\n\t\t\tvar header = this.__tblCenterHeader.createTHead();\r\n\t\t\tvar headerRow = header.insertRow(-1);\r\n\t\t    headerRow.style.height = \"auto\";\r\n\t\t    this.__tblCenterHeaderBody = document.createElement(\"tbody\");\r\n\t\t\tthis.__tblCenterHeader.appendChild(this.__tblCenterHeaderBody);\r\n\t\t    var bodyRow = this.__tblCenterHeaderBody.insertRow(-1);\r\n\t\t    this.util.addStyleClass(bodyRow,\"nsGridHeaderRow\");\r\n\t\t\tthis.__applyCustomClass(bodyRow,\"headerRow\");\r\n\t\t    var rendererRow = this.__tblCenterHeaderBody.insertRow(-1);\r\n\t\t    this.util.addStyleClass(rendererRow,\"nsGridFilterRow\");\r\n\t\t\tthis.__applyCustomClass(rendererRow,\"filterRow\");\r\n\t\t    for (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar colItem = this.__columns[colIndex];\r\n\t\t    \tthis.__createHeaderColGroup(colItem);\r\n\t\t        this.__createHeaderHeaderCell(colItem,headerRow);\r\n\t\t        this.__createHeaderBodyCell(colItem,bodyRow,rendererRow,colIndex);\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderExtraRows = function()\r\n\t{\r\n\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\tif(this.__headerExtraRowCount > 0 && headerBodyRow)\r\n\t\t{\r\n\t\t\tvar arrExtraRow = this.__getHeaderExtraRow(this.__tblCenterHeader);\r\n\t\t\tif(arrExtraRow && arrExtraRow.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor (var rowIndex = arrExtraRow.length - 1; rowIndex > -1; rowIndex--)\r\n\t\t\t    {\r\n\t\t\t\t\tthis.__tblCenterHeader.deleteRow(arrExtraRow[rowIndex].rowIndex);\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\tfor (var rowIndex = 0; rowIndex < this.__headerExtraRowCount; rowIndex++)\r\n\t\t    {\r\n\t\t\t\tvar extraRow = this.__tblCenterHeaderBody.insertRow(-1);\r\n\t\t\t\tthis.util.addStyleClass(extraRow,\"nsHeaderExtraRow\");\r\n\t\t\t\tthis.__applyCustomClass(extraRow,\"extraHeaderRow\");\r\n\t\t\t\tthis.__applyCustomClass(extraRow,\"extraHeaderRow\" + rowIndex);\r\n\t\t\t\tfor (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t\t    {\r\n\t\t\t\t\tthis.__createHeaderExtraCell(this.__columns[colIndex],extraRow,rowIndex,colIndex);\r\n\t\t\t    }\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderColGroup = function(colItem)\r\n\t{\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tvar colgroup = document.createElement(\"colgroup\");\r\n\t\t\tcolgroup.setAttribute(\"id\",this.getID() + \"HeaderColGroup\" + colItem.dataField);\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroup\");\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroupHeader\");\r\n\t\t\tthis.__tblCenterHeader.appendChild(colgroup);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderHeaderCell = function(colItem,headerRow)\r\n\t{\r\n\t\tif(colItem && headerRow)\r\n\t\t{\r\n\t\t\tvar headerCell = headerRow.insertCell(-1);\r\n\t\t\tthis.util.addStyleClass(headerCell,\"nsGridCell\");\r\n\t\t\theaderCell.style.padding = \"0px\"; \r\n\t\t\theaderCell.style.width = colItem[\"width\"]; \r\n\t\t\tthis.__addPriorityClassInCell(headerCell,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderExtraCell = function(colItem,extraHeaderRow,rowIndex,colIndex)\r\n\t{\r\n\t\tif(colItem && extraHeaderRow)\r\n\t\t{\r\n\t\t\tvar extraHeaderCell = extraHeaderRow.insertCell(-1);\r\n\t\t\tvar colID = this.getID() + \"colExtra\" + colItem[\"dataField\"] + rowIndex + colIndex;\r\n\t\t\textraHeaderCell.setAttribute(\"id\",colID);\r\n\t\t\tthis.util.addStyleClass(extraHeaderCell,\"nsGridCell\");\r\n\t\t\tthis.util.addStyleClass(extraHeaderCell,\"nsDataGridHeaderRenderer\");\r\n\t\t\tthis.util.addStyleClass(extraHeaderCell,\"nsDataGridHeaderRendererTheme\");\r\n\t\t\tthis.__addStyleForFixedCell(extraHeaderCell,colIndex);\r\n\t\t\t//this.__nsGridFilter.addFilterRenderer(rendererRow,rendererCell,colItem,index,colID);\r\n\t\t\tthis.__addPriorityClassInCell(extraHeaderCell,colItem);\r\n\t\t\tvar divHeaderRendererContainer = this.util.createDiv(null); \r\n\t\t\textraHeaderCell.appendChild(divHeaderRendererContainer);\r\n\t\t\tvar itemRenderer = colItem[\"extraRowHeaderRenderer\"];\r\n\t\t\tif(itemRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar objRenderer = itemRenderer(colItem[\"dataField\"],colItem,this.__arrFilteredGroupedSource,rowIndex,colIndex,extraHeaderCell,extraHeaderRow);\r\n\t\t\t\tvar callback = function(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar compSpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\tcompSpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(compSpan);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdivHeaderRendererContainer.appendChild(objRenderer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(objRenderer,callback.bind(this));\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createHeaderBodyCell = function(colItem,bodyRow,rendererRow,index)\r\n\t{\r\n\t\tif(colItem && bodyRow && rendererRow)\r\n\t\t{\r\n\t\t\tvar bodyCell = bodyRow.insertCell(-1);\r\n\t\t\tvar colID = this.getID() + \"ColHeader\" + colItem[\"dataField\"];\r\n\t\t\tbodyCell.setAttribute(\"id\",colID);\r\n\t\t\tthis.util.addStyleClass(bodyCell , \"nsGridCell\");\r\n\t\t\tthis.util.addStyleClass(bodyCell , this.__CLASS_TABLE_HEADER_CELL);\r\n\t\t\tthis.util.addStyleClass(bodyCell , \"nsDataGridHeaderTheme\");\r\n\t\t\tthis.__addStyleForFixedCell(bodyCell,index);\r\n\t\t\tthis.__applyCustomClass(bodyCell,\"headerCell\");\r\n\t\t\tbodyCell.setAttribute(\"orignalColumnIndex\",index);\r\n\t\t    bodyCell.setAttribute(\"currentColumnIndex\",index);\r\n\t\t    \r\n\t        this.util.addEvent(bodyCell,\"click\",this.__headerClickHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mouseover\",this.__headerMouseOverHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mouseout\",this.__headerMouseOutHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mousedown\",this.__headerMouseDownHandler.bind(this));\r\n\t        \r\n\t        var divCell = this.util.createDiv(colID + \"container\",\"nsDataGridHeaderCellContainer\"); \r\n\t        bodyCell.appendChild(divCell);\r\n\t        if(colItem[\"draggable\"])\r\n\t\t\t{\r\n\t        \tvar objSVG = new NSSvg();\r\n\t\t\t\tthis.util.addStyleClass(bodyCell , this.__CLASS_TABLE_HEADER_DROPPABLE_CELL);\r\n\t\t\t\tvar divMove = this.util.createDiv(colID + \"move\",\"nsHeaderMove\");\r\n\t\t\t\tif(this.__getColumnCustomIcon(colItem,\"columnMove\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tdivMove.innerHTML = this.__getColumnCustomIcon(colItem,\"columnMove\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar iconID = new NSSvgShapes().__MOVE_ICON_ID;\r\n\t\t\t\t\tvar svg = objSVG.addSVG(divMove,divMove.id + iconID + \"svg\",\"nsMoveIcon\",null,null,null,null,null,null,false);\r\n\t\t\t\t\tobjSVG.addUse(svg,divMove.id + \"use\",null,\"#\" + iconID);\r\n\t\t\t\t}\r\n\t\t\t\tdivCell.appendChild(divMove);\r\n\t\t\t}\r\n\t\t\tvar divText = this.util.createDiv(colID + \"text\");\r\n\t\t\tdivCell.appendChild(divText);\r\n\t\t\tthis.__addHeaderRenderer(divText,colItem,index);\r\n\t\t\tif(colItem.hasOwnProperty(\"sortable\") && colItem[\"sortable\"])\r\n\t\t\t{\r\n\t\t\t\tvar divSorting = this.util.createDiv(colID + \"SortContainer\",\"nsGridSortContainer\");\r\n\t\t\t\tdivCell.appendChild(divSorting);\r\n\t\t\t\tif(!this.__isSortingIconCustom(colItem))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divSortAsc = this.util.createDiv(colID + \"SortAsc\",\"nsSortAsc\"); \r\n\t\t\t\t\tdivSorting.appendChild(divSortAsc);\r\n\t\t\t\t\tvar divSortSpacer = this.util.createDiv(colID + \"SortSpacer\",\"nsSortSpacer\"); \r\n\t\t\t\t\tdivSorting.appendChild(divSortSpacer);\r\n\t\t\t\t\tvar divSortDesc = this.util.createDiv(colID + \"SortDesc\",\"nsSortDesc\"); \r\n\t\t\t\t\tdivSorting.appendChild(divSortDesc);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(colItem[\"showMenu\"])\r\n\t\t\t{\r\n\t\t\t\tvar objSVG = new NSSvg();\r\n\t\t\t\tvar arrMenu = this.__getHeaderMenuDataProvider(bodyCell);\r\n\t\t\t\tif(arrMenu && arrMenu.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar divMenuContainer = this.util.createDiv(colID + \"MenuContainer\");\r\n\t\t\t\t\tif(this.__getColumnCustomIcon(colItem,\"menu\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdivMenuContainer.innerHTML = this.__getColumnCustomIcon(colItem,\"menu\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar svg = objSVG.addSVG(divMenuContainer,colID + \"menusvg\",\"nsMenuArrowSVG\",null,null,null,null,null,null,true);\r\n\t\t\t\t\t\tobjSVG.addUse(svg,colID + \"use\",\"nsMenuUse\",\"#svgCircleDownArrow\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdivCell.appendChild(divMenuContainer);\r\n\t\t\t\t\tvar menuSetting = {parent:divMenuContainer,isContextMenu:false,createRunTime:false,dataSource:arrMenu,targetType:\"TD\"\r\n\t\t\t\t\t\t\t\t\t,defaultHandler:this.__headerMenuHandler.bind(this),eventHandler:this.__headerMenuClickHandler.bind(this)\r\n\t\t\t\t\t\t\t\t\t,position:this.util.POS_BOTTOMRIGHT};\r\n\t\t\t\t\t//place the menu for 2nd last and last column to bottom right\r\n\t\t\t\t\tif(index === this.__columns.length - 1 || index === this.__columns.length - 2)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmenuSetting.position = this.util.POS_BOTTOMLEFT;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar headerMenu = new NSMenu(menuSetting);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__nsGridColumnResize.addResizeIndicator(bodyRow,bodyCell,divCell,colItem,colID);\r\n\t\t\tvar rendererCell = rendererRow.insertCell(-1);\r\n\t\t\tthis.util.addStyleClass(rendererCell,\"nsGridCell\");\r\n\t\t\tthis.util.addStyleClass(rendererCell,\"nsDataGridHeaderRenderer\");\r\n\t\t\tthis.util.addStyleClass(rendererCell,\"nsDataGridHeaderRendererTheme\");\r\n\t\t\tthis.__addStyleForFixedCell(rendererCell,index);\r\n\t\t\tthis.__applyCustomClass(rendererCell,\"filterCell\");\r\n\t\t\tthis.__nsGridFilter.addFilterRenderer(rendererRow,rendererCell,colItem,index,colID);\r\n\t\t\tthis.__addPriorityClassInCell(bodyCell,colItem);\r\n\t\t\tthis.__addPriorityClassInCell(rendererCell,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addHeaderRenderer = function(div,colItem,colIndex)\r\n\t{\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tvar templateRenderer = colItem[\"headerTemplate\"];\r\n\t\t\tvar itemRenderer = colItem[\"headerRenderer\"];\r\n\t\t\tif(itemRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar objRenderer = itemRenderer(colItem,colIndex);\r\n\t\t\t\tvar callback = function(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar compSpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\tcompSpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\tdiv.appendChild(compSpan);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdiv.appendChild(objRenderer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(objRenderer,callback.bind(this));\r\n\t\t\t}\r\n\t\t\telse if(templateRenderer)\r\n\t\t\t{\r\n\t\t\t\tdiv.appendChild(templateRenderer.cloneNode(true));\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(div,\"nsHeaderText\");\r\n\t\t\t\tthis.util.addStyleClass(div,\"nsHeaderTextTheme\");\r\n\t\t\t\tvar headerText = \" \";\r\n\t\t\t\tif(colItem.hasOwnProperty(\"headerText\") && colItem[\"headerText\"])\r\n\t\t        {\r\n\t\t        \theaderText = colItem[\"headerText\"];\r\n\t\t        }\r\n\t\t\t\tvar headerTextNode = document.createTextNode(headerText);\r\n\t\t\t\tdiv.appendChild(headerTextNode);\r\n\t\t\t}\r\n\t\t\tif(colItem[\"headerTruncateToFit\"])\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(div,\"nsTruncateToFit\");\r\n\t\t\t\tif(this.__enableToolTipForTruncateText)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsToolTipInElement.addToolTip(div,div.textContent);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tdiv.setAttribute(\"title\",div.textContent);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setHeaderSortFunction = function()\r\n\t{\r\n\t\tif(this.__arrWrapper && this.__arrWrapper.length > 0)\r\n\t    {\r\n\t\t\tif(this.__columns && this.__columns.length > 0)\r\n\t\t\t{\r\n\t\t\t\tvar dataSource = this.__getAllItems();\r\n\t\t        for(var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t        {\r\n\t\t        \tvar colItem = this.__columns[colIndex];\r\n\t\t        \tthis.__setHeaderSortFunctionForItem(colItem,dataSource);\r\n\t\t        }\r\n\t\t\t}\r\n\t    } \r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setHeaderSortFunctionForItem = function(colItem,dataSource)\r\n\t{\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tif(colItem.hasOwnProperty(\"sortField\") && colItem[\"sortField\"] && colItem.hasOwnProperty(\"sortable\") && colItem[\"sortable\"] === true)\r\n\t    \t{\r\n\t\t\t\t//In case of addColumn() dataSource will be null \r\n\t\t\t\tif(!dataSource)\r\n\t\t\t\t{\r\n\t\t\t\t\tdataSource = this.__getAllItems();\r\n\t\t\t\t}\r\n\t    \t\tvar item = null;\r\n\t    \t\tfor(var count = 0; count < dataSource.length; count++)\r\n\t            {\r\n\t                 item = dataSource[count][colItem[\"sortField\"]];\r\n\t                 if(!this.util.isUndefined(item) && item != null && item != \"\")\r\n\t                 {\r\n\t                \t break;\r\n\t                 }\r\n\t            }\r\n\t    \t\tif(!this.util.isUndefined(item) && item != null && item != \"\")\r\n\t            {\r\n\t            \tcolItem.sortFunction = this.__nsGridSort.determineSortFunction(item,colItem);\r\n\t            }\r\n\t            else\r\n\t            {\r\n\t            \tcolItem.sortFunction = \"__sortCaseInsensitive\";\r\n\t            }\r\n\t    \t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__removeHeaderCell = function(colIndex)\r\n\t{\r\n\t\tif(colIndex > -1 && colIndex < this.__columns.length)\r\n\t\t{\r\n\t\t\tvar headerRow = this.__getHeaderHeaderRow(this.__tblCenterHeader);\r\n\t\t\tif(headerRow)\r\n\t\t\t{\r\n\t\t\t\theaderRow.deleteCell(colIndex);\r\n\t\t\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\t\t\tvar rendererRow = this.__getHeaderFilterRow(this.__tblCenterHeader);\r\n\t\t\t\theaderBodyRow ? headerBodyRow.deleteCell(colIndex) : null;\r\n\t\t\t\trendererRow ? rendererRow.deleteCell(colIndex) : null;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__swapOrMoveHeaderCell = function(functionality,sourceIndex,destinationIndex)\r\n\t{\r\n\t\tif(this.__isColumnIndexValid(sourceIndex) && this.__isColumnIndexValid(destinationIndex))\r\n\t\t{\r\n\t\t\tvar headerRow = this.__getHeaderHeaderRow(this.__tblCenterHeader);\r\n\t\t\tif(headerRow)\r\n\t\t\t{\r\n\t\t\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterHeader);\r\n\t    \t\tif(arrRows && arrRows.length > 0)\r\n\t    \t\t{\r\n\t\t\t\t\tvar arrHeaderCells = headerRow.cells;\r\n\t\t\t\t\tthis.__swapCell(arrHeaderCells[sourceIndex],arrHeaderCells[destinationIndex]);\r\n\t\t\t\t\tfor (var rowIndex = 0; rowIndex < arrRows.length; rowIndex++)\r\n\t\t\t\t    {\r\n\t\t\t\t\t\tvar arrCells = arrRows[rowIndex].cells;\r\n\t\t\t\t\t\tif(rowIndex === 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tarrCells[sourceIndex].setAttribute(\"currentColumnIndex\",destinationIndex);\r\n\t\t\t\t\t\t\tarrCells[destinationIndex].setAttribute(\"currentColumnIndex\",sourceIndex);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(functionality === \"swap\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__swapCell(arrCells[sourceIndex],arrCells[destinationIndex]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__moveCell(arrCells[sourceIndex],destinationIndex);\r\n\t\t\t\t\t\t\tif(rowIndex === 0)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar smallIndex = Math.min(sourceIndex,destinationIndex);\r\n\t\t\t\t\t\t\t\tfor(var count = smallIndex;count < arrCells.length;count++)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tarrCells[count].setAttribute(\"currentColumnIndex\",count);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t    }\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__removeHeader = function()\r\n\t{\r\n\t\tif(this.__tblCenterHeader && this.__tblCenterHeader.tHead)\r\n\t\t{\r\n\t\t\tthis.__tblCenterHeader.deleteTHead();\r\n\t\t}\r\n\t\tif(this.__tblCenterHeader.tBodies && this.__tblCenterHeader.tBodies.length > 0)\r\n\t    {\r\n\t    \tthis.__tblCenterHeader.removeChild(this.__tblCenterHeader.tBodies[0]);\r\n\t    }\r\n\t};\r\n\t/******************************End of Header Creation *************************************/\r\n\t/******************************Footer Creation **********************************************/\r\n\tNSGrid.prototype.__createFooter = function()\r\n\t{\r\n\t\tif(this.__enableFooter)\r\n\t\t{\r\n\t\t\tthis.__divCenterTableFooterContainer = this.__createFooterContainer(this.__divTableFooterContainerWrapper,this.__divCenterTableFooterContainer,this.getID() + this.__TABLE_CENTER_FOOTER_CONTAINER_ID,this.getID() + this.__TABLE_CENTER_FOOTER_ID);\r\n\t\t\tthis.__tblCenterFooter = this.__divCenterTableFooterContainer.firstChild;\r\n\t\t\tvar divFooterCorner = this.util.createDiv(null,\"nsFooterBarCorner\");\r\n\t\t\tthis.__divCenterTableFooterContainer.appendChild(divFooterCorner);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFooterContainer= function(tableContainer,footerContainer,containerID,tableID)\r\n\t{\r\n\t\tif(footerContainer)\r\n\t\t{\r\n\t\t\tfooterContainer.parentNode.removeChild(footerContainer);\r\n\t\t}\r\n\t\tfooterContainer = this.__createTableAndParent(containerID,\"nsDataGridFooterContainer\",tableID);\r\n\t\ttableContainer.appendChild(footerContainer);\r\n\t\treturn footerContainer;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFooterRows = function()\r\n\t{\r\n\t\tif(this.__enableFooter && this.__tblCenterFooter && this.__columns && this.__columns.length > 0)\r\n\t\t{\r\n\t\t\tthis.util.removeAllChildren(this.__tblCenterFooter);\r\n\t\t\tvar footer = this.__tblCenterFooter.createTHead();\r\n\t\t\tvar footerRow = footer.insertRow(-1);\r\n\t\t    footerRow.style.height = \"auto\";\r\n\t\t    this.__tblCenterFooterBody = document.createElement(\"tbody\");\r\n\t\t\tthis.__tblCenterFooter.appendChild(this.__tblCenterFooterBody);\r\n\t\t    var bodyRow = this.__tblCenterFooterBody.insertRow(-1);\r\n\t\t    this.util.addStyleClass(bodyRow,\"nsGridFooterRow\");\r\n\t\t\tthis.__applyCustomClass(bodyRow,\"footerRow\");\r\n\t\t    for (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar colItem = this.__columns[colIndex];\r\n\t\t    \tthis.__createFooterColGroup(colItem);\r\n\t\t        this.__createFooterHeaderCell(colItem,footerRow);\r\n\t\t        this.__createFooterBodyCell(colItem,bodyRow,0,colIndex);\r\n\t\t    }\r\n\t\t    this.__createFixedFooterRow(footerRow);\r\n\t\t    var arrRows = this.__tblCenterFooterBody.rows;\r\n\t\t    for (var rowIndex = 0; rowIndex < arrRows.length; rowIndex++)\r\n\t\t    {\r\n\t\t    \t this.__createFixedFooterRow(arrRows[rowIndex]);\r\n\t\t    }\r\n\t\t    if(this.__enableCustomScrollBar && this.__scroller)\r\n\t\t\t{\r\n\t\t    \tthis.__divTableFooterContainerWrapper.style.height = null;\r\n\t\t\t\tthis.__divTableFooterContainerWrapper.style.height = (2 * this.__divTableFooterContainerWrapper.offsetHeight) + \"px\";\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFooterColGroup = function(colItem)\r\n\t{\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tvar colgroup = document.createElement(\"colgroup\");\r\n\t\t\tcolgroup.setAttribute(\"id\",this.getID() + \"FooterColGroup\" + colItem.dataField);\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroup\");\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroupFooter\");\r\n\t\t\tthis.__tblCenterFooter.appendChild(colgroup);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFooterHeaderCell = function(colItem,headerRow)\r\n\t{\r\n\t\tif(colItem && headerRow)\r\n\t\t{\r\n\t\t\tvar footerCell = headerRow.insertCell(-1);\r\n\t\t\tthis.util.addStyleClass(footerCell,\"nsGridCell\");\r\n\t\t\tfooterCell.style.padding = \"0px\"; \r\n\t\t\tfooterCell.style.width = colItem[\"width\"]; \r\n\t\t\tthis.__addPriorityClassInCell(footerCell,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFooterBodyCell = function(colItem,bodyRow,rowIndex,colIndex)\r\n\t{\r\n\t\tif(colItem && bodyRow)\r\n\t\t{\r\n\t\t\tvar bodyCell = bodyRow.insertCell(-1);\r\n\t\t\tvar colID = this.getID() + \"ColFooter\" + colItem[\"dataField\"];\r\n\t\t\tbodyCell.setAttribute(\"id\",colID);\r\n\t\t\tthis.util.addStyleClass(bodyCell , \"nsGridCell\");\r\n\t\t\tthis.util.addStyleClass(bodyCell , \"nsDataGridFooter\");\r\n\t\t\tthis.util.addStyleClass(bodyCell , \"nsDataGridFooterTheme\");\r\n\t\t\tthis.__addStyleForFixedCell(bodyCell,colIndex);\r\n\t\t\tthis.__applyCustomClass(bodyCell,\"footerCell\");\r\n\t\t\tbodyCell.setAttribute(\"orignalColumnIndex\",colIndex);\r\n\t\t    bodyCell.setAttribute(\"currentColumnIndex\",colIndex);\r\n\t\t    \r\n\t        /*this.util.addEvent(bodyCell,\"click\",this.__headerClickHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mouseover\",this.__headerMouseOverHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mouseout\",this.__headerMouseOutHandler.bind(this));\r\n\t        this.util.addEvent(bodyCell,\"mousedown\",this.__headerMouseDownHandler.bind(this));*/\r\n\t        \r\n\t        var divCell = this.util.createDiv(colID + \"container\",\"nsDataGridFooterCellContainer\"); \r\n\t        bodyCell.appendChild(divCell);\r\n\t\t\tvar divText = this.util.createDiv(colID + \"text\");\r\n\t\t\tdivCell.appendChild(divText);\r\n\t\t\tvar itemRenderer = colItem[\"footerRenderer\"];\r\n\t\t\tif(itemRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar objRenderer = itemRenderer(colItem[\"dataField\"],colItem,this.__arrFilteredGroupedSource,rowIndex,colIndex,bodyCell,bodyRow);\r\n\t\t\t\tvar callback = function(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar compSpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\tcompSpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\tdivText.appendChild(compSpan);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdivText.appendChild(objRenderer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(objRenderer,callback.bind(this));\r\n\t\t\t}\r\n\t\t\tthis.__addPriorityClassInCell(bodyCell,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__removeFooterColumn= function(colIndex)\r\n\t{\r\n\t\tif(colIndex > -1 && colIndex < this.__columns.length)\r\n\t\t{\r\n\t\t\tvar bodyRow = this.__getBodyHeaderRow(this.__tblCenterFooter);\r\n\t\t\tif(bodyRow)\r\n\t\t    {\r\n\t\t\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterFooter);\r\n\t\t    \tif(arrRows && arrRows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tbodyRow.deleteCell(colIndex);\r\n\t\t    \t\tvar row = null;\r\n\t\t    \t\tfor (var rowCount = 0; rowCount < arrRows.length; rowCount++) \r\n\t\t    \t\t{\r\n\t\t    \t\t\trow = arrRows[rowCount];\r\n\t\t    \t\t\trow.deleteCell(colIndex);\r\n\t\t    \t    }\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__swapOrMoveFooterCell = function(functionality,sourceIndex,destinationIndex)\r\n\t{\r\n\t\tif(this.__isColumnIndexValid(sourceIndex) && this.__isColumnIndexValid(destinationIndex))\r\n\t\t{\r\n\t\t\tvar bodyRow = this.__getBodyHeaderRow(this.__tblCenterFooter);\r\n\t\t\tif(bodyRow)\r\n\t\t\t{\r\n\t\t\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterFooter);\r\n\t\t\t\tif(arrRows && arrRows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrHeaderCells = bodyRow.cells;\r\n\t\t\t\t\tif(functionality === \"swap\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__swapCell(arrHeaderCells[sourceIndex],arrHeaderCells[destinationIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__moveCell(arrHeaderCells[sourceIndex],destinationIndex);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar row = null;\r\n\t\t    \t\tvar arrBodyCells = [];\r\n\t\t    \t\tfor (var rowCount = 0; rowCount < arrRows.length; rowCount++) \r\n\t\t    \t\t{\r\n\t\t    \t\t\trow = arrRows[rowCount];\r\n\t\t    \t\t\tarrBodyCells = row.cells;\r\n\t\t    \t\t\tif(functionality === \"swap\")\r\n\t\t\t\t\t\t{\r\n\t\t    \t\t\t\tthis.__swapCell(arrBodyCells[sourceIndex],arrBodyCells[destinationIndex]);\r\n\t\t\t\t\t\t}\r\n\t\t    \t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__moveCell(arrBodyCells[sourceIndex],destinationIndex);\r\n\t\t\t\t\t\t}\r\n\t\t    \t    }\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\t/******************************End of Footer Creation *************************************/\r\n\t/******************************Body Creation **********************************************/\r\n\tNSGrid.prototype.__createBody = function()\r\n\t{\t\r\n\t\tthis.__divCenterTableBodyContainer = this.__createTableAndParent(this.getID() + this.__TABLE_CENTER_BODY_CONTAINER_ID,this.__CLASS_BODY_CONTAINER,this.getID() + this.__TABLE_CENTER_BODY_ID);\r\n\t\tif(this.__enableFooter)\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(this.__divCenterTableBodyContainer,\"nsDataGridBodyContainerWithFooter\");\r\n\t\t}\r\n\t\tthis.__divTableBodyContainerWrapper.appendChild(this.__divCenterTableBodyContainer);\r\n\t\tthis.__tblCenterBody = this.__divCenterTableBodyContainer.firstChild;\r\n\t\tvar header = this.__tblCenterBody.createTHead();\r\n\t    this.__tblCenterBodyBody =  document.createElement(\"tbody\");\r\n\t\tthis.__tblCenterBody.appendChild(this.__tblCenterBodyBody);\r\n\t\tif(!this.__enableVirtualScroll && this.__enablePagination && this.__isPaginationTypeScroll)\r\n\t\t{\r\n\t\t\tthis.__bodyScrollRef = this.__bodyScrollHandler.bind(this);\r\n\t\t\tthis.util.addEvent(this.__getVerticalScrollableContainer(),\"scroll\",this.__bodyScrollRef);\r\n\t\t}\r\n\t\tthis.__objGrid.__createBody();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__renderBody = function(fromSort,fromFilter)\r\n\t{\r\n\t\tvar isReset = fromSort || fromFilter;\r\n\t\tvar self = this;\r\n\t\tif(this.__processArrayAsync)\r\n\t    {\r\n\t\t\tthis.__processArrayAsync.stop();\r\n\t    }\r\n\t\tvar resetTable = function(tblData)\r\n\t\t{\r\n\t\t\tif(tblData)\r\n\t\t\t{\r\n\t\t\t\ttblData.deleteTHead();\r\n\t\t\t    if(tblData.tBodies && tblData.tBodies.length > 0)\r\n\t\t\t    {\r\n\t\t\t    \ttblData.removeChild(tblData.tBodies[0]);\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t\tself.__navigationIndex = -1;\r\n\t\t};\r\n\t\tvar createBody = function()\r\n\t\t{\r\n\t\t\treturn document.createElement(\"tbody\");\r\n\t\t};\r\n\t\tvar addBodyInTable = function(tblData,tblBody)\r\n\t\t{\r\n\t\t\tif(tblData && tblBody)\r\n\t\t\t{\r\n\t\t\t\ttblData.appendChild(tblBody);\r\n\t\t\t}\r\n\t\t};\r\n\t\t//for some reason the body is to be destroyed so that row we store in items is not stale\r\n\t\t// need to fix this\r\n\t\tif(!this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tresetTable(this.__tblCenterBody);\r\n\t\t\tthis.__tblCenterBodyBody = createBody();\r\n\t\t\tif(this.__divCenterTableBodyContainer)\r\n\t\t\t{\r\n\t\t\t\tthis.__divCenterTableBodyContainer.scrollTop = 0;\r\n\t\t\t}\r\n\t\t    this.__lastScrollPos = [0,0];\r\n\t\t}\r\n\t\tif(this.__enableContextMenu)\r\n\t\t{\r\n\t\t\tthis.__initializeContextMenu();\r\n\t\t}\r\n\t\tthis.__createBodyHeader();\r\n\t\tthis.__createHeaderExtraRows();\r\n\t\tthis.__createFixedHeaderRows();\r\n\t\tthis.__createFooterRows();\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t\t}\r\n\t\telse if(this.__enablePagination && this.__isPaginationTypeScroll)\r\n\t\t{\r\n\t\t\taddBodyInTable(this.__tblCenterBody,this.__tblCenterBodyBody);\r\n\t\t\tvar source = this.__arrInternalSource.slice(0);\r\n\t\t\tvar resetInternalSource = false;\r\n\t\t\tif(this.__isPaginationModeAuto || this.__rowsRendered)\r\n\t\t\t{\r\n\t\t\t\tthis.__arrInternalSource = source.slice(0,this.__INFINITE_SCROLL_INITIAL_LOAD);\r\n\t\t\t\tresetInternalSource = true;\r\n\t\t\t}\r\n\t\t\tthis.__createBodyBody(this.__arrInternalSource,0,this.__arrInternalSource.length);\r\n\t\t\tif(resetInternalSource) {\r\n\t\t\t\tthis.__arrInternalSource = source.slice(0);\r\n\t\t\t}\r\n\t\t\tif((this.__isPaginationModeAuto || this.__rowsRendered) && this.__enableAsyncLoadPagination && this.__totalRecords > this.__getTotalRows()) \r\n\t\t\t{\r\n\t\t\t\tthis.__arrInternalSource = source.slice(0);//this.__objGrid.__setSourceForAsync();\r\n\t\t\t\tthis.__processArrayAsync = new this.util.processArrayAsync(this.__arrInternalSource,this.__createRowAsync,20,this.__asyncSourceCompleteHandler,this);\r\n\t\t\t\tthis.__processArrayAsync.start(this.__getTotalRows());\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(this.__enablePagination && !this.__isPaginationTypeScroll && this.__isPaginationModeAuto)\r\n\t\t{\r\n\t\t\tthis.__createBodyBody(this.__arrInternalSource,0,this.__pageSize);\r\n\t\t\taddBodyInTable(this.__tblCenterBody,this.__tblCenterBodyBody);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tthis.__createBodyBody(this.__arrInternalSource,0,this.__arrInternalSource.length);\r\n\t\t\taddBodyInTable(this.__tblCenterBody,this.__tblCenterBodyBody);\r\n\t\t}\r\n\t\tif(!fromSort)\r\n\t\t{\r\n\t\t\tif(this.__enablePagination && !this.__isPaginationTypeScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__createPaginationControl(this.__divOuterContainer);\r\n\t\t\t}\r\n\t\t\tthis.__setBodyMeasurement();\r\n\t\t}\r\n\t\tif(this.__enablePagination && !this.__isPaginationTypeScroll && this.__isPaginationModeAuto)\r\n\t\t{\r\n\t\t\tif(this.__arrInternalSource && this.__arrInternalSource.length > 0)\r\n\t\t\t{\r\n\t\t\t\tthis.__divPagination ? this.__divPagination.style.display = \"\" : null;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__divPagination ? this.__divPagination.style.display = \"none\" : null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__alignTables(isReset);\r\n\t\t//this.__setFixedCellsPosition();\r\n\t\tif(this.__enableRowMove)\r\n\t\t{\r\n\t\t\tvar setting = {table:this.__tblCenterBody,isSameTableMove:this.__isSameTableMove,dragEndHandler:this.__rowMoverDropEndHandler};\r\n\t\t\tvar rowMover = new NSTableRowMover(setting);\r\n\t\t}\r\n\t\tvar self = this;\r\n\t\tif(this.__enableCellSelection)\r\n\t\t{\r\n\t\t\tif(this.__nsTableCellNavigator)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsTableCellNavigator.destroy();\r\n\t\t\t\tif(this.__tableCellNavigatorEventRef)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_SELECTED,this.__tableCellNavigatorEventRef);\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_UNSELECTED,this.__tableCellNavigatorEventRef);\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_SELECTABLE,this.__tableCellNavigatorEventRef);\r\n\t\t\t\t\tthis.__tableCellNavigatorEventRef = null;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsTableCellNavigator = null;\r\n\t\t\t}\r\n\t\t\tvar keyNavigationValid = function(event,cell)\r\n\t\t\t{\r\n\t\t\t\treturn self.__nsGridEditor.isOtherKeyNavigationValid(event,cell);\r\n\t\t\t};\r\n\t\t\tthis.__nsTableCellNavigator = new NSTableCellNavigator(self.__tblCenterBody,{keyNavigationValid:keyNavigationValid});\r\n\t\t\tthis.__tableCellNavigatorEventRef = this.__tableCellNavigatorEventHandler.bind(this);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_SELECTED,this.__tableCellNavigatorEventRef);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_UNSELECTED,this.__tableCellNavigatorEventRef);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSTableCellNavigator.CELL_SELECTABLE,this.__tableCellNavigatorEventRef);\r\n\t\t}\r\n\t\tif(this.__enableMultiCellSelection)\r\n\t\t{\r\n\t\t\tif(this.__nsCellSelection)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsCellSelection.destroy();\r\n\t\t\t\tif(this.__tableCellSelectionEventRef)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSCellSelection.SELECTION_START,this.__tableCellSelectionEventRef);\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSCellSelection.SELECTION_END,this.__tableCellSelectionEventRef);\r\n\t\t\t\t\tthis.util.removeEvent(self.__tblCenterBody,NSCellSelection.SET_CELL_VALUE,this.__tableCellSelectionEventRef);\r\n\t\t\t\t\tthis.__tableCellSelectionEventRef = null;\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsCellSelection = null;\r\n\t\t\t}\r\n\t\t\tvar editors = [];\r\n\t\t\tfor (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t    {\r\n\t\t\t\tvar colItem = this.__columns[colIndex];\r\n\t\t\t\tif(colItem[\"multiSelectionEditor\"])\r\n\t\t\t\t{\r\n\t\t\t\t\teditors.push({type:NSCellSelection.EDITORS[colItem[\"multiSelectionEditor\"]]});\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\teditors.push({type:NSCellSelection.EDITORS[NSGrid.MULTI_SELECTION_EDITORS_TEXT]});\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t\tvar setting = this.__multiCellSelectionSetting; \r\n\t\t\tsetting.editors = editors;\r\n\t\t\tthis.__nsCellSelection = new NSCellSelection(self.__tblCenterBody,setting);\r\n\t\t\tthis.__tableCellSelectionEventRef = this.__tableCellSelectionEventHandler.bind(this);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSCellSelection.SELECTION_START,this.__tableCellSelectionEventRef);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSCellSelection.SELECTION_END,this.__tableCellSelectionEventRef);\r\n\t\t\tthis.util.addEvent(self.__tblCenterBody,NSCellSelection.SET_CELL_VALUE,this.__tableCellSelectionEventRef);\r\n\t\t}\r\n\t\tthis.__addMediaQueries();\r\n\t\tthis.__addStyleForFixedColumns();\r\n\t\t//this.__updateFixedColumnsForAllTables();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setNSVirtualScroll = function(source)\r\n\t{\r\n\t\tvar length = 0;\r\n\t\tif(source && source.length)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tif(source[count][this.__fieldRowVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\tlength++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__nsVirtualScroll)\r\n\t\t{\r\n\t\t\tthis.__nsVirtualScroll.dataSource(length);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(length > 0)\r\n\t\t\t{\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tvar pageChangedHandler = function(page) {\r\n\t\t\t\t\t//self.__updateStickyColumns(self.__tblCenterBody);\r\n\t\t\t\t}\r\n\t\t\t\tvar setting = {scrollElement: this.__divCenterTableBodyContainer,contentElement: this.__tblCenterBodyBody,itemTag: \"tr\",totalLength: length,getItemComponent:this.__getRowComponentForVirtual.call(this),\r\n\t\t\t\t\t\t\t\tgetEmptyItemComponent:this.__getEmptyRowComponentForVirtual.call(this),pageChanged: pageChangedHandler};\r\n\t\t\t\tvar virtualScrollSetting = this.__virtualScrollSetting;\r\n\t\t\t\tvar arrCopyFields = [\"pageSize\",\"pagesRendered\",\"enableScrollDelay\",\"scrollInterval\",\"resizeInterval\",\"enableLoader\",\"getLoaderComponent\"];\r\n\t\t\t\tvar field = null;\r\n\t\t\t\tfor(var count = 0;count < arrCopyFields.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tfield = arrCopyFields[count];\r\n\t\t\t\t\tif(!this.util.isUndefinedOrNull(virtualScrollSetting[field]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetting[field] = virtualScrollSetting[field];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.__nsVirtualScroll = new NSVirtualScroll(setting);\r\n\t\t\t}\r\n\t\t\telse if(this.__tblCenterBodyBody)\r\n\t\t\t{\r\n\t\t\t\tthis.__tblCenterBodyBody.innerHTML = \"\";\r\n\t\t\t\tthis.__tblCenterBodyBody.appendChild(this.__createNoDataRow());\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getRowComponentForVirtual = function()\r\n\t{\r\n\t\tvar grid = this;\r\n\t\tvar CreateRow = function(index)\r\n\t\t{\r\n\t\t\tthis.__index = index;\r\n\t\t\tthis.__grid =  grid;\r\n\t\t\tthis.__item = null;\r\n\t\t\tthis.__row = null;\r\n\t\t};\r\n\t\tCreateRow.prototype.getElement = function()\r\n\t\t{\r\n\t\t\tif(!this.__row)\r\n\t\t\t{\r\n\t\t\t\tif(this.__grid.__type == this.__grid.GRID_TYPE_NORMAL)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__item = this.__grid.__arrInternalSource[this.__index];\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__item = this.__grid.__getVisibleItemByIndex(null,this.__index);\r\n\t\t\t\t}\r\n\t\t\t\tthis.__row = this.__grid.__createBodyRow(this.__item,false);\r\n\t\t\t}\r\n\t\t\treturn this.__row;\r\n\t\t};\r\n\t\treturn CreateRow;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getEmptyRowComponentForVirtual = function()\r\n\t{\r\n\t\tvar grid = this;\r\n\t\tvar CreateEmptyRow = function()\r\n\t\t{\r\n\t\t\tthis.__grid = grid;\r\n\t\t\tthis.__row = null;\r\n\t\t};\r\n\t\tCreateEmptyRow.prototype.getElement = function()\r\n\t\t{\r\n\t\t\tif(!this.__row)\r\n\t\t\t{\r\n\t\t\t\tthis.__row = this.__grid.__createNoDataRow.call(this.__grid);\r\n\t\t\t}\r\n\t\t\treturn this.__row;\r\n\t\t};\r\n\t\treturn CreateEmptyRow;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createCustomScroller = function()\r\n\t{\r\n\t\tif(this.__enableCustomScrollBar && !this.__scroller)\r\n\t\t{\r\n\t\t\tvar setting = {verticalElement:this.__getVerticalScrollableContainer(),horizontalElement:this.__getHorizontalScrollableContainer(),enableCustomHandler: true,verticalScrollButtons:this.__customScrollBarSetting.verticalScrollButtons,horizontalScrollButtons:this.__customScrollBarSetting.horizontalScrollButtons,enableMoveOnClick: true};\r\n\t\t\tfor (var key in setting) \r\n\t\t\t{ \r\n\t\t\t\tthis.__scrollerSetting[key] = setting[key]; \r\n\t\t\t}\r\n\t\t\tthis.__scroller = new NSScroller(this.__scrollerSetting);\r\n\t\t\tvar customScrollHandler = this.__customScrollHandler.bind(this);\r\n\t\t\tthis.util.addEvent(this.__scrollerSetting.verticalElement,NSScroller.SCROLLING,customScrollHandler);\r\n\t\t\tif(this.__scrollerSetting.verticalElement != this.__scrollerSetting.horizontalElement)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addEvent(this.__scrollerSetting.horizontalElement,NSScroller.SCROLLING,customScrollHandler);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__customScrollHandler = function(event)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar virtualVerHandler = function()\r\n\t\t{\r\n\t\t\t//self.__setVirtualScroll.bind(self)(scrollPos,event);\r\n\t\t};\r\n\t\tvar dataRefreshVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar asyncLoadVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar paginationVerHandler = function()\r\n\t\t{\r\n\t\t\t\r\n\t\t};\r\n\t\tvar normalVerHandler = function()\r\n\t\t{\r\n\t\t\tself.__getVerticalScrollableContainer().scrollTop = scrollPos;\r\n\t\t};\r\n\t\tvar normalHorHandler = function()\r\n\t\t{\r\n\t\t\tself.__getHorizontalScrollableContainer().scrollLeft = scrollPos;\r\n\t\t};\r\n\t\tvar objCondition = {virtualScroll:{eligible:this.__enableVirtualScroll,verHandler:virtualVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tdataRefreshOnEnd:{eligible:this.__enableDataRefreshOnScrollEnd,verHandler:dataRefreshVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tasyncLoad:{eligible:this.__enableAsyncLoadPagination,verHandler:asyncLoadVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tpagination:{eligible:(this.__enablePagination && this.__isPaginationTypeScroll),verHandler:paginationVerHandler,horHandler:normalHorHandler},\r\n\t\t\t\t\t\t\tnormal:{eligible:true,verHandler:normalVerHandler,horHandler:normalHorHandler}\r\n\t\t\t\t\t\t   };\r\n\t\tvar eventItem = event;\r\n\t\tvar direction = eventItem.direction;\r\n\t\tvar scrollPos = eventItem.scrollPos;\r\n\t\tvar oldScrollPos = eventItem.oldScrollPos;\r\n\t\tfor(var key in objCondition)\r\n\t\t{\r\n\t\t\tvar item = objCondition[key];\r\n\t\t\tif(item.eligible)\r\n\t\t\t{\r\n\t\t\t\tif(direction == \"vertical\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item.verHandler)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem.verHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item.horHandler)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem.horHandler();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createScrollTip = function() \r\n\t{\r\n\t\tif(this.__enableScrollBarTip && !this.__divScrollTipContainer)\r\n\t\t{\r\n\t\t\tthis.__divScrollTipContainer = this.util.createDiv(this.getID() + \"ScrollTipContainer\",\"nsGridScrollTipContainer\");\r\n\t\t\tthis.__divScrollTipText = this.util.createDiv(this.getID() + \"ScrollTipText\",\"nsGridScrollTipText\");\r\n\t\t\tthis.__divScrollTipContainer.appendChild(this.__divScrollTipText);\r\n\t\t\tvar divTri = this.util.createDiv(this.getID() + \"ScrollTipTriangle\",\"nsGridScrollTipTriangle\");\r\n\t\t\tthis.__divScrollTipContainer.appendChild(divTri);\r\n\t\t\tthis.addChild(this.__divScrollTipContainer);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createRowAsync= function(item,index,array)\r\n\t{\r\n\t\tthis.__objGrid.__createRowAsync(item,index,array);\r\n\t\tconsole.log(index + \" rendererd\");\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__asyncSourceCompleteHandler= function()\r\n\t{\r\n\t\tconsole.log(\"CompleteHandler\");\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyHeader= function()\r\n\t{\r\n\t\tif(this.__tblCenterBody)\r\n\t\t{\r\n\t\t\t//for some reason this method is called multiple times on load so checking if colgroup is already created or not\r\n\t\t\tvar isColGroupCreated = false;\r\n\t\t\tif(this.__columns && this.__columns.length > 0 && document.getElementById(this.getID() + \"BodyColGroup\" + this.__columns[0].dataField))\r\n\t\t\t{\r\n\t\t\t\tisColGroupCreated = true;\r\n\t\t\t}\r\n\t\t\t//In case of Virtual scroll thead will be present\r\n\t\t\tvar header = this.__tblCenterBody.querySelector(\"thead\");\r\n\t\t\tif(!header)\r\n\t\t\t{\r\n\t\t\t\theader = this.__tblCenterBody.createTHead();\r\n\t\t\t}\r\n\t\t\tvar headerRow = header.insertRow(-1);\r\n\t\t    headerRow.style.height = \"auto\";\r\n\t\t    for (var colIndex = 0; colIndex < this.__columns.length; colIndex++)\r\n\t\t    {\r\n\t\t        var colItem = this.__columns[colIndex];\r\n\t\t        if(!isColGroupCreated)\r\n\t\t        {\r\n\t\t        \tthis.__createBodyColGroup(colItem);\r\n\t\t        }\r\n\t\t        this.__createBodyHeaderCell(colItem,headerRow);\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyColGroup = function(colItem)\r\n\t{\r\n\t\tif(colItem)\r\n\t\t{\r\n\t\t\tvar colgroup = document.createElement(\"colgroup\");\r\n\t\t\tcolgroup.setAttribute(\"id\",this.getID() + \"BodyColGroup\" + colItem.dataField);\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroup\");\r\n\t\t\tthis.util.addStyleClass(colgroup,\"nsGridColGroupBody\");\r\n\t\t\tthis.__tblCenterBody.appendChild(colgroup);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyHeaderCell= function(colItem,headerRow)\r\n\t{\r\n\t\tif(colItem && headerRow)\r\n\t\t{\r\n\t\t\tvar headerCell = headerRow.insertCell(-1);\r\n\t\t\tthis.util.addStyleClass(headerCell,\"nsGridCell\");\r\n\t\t\theaderCell.style.width = (colItem[\"width\"]);\r\n\t\t    headerCell.style.height = \"0px\";\r\n\t\t    headerCell.style.padding = \"0px\";\r\n\t\t    this.__addPriorityClassInCell(headerCell,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__resetDataInBody= function(fromIndex,toIndex,fromRowIndex,useVisibleIndex)\r\n\t{\r\n\t\tthis.__objGrid.__resetDataInBody(fromIndex,toIndex,fromRowIndex,useVisibleIndex);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyBody= function(dataSet,startIndex,endIndex,callAsync)\r\n\t{\r\n\t\tthis.__stopScroll = true;\r\n\t    if(dataSet && dataSet.length > 0)\r\n\t    {\r\n\t    \tthis.__objGrid.__createBodyBody(dataSet,startIndex,endIndex);\r\n\t    }\r\n\t    else\r\n\t    {\r\n\t    \tthis.__tblCenterBodyBody.appendChild(this.__createNoDataRow());\r\n\t    }\r\n\t    this.__stopScroll = false;\r\n\t    if(callAsync && this.__processArrayAsync)\r\n\t    {\r\n\t    \tthis.__processArrayAsync.start(this.__getTotalRows());\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setBodyRowProperty = function(row,item,rowIndex)\r\n\t{\r\n\t\tif(row && item)\r\n\t\t{\r\n\t\t\tif(!this.__enableVariableRowHeight)\r\n\t\t\t{\r\n\t\t\t\tif(this.__rowHeight > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.height = this.__rowHeight + \"px\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(this.__virtualRowHeight > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.height = this.__virtualRowHeight + \"px\";\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.height = \"auto\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!this.__enableColumnMouseHover)\r\n\t\t\t{\r\n\t\t\t    var className = ((rowIndex % 2) === 0) ? this.__CLASS_EVEN_ROW : this.__CLASS_ODD_ROW;\r\n\t\t\t    this.util.addStyleClass(row,\"nsGridRow \" + className);\r\n\t\t\t}\r\n\t\t    if(this.__enableMouseHover)\r\n\t\t    {\r\n\t\t    \tthis.util.addEvent(row,\"mouseover\",this.__rowMouseHover.bind(this));\r\n\t\t\t    this.util.addEvent(row,\"mouseout\",this.__rowMouseOut.bind(this));\r\n\t\t    }\r\n\t\t    this.util.addEvent(row,\"click\",this.__rowClickHandler.bind(this));\r\n\t\t    this.util.addEvent(row,\"dblclick\",this.__rowDblClickHandler.bind(this));\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyRow = function(item,isAdd)\r\n\t{\r\n\t\treturn this.__objGrid.__createRow(item,null,isAdd);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyRowAt = function(item,index)\r\n\t{\r\n\t\tif(item && index > -1)\r\n\t    {\r\n\t\t\treturn this.__objGrid.__createRow(item,index);\r\n\t    }\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createBodyRowCell= function(row,colIndex,createDiv)\r\n\t{\r\n\t\tvar cell =  row.insertCell(-1);\r\n    \tthis.util.addStyleClass(cell,\"nsGridCell\");\r\n    \tthis.util.addStyleClass(cell , \"nsBodyDataGridCell\");\r\n    \tthis.util.addStyleClass(cell , \"nsBodyDataGridCellTheme\");\r\n    \tthis.__addStyleForFixedCell(cell,colIndex);\r\n    \tthis.__applyCustomClass(cell,\"bodyCell\");\r\n    \tif(colIndex === 0)\r\n    \t{\r\n    \t\tthis.__applyCustomClass(cell,\"firstBodyColumn\");\r\n    \t}\r\n    \telse\r\n    \t{\r\n    \t\tthis.__applyCustomClass(cell,\"nonFirstBodyColumn\");\r\n    \t}\r\n\t\tif(createDiv)\r\n\t\t{\r\n\t\t\tvar cellDiv = this.util.createDiv(null);\r\n\t\t    cell.appendChild(cellDiv);\r\n\t\t}\r\n\t    return cell;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setBodyCellProperties= function(cell)\r\n\t{\r\n\t\tif(cell)\r\n\t\t{\r\n\t\t\tvar handler = this.__bodyCellEventHandler.bind(this);\r\n\t\t\tif(this.__enableColumnMouseHover)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addEvent(cell,\"mouseover\",handler);\r\n\t\t\t\tthis.util.addEvent(cell,\"mouseleave\",handler);\r\n\t\t\t}\r\n\t\t\tthis.util.addEvent(cell,\"click\",handler);\r\n\t\t\tthis.util.addEvent(cell,\"dblclick\",handler);\r\n\t\t\t//this.__setClassForFixedColumn(cell);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setBodyCellProperty = function(row,cell,item,colItem,colIndex,parentIndex,level,isReset)\r\n\t{\r\n\t\tvar hierarchicalPadding = 0;\r\n\t\tif(colItem && colItem.hasOwnProperty(\"dataField\") && colItem[\"dataField\"])\r\n\t\t{\r\n\t\t\tvar cellDiv = cell.firstChild;\r\n\t        if((this.__enableHierarchical || this.__enableGrouping || this.__enableMasterDetail) && colIndex == 0 && item.hasOwnProperty(this.__childField) && item[this.__childField]  && item[this.__childField].length > 0)\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__CLASS_GROUP_CELL);\r\n\t        \tvar isCollapsed = false;\r\n\t        \tif(!isReset && item.hasOwnProperty(this.__fieldIsCollapsed))\r\n\t \t        {\r\n\t        \t\tisCollapsed = item[this.__fieldIsCollapsed];\r\n\t \t        }\r\n\t        \t//this.__createArrow(parentIndex,cellDiv,isCollapsed);\r\n\t        \tvar cellText = this.util.createDiv(null,this.__CLASS_CELL_CHILD);\r\n\t        \tcellText.style.verticalAlign = \"top\";\r\n\t        \tthis.__addCellText(row,item,cellText,colItem,colIndex);\r\n\t        \tcellDiv.appendChild(cellText);\r\n\t        }\r\n\t        else\r\n\t        {\r\n\t        \tthis.util.addStyleClass(cellDiv,this.__CLASS_CELL_CHILD);\r\n\t        \tthis.__addCellText(row,item,cellDiv,colItem,colIndex);\r\n\t        \t//24 = 16(Arrow Width) + 6(Arrow Parent Padding) + 2(cellDiv horizontalGap between elements shown in debugger)\r\n\t        \thierarchicalPadding = 24;\r\n\t        }\r\n\t        if(colIndex == 0)\r\n\t        {\r\n\t        \tif(this.__enableHierarchical || this.__enableMasterDetail)\r\n\t            {\r\n\t            \tif(level === 0)\r\n\t            \t{\r\n\t            \t\tcell.style.paddingLeft = \"1px\";\r\n\t            \t}\r\n\t            \telse\r\n\t            \t{\r\n\t            \t\tvar paddingLeft = (10 * level) + hierarchicalPadding;\r\n\t            \t\tcell.style.paddingLeft = paddingLeft + \"px\";\r\n\t            \t}\r\n\t            }\r\n\t        \telse if(this.__enableGrouping)\r\n\t        \t{\r\n\t        \t\tif(level === 0)\r\n\t        \t\t{\r\n\t        \t\t\tcell.style.paddingLeft = \"1px\";\r\n\t        \t\t}\r\n\t        \t}\r\n\t        }\r\n\t\t}\r\n\t\tthis.__addPriorityClassInCell(cell,colItem);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__removeBodyColumn= function(colIndex)\r\n\t{\r\n\t\tif(colIndex > -1 && colIndex < this.__columns.length)\r\n\t\t{\r\n\t\t\tvar bodyRow = this.__getBodyHeaderRow(this.__tblCenterBody);\r\n\t\t\tif(bodyRow)\r\n\t\t    {\r\n\t\t\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\t    \tif(arrRows && arrRows.length > 0)\r\n\t\t\t\t{\r\n\t\t    \t\tbodyRow.deleteCell(colIndex);\r\n\t\t    \t\tvar row = null;\r\n\t\t    \t\tfor (var rowCount = 0; rowCount < arrRows.length; rowCount++) \r\n\t\t    \t\t{\r\n\t\t    \t\t\trow = arrRows[rowCount];\r\n\t\t    \t\t\trow.deleteCell(colIndex);\r\n\t\t    \t    }\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__swapOrMoveBodyCell = function(functionality,sourceIndex,destinationIndex)\r\n\t{\r\n\t\tif(this.__isColumnIndexValid(sourceIndex) && this.__isColumnIndexValid(destinationIndex))\r\n\t\t{\r\n\t\t\tvar bodyRow = this.__getBodyHeaderRow(this.__tblCenterBody);\r\n\t\t\tif(bodyRow)\r\n\t\t\t{\r\n\t\t\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\t\t\tif(arrRows && arrRows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar arrHeaderCells = bodyRow.cells;\r\n\t\t\t\t\tif(functionality === \"swap\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__swapCell(arrHeaderCells[sourceIndex],arrHeaderCells[destinationIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__moveCell(arrHeaderCells[sourceIndex],destinationIndex);\r\n\t\t\t\t\t}\r\n\t\t    \t\tvar row = null;\r\n\t\t    \t\tvar arrBodyCells = [];\r\n\t\t    \t\tfor (var rowCount = 0; rowCount < arrRows.length; rowCount++) \r\n\t\t    \t\t{\r\n\t\t    \t\t\trow = arrRows[rowCount];\r\n\t\t    \t\t\tarrBodyCells = row.cells;\r\n\t\t    \t\t\tif(functionality === \"swap\")\r\n\t\t\t\t\t\t{\r\n\t\t    \t\t\t\tthis.__swapCell(arrBodyCells[sourceIndex],arrBodyCells[destinationIndex]);\r\n\t\t\t\t\t\t}\r\n\t\t    \t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__moveCell(arrBodyCells[sourceIndex],destinationIndex);\r\n\t\t\t\t\t\t}\r\n\t\t    \t    }\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createArrow = function(item,parentRowCount,parentElement,isCollapsed,colItem)\r\n\t{\r\n\t\t if(parentElement && this.__showExpandCollapseIcon)\r\n\t\t {\r\n\t\t\t var cellArrowParent = this.util.createDiv(null,\"nsArrowParent\");\r\n\t\t\t var arrowID = this.getID() + \"compArrow\" + parentRowCount;\r\n\t\t\t var compArrow = this.util.createDiv(arrowID,\"nsArrow\");\r\n\t\t\t //compArrow.style.paddingTop = \"3px\";\r\n\t\t\t compArrow.setAttribute(\"ns-parent-row-count\",parentRowCount);\r\n\t\t\t \r\n\t\t\t var objSVG = new NSSvg();\r\n\t\t\t this.__objGrid.__createArrow(compArrow,objSVG,arrowID,isCollapsed,item,colItem);\r\n\t\t\t this.util.addEvent(compArrow,\"click\",this.__arrowClickHandler.bind(this));\r\n\t\t\t cellArrowParent.appendChild(compArrow);\r\n\t\t\t parentElement.appendChild(cellArrowParent);\r\n\t\t\t item[this.__fieldRowArrow] = compArrow;\r\n\t\t\t return compArrow;\r\n\t\t }\r\n\t\t return null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setArrowDirection = function(compArrow,isCollapsed)\r\n\t{\r\n\t\tif(compArrow)\r\n\t\t{\r\n\t\t\tvar parent = this.util.findParent(compArrow,\"TD\");\r\n\t\t\tvar colIndex = parseInt(parent.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tvar colItem = this.__getColumnObject(colIndex);\r\n\t\t\tthis.__objGrid.__setArrowDirection(compArrow,isCollapsed,colItem);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isArrowCollapsed = function(compArrow)\r\n\t{\r\n\t\tif(compArrow && compArrow.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t{\r\n\t\t\tvar rowIndex = parseInt(compArrow.getAttribute(\"ns-parent-row-count\"));\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\treturn item[this.__fieldIsCollapsed];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isRowCollapsed = function(element,rowIndex)\r\n\t{\r\n\t\tif(element)\r\n\t\t{\r\n\t\t\telement = this.util.findParent(element,\"TR\");\r\n\t\t\tif(element)\r\n\t\t\t{\r\n\t\t\t\trowIndex = parseInt(element.getAttribute(\"ns-index\"));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(rowIndex > -1)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\treturn item[this.__fieldIsCollapsed];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createNoDataRow = function()\r\n\t{\r\n\t\tvar row = document.createElement(\"tr\");\r\n\t\tthis.util.addStyleClass(row,\"nsNoRecordsFound\");\r\n\t\trow.style.height = \"auto\";\r\n\t\tvar cell = row.insertCell(-1);\r\n\t\tcell.setAttribute(\"colspan\",this.__columns.length);\r\n\t\tvar textNode = document.createTextNode(this.__noDataMessage);\r\n\t\tcell.appendChild(textNode);\r\n\t\treturn row;\r\n\t};\r\n\t/******************************Fixed Column ***************************************/\r\n\tNSGrid.prototype.__createFixedRows = function()\r\n\t{\r\n\t\tthis.__createFixedHeaderRows();\r\n\t\tthis.__createFixedBodyRows();\r\n\t\tthis.__createFixedFooterRows();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFixedHeaderRows = function()\r\n\t{\r\n\t\tthis.__arrFixedLeftCells = [];\r\n\t\tthis.__arrFixedRightCells = [];\r\n\t\tvar centerHeaderHeaderCells = [];\r\n\t\tvar centerHeaderBodyCells = [];\r\n\t\tvar centerHeaderRendererCells = [];\r\n\t\tvar centerBodyHeaderCells = []; \r\n\t\tvar arrExtraHeaderCells = [];\r\n\t\tvar centerHeaderRow = this.__getHeaderHeaderRow(this.__tblCenterHeader);\r\n\t\tif(centerHeaderRow)\r\n\t\t{\r\n\t\t\tcenterHeaderHeaderCells = centerHeaderRow.cells;\r\n\t\t}\r\n\t\tvar centerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\tif(centerBodyRow)\r\n\t\t{\r\n\t\t\tcenterHeaderBodyCells = centerBodyRow.cells;\r\n\t\t\tvar centerRendererRow = this.__getHeaderFilterRow(this.__tblCenterHeader);\r\n\t\t\tcenterHeaderRendererCells = centerRendererRow ? centerRendererRow.cells : null;\r\n\t\t\tvar arrExtraRow = this.__getHeaderExtraRow(this.__tblCenterHeader);\r\n\t\t\tif(arrExtraRow && arrExtraRow.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor (var rowIndex = 0; rowIndex < arrExtraRow.length; rowIndex++)\r\n\t\t\t    {\r\n\t\t\t\t\tvar row = arrExtraRow[rowIndex];\r\n\t\t\t\t\tarrExtraHeaderCells.push(row.cells);\r\n\t\t\t    }\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar centerHeaderRow =  this.__getBodyHeaderRow(this.__tblCenterBody);\r\n\t\tif(centerHeaderRow)\r\n\t\t{\r\n\t\t\tcenterBodyHeaderCells = centerHeaderRow.cells;\r\n\t\t}\r\n\t\tvar setCellProperties = this.__setFixedCellProperties.bind(this);\r\n\t\tvar setCells = function(arrFixed,startIndex,endIndex,isLeftDirection)\r\n\t\t{\r\n\t\t\tfor (var colIndex = startIndex; colIndex < endIndex; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar headerHeaderCell = centerHeaderHeaderCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,headerHeaderCell,isLeftDirection);\r\n\t\t    \tvar headerBodyCell = centerHeaderBodyCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,headerBodyCell,isLeftDirection);\r\n\t\t    \tvar headerRendererCell = centerHeaderRendererCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,headerRendererCell,isLeftDirection);\r\n\t\t    \tvar bodyHeaderCell = centerBodyHeaderCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,bodyHeaderCell,isLeftDirection);\r\n\t\t    \tfor (var rowIndex = 0; rowIndex < arrExtraHeaderCells.length; rowIndex++)\r\n\t\t\t    {\r\n\t\t    \t\tvar extraCell = arrExtraHeaderCells[rowIndex][colIndex];\r\n\t\t\t    \tsetCellProperties(arrFixed,extraCell,isLeftDirection);\r\n\t\t\t    }\r\n\t\t    }\r\n\t\t};\r\n\t\tthis.__callFixedArrayCallback.bind(this)(setCells);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFixedBodyRows = function()\r\n\t{\r\n\t\tvar headerRow = this.__getBodyHeaderRow(this.__tblCenterBody);\r\n\t\tif(headerRow)\r\n\t\t{\r\n\t\t\tthis.__createFixedBodyRow(headerRow);\r\n\t\t}\r\n\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\tif(arrRows && arrRows.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0; count < arrRows.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar row = arrRows[count];\r\n\t\t\t\tthis.__createFixedBodyRow(row);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFixedBodyRow = function(row)\r\n\t{\r\n\t\t/*var centerBodyBodyCells = row.cells;\r\n\t\tvar setCellProperties = this.__setFixedCellProperties.bind(this);\r\n\t\tvar setCells = function(arrFixed,startIndex,endIndex,isLeftDirection)\r\n\t\t{\r\n\t\t    for (var colIndex = startIndex; colIndex < endIndex; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar fixedCell = centerBodyBodyCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,fixedCell,isLeftDirection);\r\n\t\t    }\r\n\t\t};\r\n\t\tthis.__callFixedArrayCallback.bind(this)(setCells);*/\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFixedFooterRows = function()\r\n\t{\r\n\t\tvar headerRow = this.__getBodyHeaderRow(this.__tblCenterFooter);\r\n\t\tif(headerRow)\r\n\t\t{\r\n\t\t\tthis.__createFixedFooterRow(headerRow);\r\n\t\t}\r\n\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterFooter);\r\n\t\tif(arrRows && arrRows.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0; count < arrRows.length; count++) \r\n\t\t\t{\r\n\t\t\t\tvar row = arrRows[count];\r\n\t\t\t\tthis.__createFixedFooterRow(row);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createFixedFooterRow = function(row)\r\n\t{\r\n\t\t/*var centerBodyBodyCells = row.cells;\r\n\t\tvar setCellProperties = this.__setFixedCellProperties.bind(this);\r\n\t\tvar setCells = function(arrFixed,startIndex,endIndex,isLeftDirection)\r\n\t\t{\r\n\t\t    for (var colIndex = startIndex; colIndex < endIndex; colIndex++)\r\n\t\t    {\r\n\t\t    \tvar fixedCell = centerBodyBodyCells[colIndex];\r\n\t\t    \tsetCellProperties(arrFixed,fixedCell,isLeftDirection);\r\n\t\t    }\r\n\t\t};\r\n\t\tthis.__callFixedArrayCallback.bind(this)(setCells);*/\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__callFixedArrayCallback = function(callBack)\r\n\t{\r\n\t\t/*if(this.__leftFixedColumn > 0 && this.__columns && this.__columns.length > this.__leftFixedColumn)\r\n\t\t{\r\n\t\t\tcallBack(this.__arrFixedLeftCells,0,this.__leftFixedColumn,true);\r\n\t\t}\r\n\t\tif(this.__rightFixedColumn > 0 && this.__columns && this.__columns.length > this.__rightFixedColumn)\r\n\t\t{\r\n\t\t\tcallBack(this.__arrFixedRightCells,this.__columns.length - this.__rightFixedColumn,this.__columns.length,false);\r\n\t\t}*/\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setFixedCellProperties = function(arrFixed,cell,isLeftDirection)\r\n\t{\r\n\t\t/*this.__setFixedBackground(cell);\r\n\t\tthis.util.addStyleClass(cell,\"nsFixedDataGridCell\");\r\n\t\tif(isLeftDirection && cell.cellIndex === (this.__leftFixedColumn - 1))\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(cell,\"nsFixedLeftLastCell\");\r\n\t\t}\r\n\t\telse if(!isLeftDirection && cell.cellIndex === (this.__columns.length - this.__rightFixedColumn))\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(cell,\"nsFixedRightFirstCell\");\r\n\t\t}\r\n\t\tif(this.__enableFixedColumnAnimation)\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(cell,\"nsFixedDataGridCellAnimate\");\r\n\t\t}*/\r\n\t\tarrFixed.push(cell);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setFixedBackground = function(cell) \r\n\t{\r\n\t\tvar row = cell.parentNode;\r\n\t\tvar cellBackground = this.util.getStyleValue(cell,\"background-color\",false);\r\n\t\tcellBackground = (cellBackground == \"transparent\" || cellBackground == \"rgba(0, 0, 0, 0)\") ? null : cellBackground;\r\n\t\r\n\t\tvar rowBackground = this.util.getStyleValue(row,\"background-color\",false);\r\n\t\trowBackground = (rowBackground == \"transparent\" || rowBackground == \"rgba(0, 0, 0, 0)\") ? null : rowBackground;\r\n\t\r\n\t\tvar background = rowBackground ? rowBackground : \"white\";\r\n\t\tbackground = cellBackground ? cellBackground : background;\r\n\t\t\r\n\t\tcell.style.backgroundColor = background;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setFixedCellsPosition = function()\r\n\t{\r\n\t\t/*var divBodyContainer = this.__getVerticalScrollableContainer();\r\n\t\tvar divHorContainer = this.__getHorizontalScrollableContainer();\r\n\t\tvar scrollWidth = divHorContainer.scrollWidth;\r\n\t\tvar clientWidth = divHorContainer.clientWidth;\r\n\t\tvar scrollHeight = divBodyContainer.scrollHeight;\r\n\t\tvar clientHeight = divBodyContainer.clientHeight;\r\n\t\tvar top = divBodyContainer.scrollTop;\r\n\t\tvar left = divHorContainer.scrollLeft;\r\n\t\tvar right = scrollWidth - clientWidth - left;\r\n\t\tfor(var count = 0;count < this.__arrFixedLeftCells.length;count++)\r\n\t\t{\r\n\t\t\tvar cell = this.__arrFixedLeftCells[count];\r\n\t\t\tcell.style.right = null; \r\n\t\t\tcell.style.left = left + \"px\";\r\n\t\t}\r\n\t\tfor(var count = 0;count < this.__arrFixedRightCells.length;count++)\r\n\t\t{\r\n\t\t\tvar cell = this.__arrFixedRightCells[count];\r\n\t\t\tcell.style.left = null;\r\n\t\t\tcell.style.right = right + \"px\";\r\n\t\t}*/\r\n\t};\r\n\t\r\n\t/*NSGrid.prototype.__setClassForFixedColumn = function(cell)\r\n\t{\r\n\t\tthis.__setFixedBackground(cell);\r\n\t\tthis.util.addStyleClass(cell,\"nsFixedDataGridCell\");\r\n\t\tif(this.__leftFixedColumn > 0 && this.__columns && this.__columns.length > this.__leftFixedColumn)\r\n\t\t{\r\n\t\t\tif(cell.cellIndex === (this.__leftFixedColumn - 1))\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(cell,\"nsFixedLeftLastCell\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__rightFixedColumn > 0 && this.__columns && this.__columns.length > this.__rightFixedColumn)\r\n\t\t{\r\n\t\t\tif(cell.cellIndex === (this.__columns.length - this.__rightFixedColumn))\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(cell,\"nsFixedRightFirstCell\");\r\n\t\t\t}\r\n\t\t}\r\n\t}*/\r\n\t\r\n\tNSGrid.prototype.__updateFixedColumnsForAllTables = function() \r\n\t{\r\n\t\tthis.__updateStickyColumns(this.__tblCenterHeader);\r\n\t\tthis.__updateStickyColumns(this.__tblCenterBody);\r\n\t\tthis.__updateStickyColumns(this.__tblCenterFooter);\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__updateStickyColumns = function(table,recalculate) \r\n\t{\r\n\t\tvar arrRows = this.__getBodyBodyRow(table);\r\n\t\tif(arrRows && arrRows.length) {\r\n\t\t\tvar stickyStartStates = this.__getFixedColumnIndicatorArray(\"Left\",recalculate);\r\n\t\t\tvar stickyEndStates = this.__getFixedColumnIndicatorArray(\"Right\",recalculate);\r\n\t\t\tvar row = arrRows[0];\r\n\t\t\tvar cellWidths = this.__getCellWidths(row, recalculate);\r\n\t\t\tvar startPositions = this.__getStickyStartColumnPositions(cellWidths, stickyStartStates);\r\n\t\t\tvar endPositions = this.__getStickyEndColumnPositions(cellWidths, stickyEndStates);\r\n\r\n\t\t\tvar lastStickyStart = stickyStartStates.lastIndexOf(true);\r\n\t\t\tvar firstStickyEnd = stickyEndStates.indexOf(true);\r\n\t\t\tfor(var rowIndex = 0;rowIndex < arrRows.length;rowIndex++) \r\n\t\t\t{\r\n\t\t\t\trow = arrRows[rowIndex];\r\n\t\t\t\tvar arrCells = row.cells;\r\n\t\t        for (var cellIndex = 0;cellIndex < arrCells.length;cellIndex++) \r\n\t\t        {\r\n\t\t        \tconst cell = arrCells[cellIndex]\r\n\t\t        \tif (stickyStartStates[cellIndex]) \r\n\t\t        \t{\r\n\t\t        \t\tthis.__addStickyStyle(cell,\"Left\",startPositions[cellIndex],cellIndex === lastStickyStart);\r\n\t\t        \t\tthis.__setFixedBackground(cell);\r\n\t\t        \t}\r\n\t\t        \tif (stickyEndStates[cellIndex]) \r\n\t\t        \t{\r\n\t\t        \t\tthis.__addStickyStyle(cell,\"Right\", endPositions[cellIndex],cellIndex === firstStickyEnd);\r\n\t\t        \t\tthis.__setFixedBackground(cell);\r\n\t\t        \t}\r\n\t\t        }\r\n\t\t     }\r\n\t\t}\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__getFixedColumnIndicatorArray = function(direction,recalculate) \r\n\t{\r\n\t\tvar fieldName = \"__cachedFixed\" + direction + \"Indicator\";\r\n\t\tvar arrIndicator = this[fieldName];\r\n\t\tvar directionLower = direction.toLowerCase();\r\n\t\tif(!recalculate && arrIndicator && arrIndicator.length) {\r\n\t\t\treturn arrIndicator;\r\n\t\t}\r\n\t\tvar arrRet = [];\r\n\t\tfor(var count = 0; count < this.__columns.length;count++)\r\n\t\t{\r\n\t\t\tvar objColumn = this.__columns[count];\r\n\t\t\tif(objColumn.pinned && objColumn.pinned == directionLower) {\r\n\t\t\t\tarrRet.push(true);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tarrRet.push(false);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis[fieldName] = arrRet;\r\n\t\treturn arrRet;\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__getCellWidths = function(row,recalculate)\r\n\t{\r\n\t\tif(!recalculate && this.__cachedCellWidths && this.__cachedCellWidths.length) {\r\n\t\t\treturn this.__cachedCellWidths;\r\n\t\t}\r\n\t\tvar cellWidths = [];\r\n\t    var firstRowCells = row.children;\r\n\t    for (var i = 0; i < firstRowCells.length; i++) {\r\n\t      var cell = firstRowCells[i];\r\n\t      cellWidths.push(cell.getBoundingClientRect().width);\r\n\t    }\r\n\t    this.__cachedCellWidths = cellWidths;\r\n\t    return cellWidths;\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__getStickyStartColumnPositions = function(widths,stickyStates)\r\n\t{\r\n\t    var positions = [];\r\n\t    var nextPosition = 0;\r\n\t\r\n\t    for (var i = 0; i < widths.length; i++) {\r\n\t      if (stickyStates[i]) {\r\n\t        positions[i] = nextPosition;\r\n\t        nextPosition += widths[i];\r\n\t      }\r\n\t    }\r\n\t\r\n\t    return positions;\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__getStickyEndColumnPositions = function(widths,stickyStates)\r\n\t{\r\n\t\tvar positions = [];\r\n\t\tvar nextPosition = 0;\r\n\r\n\t    for (var i = widths.length; i > 0; i--) {\r\n\t      if (stickyStates[i]) {\r\n\t        positions[i] = nextPosition;\r\n\t        nextPosition += widths[i];\r\n\t      }\r\n\t    }\r\n\r\n\t    return positions;\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__addStickyStyle = function(element,direction,dirValue,isBorderElement) \r\n    {\r\n\t\tvar directionLower = direction.toLowerCase();\r\n\t    element.classList.add(\"nsFixedDataGridCell\");\r\n\t    if (isBorderElement) {\r\n\t    \telement.classList.add(\"nsFixed\" + direction + \"LastCell\");\r\n\t    }\r\n\t    element.style[directionLower] = dirValue + \"px\";\r\n\t    //element.style.zIndex = this._getCalculatedZIndex(element);\r\n\t    /*if (this._needsPositionStickyOnElement) {\r\n\t      element.style.cssText += 'position: -webkit-sticky; position: sticky; ';\r\n\t    }*/\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__isColumnFixed = function(index)\r\n\t{\r\n\t\treturn ((index < this.__leftFixedColumn) || ((this.__orignalColumns.length - this.__rightFixedColumn) <= index));\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isFixedColumnApplied = function()\r\n\t{\r\n\t\treturn ((this.__leftFixedColumn > 0) || (this.__rightFixedColumn > 0));\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addStyleForFixedCell = function(cell,colIndex)\r\n\t{\r\n\t\tvar isColumnFixed = this.__isColumnFixed(colIndex);\r\n\t\tif(isColumnFixed) \r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(cell,\"nsFixedDataGridCell\");\r\n\t\t\tif(colIndex === (this.__leftFixedColumn - 1))\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(cell,\"nsFixedLeftLastCell\");\r\n\t\t\t}\r\n\t\t\telse if(colIndex === (this.__columns.length - this.__rightFixedColumn))\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(cell,\"nsFixedRightFirstCell\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__updateColumnClassForFixedColumns = function(index,direction)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar refreshCellClass = function(arrRows) \r\n\t\t{\r\n\t\t\tif(arrRows && arrRows.length) \r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrRows.length;count++) \r\n\t\t\t\t{\r\n\t\t\t\t\tvar cell = arrRows[count].cells[index];\r\n\t\t\t\t\tif(direction == \"left\" || direction == \"right\") \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.util.addStyleClass(cell,\"nsFixedDataGridCell\");\r\n\t\t\t\t\t\tself.util.addStyleClass(cell,\"nsFixedDataGridCell\" + self.util.toCamelCase(direction));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.util.removeStyleClass(cell,\"nsFixedDataGridCell\");\r\n\t\t\t\t\t\tself.util.removeStyleClass(cell,\"nsFixedDataGridCellLeft\");\r\n\t\t\t\t\t\tself.util.removeStyleClass(cell,\"nsFixedDataGridCellRight\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__tblCenterHeaderBody) {\r\n\t\t\tvar arrHeaderRows = this.__tblCenterHeaderBody.rows;\r\n\t\t\trefreshCellClass(arrHeaderRows);\r\n\t\t}\r\n\t\tif(this.__tblCenterBodyBody) {\r\n\t\t\tvar arrBodyRows = this.__tblCenterBodyBody.rows;\r\n\t\t\trefreshCellClass(arrBodyRows);\r\n\t\t}\r\n\t\tif(this.__tblCenterFooterBody) {\r\n\t\t\tvar arrFooterRows = this.__tblCenterFooterBody.rows;\r\n\t\t\trefreshCellClass(arrFooterRows);\r\n\t\t}\r\n\t\tthis.__updateColumnClassForFixedLastColumns();\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__updateColumnClassForFixedLastColumns = function()\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar leftIndex = this.__leftFixedColumn - 1;\r\n\t\tvar rightIndex = this.__columns.length - this.__rightFixedColumn;\r\n\t\t\r\n\t\tvar resetCellClassByCon = function(con) \r\n\t\t{\r\n\t\t\tif(con) \r\n\t\t\t{\r\n\t\t\t\tvar arrCell = con.querySelectorAll(\".nsFixedLeftLastCell\");\r\n\t\t\t\tif(arrCell && arrCell.length) \r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrCell.length;count++) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar cell = arrCell[count];\r\n\t\t\t\t\t\tself.util.removeStyleClass(cell,\"nsFixedLeftLastCell\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tarrCell = con.querySelectorAll(\".nsFixedRightFirstCell\");\r\n\t\t\t\tif(arrCell && arrCell.length) \r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrCell.length;count++) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar cell = arrCell[count];\r\n\t\t\t\t\t\tself.util.removeStyleClass(cell,\"nsFixedRightFirstCell\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar refreshCellInRow = function(row) {\r\n\t\t\tif(row) {\r\n\t\t\t\tif(row.cells.length > leftIndex) {\r\n\t\t\t\t\tvar cell = row.cells[leftIndex];\r\n\t\t\t\t\tself.util.addStyleClass(cell,\"nsFixedLeftLastCell\");\r\n\t\t\t\t}\r\n\t\t\t\tif(row.cells.length > rightIndex) {\r\n\t\t\t\t\tvar cell = row.cells[rightIndex];\r\n\t\t\t\t\tself.util.addStyleClass(cell,\"nsFixedRightFirstCell\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar refreshCellClass = function(arrRows) {\r\n\t\t\tif(arrRows && arrRows.length) {\r\n\t\t\t\tfor(var count = 0;count < arrRows.length;count++) {\r\n\t\t\t\t\trefreshCellInRow(arrRows[count]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar refreshCellInVirtual = function(row) {\r\n\t\t\tresetCellClassByCon(row);\r\n\t\t\trefreshCellInRow(row);\r\n\t\t\treturn row;\r\n\t\t}\r\n\t\t\r\n\t\tif(this.__isFixedColumnApplied()) {\r\n\t\t\tif(this.__tblCenterHeaderBody) {\r\n\t\t\t\tresetCellClassByCon(this.__tblCenterHeaderBody);\r\n\t\t\t\tvar arrHeaderRows = this.__tblCenterHeaderBody.rows;\r\n\t\t\t\trefreshCellClass(arrHeaderRows);\r\n\t\t\t}\r\n\t\t\tif(this.__tblCenterBodyBody) {\r\n\t\t\t\tresetCellClassByCon(this.__tblCenterBodyBody);\r\n\t\t\t\tvar arrBodyRows = this.__tblCenterBodyBody.rows;\r\n\t\t\t\trefreshCellClass(arrBodyRows);\r\n\t\t\t}\r\n\t\t\tif(this.__tblCenterFooterBody) {\r\n\t\t\t\tresetCellClassByCon(this.__tblCenterFooterBody);\r\n\t\t\t\tvar arrFooterRows = this.__tblCenterFooterBody.rows;\r\n\t\t\t\trefreshCellClass(arrFooterRows);\r\n\t\t\t}\r\n\t\t\tif(this.__nsVirtualScroll) {\r\n\t\t\t\tthis.__nsVirtualScroll.updateItems(refreshCellInVirtual);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tNSGrid.prototype.__addStyleForFixedColumns = function()\r\n\t{\r\n\t\tvar styleId = \"nsGridFixedColumnStyle\";\r\n\t\tvar arrStyle = [];\r\n\t\tvar table = this.__tblCenterHeader;\r\n\t\tvar arrRows = this.__getBodyBodyRow(table);\r\n\t\tif(arrRows && arrRows.length && this.__columns) {\r\n\t\t\tvar styleTemplate = \".nsGridHeaderRow > .nsGridCell:nth-child(###index###),.nsGridFilterRow > .nsGridCell:nth-child(###index###),\" +\r\n\t\t\t\t\t\".nsHeaderExtraRow > .nsGridCell:nth-child(###index###),.nsGridRow > .nsGridCell:nth-child(###index###),\" +\r\n\t\t\t\t\t\".nsGridFooterRow > .nsGridCell:nth-child(###index###) {\\r\\n\" + \r\n\t\t\t\t\t\"    ###pos###;\\r\\n\" +\r\n\t\t\t\t\t\"}\"\r\n\t\t\tvar tableRect = table.getBoundingClientRect();\r\n\t\t\t//|| tableRect.x > 0\r\n\t\t\tif(!this.__tableRectFixedColumn) {\r\n\t\t\t\tthis.__tableRectFixedColumn = tableRect;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttableRect = this.__tableRectFixedColumn;\r\n\t\t\t}\r\n\t\t\tvar row = arrRows[1];\r\n\t\t\tvar arrCells = row.cells;\r\n\t\t\tif(this.__leftFixedColumn > 0 && this.__columns.length > this.__leftFixedColumn)\r\n    \t\t{\r\n\t\t        for (var cellIndex = 0;cellIndex < arrCells.length;cellIndex++) \r\n\t\t        {\r\n\t\t        \tvar cell = arrCells[cellIndex];\r\n\t\t        \tvar cellRect = cell.getBoundingClientRect();\r\n\t    \t\t\tif(cell.cellIndex < this.__leftFixedColumn)\r\n\t    \t\t\t{\r\n\t    \t\t\t    var left = cellRect.x - tableRect.x;\r\n\t    \t\t\t    var cellStyle = styleTemplate.replace(/###index###/g,cell.cellIndex + 1);\r\n\t    \t\t\t    cellStyle = cellStyle.replace(\"###pos###\",\"left: \" + left + \"px\");\r\n\t    \t\t\t    arrStyle.push(cellStyle);\r\n\t    \t\t\t}\r\n\t    \t\t\telse \r\n\t    \t\t\t{\r\n\t    \t\t\t\tbreak;\r\n\t    \t\t\t}\r\n\t\t        }\r\n\t\t\t}\r\n\t\t\tif(this.__rightFixedColumn > 0 && this.__columns.length > this.__rightFixedColumn)\r\n\t\t\t{\r\n\t\t\t\tvar totalWidth = 0;\r\n\t\t\t\tvar startingRightColIndex = this.__columns.length - this.__rightFixedColumn;\r\n\t\t\t\tfor (var cellIndex = arrCells.length - 1;cellIndex > -1;cellIndex--) \r\n\t\t        {\r\n\t\t        \tvar cell = arrCells[cellIndex];\r\n\t\t        \tvar cellRect = cell.getBoundingClientRect();\r\n\t\t        \tif(cell.cellIndex >= startingRightColIndex)\r\n\t    \t\t\t{\r\n\t\t        \t\tvar right = 0;\r\n\t    \t\t\t\tif(cellIndex !== arrCells.length - 1) \r\n\t    \t\t\t\t{\r\n\t    \t\t\t\t\tright = totalWidth;\r\n\t    \t\t\t\t}\r\n\t    \t\t\t\ttotalWidth += cellRect.width;\r\n\t    \t\t\t\tvar cellStyle = styleTemplate.replace(/###index###/g,cell.cellIndex + 1);\r\n\t    \t\t\t    cellStyle = cellStyle.replace(\"###pos###\",\"right: \" + right + \"px\");\r\n\t    \t\t\t    arrStyle.push(cellStyle);\r\n\t    \t\t\t}\r\n\t\t        \telse \r\n\t    \t\t\t{\r\n\t    \t\t\t\tbreak;\r\n\t    \t\t\t}\r\n\t\t        }\r\n\t\t\t}\r\n\t        var styleElement = document.querySelector(\"#\" + styleId);\r\n\t        if (styleElement) {\r\n\t          styleElement.parentNode.removeChild(styleElement);\r\n\t        }\r\n\t        this.util.addStylesToHead(styleId,arrStyle);\r\n\t\t}\r\n\t};\r\n\t\r\n\t\r\n\t/******************************End of Fixed Column logic **************************/\r\n\t/******************************Event Listeners *************************************/\r\n\t\r\n\tNSGrid.prototype.__arrowClickHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"DIV\");\r\n\t\tif(target && target.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t{\r\n\t\t\tvar rowIndex = target.getAttribute(\"ns-parent-row-count\");\r\n\t\t\tvar isCollapse = this.__isArrowCollapsed(target);\r\n\t\t\trowIndex = parseInt(rowIndex);\r\n\t\t\tif(rowIndex > -1)\r\n\t\t\t{\r\n\t\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\tif(item[this.__childField]  && item[this.__childField].length > 0)\r\n\t\t        {\r\n\t\t\t\t\tthis.__showHideRow(rowIndex,target,!isCollapse);\r\n\t\t        }\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__objGrid.__handleOnDemandClick(item,event);\r\n\t\t\t\t}\r\n\t\t\t\tthis.__objGrid.arrowClickHandler(item,!isCollapse);\r\n\t\t\t}\r\n\t\t}\r\n\t\tevent.stopImmediatePropagation();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerClickHandler = function(event)\r\n\t{\r\n\t\tif(this.__onGridLine)\r\n\t\t{\r\n\t\t\t return;\r\n\t\t}\r\n\t     var target = this.util.getTarget(event);\r\n\t     //adding the below condition so that if we add a span or a font and click on it then we should navigate till we find the header object\r\n\t     target = this.util.findParent(target,\"TD\");\r\n\t     var columnDetail = this.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t     this.__nsGridSort.handle(target,columnDetail,this.__isMultiColumnKeyPressed);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMouseOverHandler = function(event)\r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"TD\");\r\n\t\tthis.__headerMouseMoveRef = this.__headerMouseMoveHandler.bind(this);\r\n\t\tthis.util.addEvent(target,\"mousemove\",this.__headerMouseMoveRef);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMouseOutHandler = function(event)\r\n\t{\r\n\t\tvar target =  this.util.getTarget(event);\r\n\t\ttarget =  this.util.findParent(target,\"TD\");\r\n\t\tthis.__onGridLine = false;\r\n\t\t\r\n\t\tthis.util.removeEvent(target,\"mousemove\",this.__headerMouseMoveRef);\r\n\t\tthis.__headerMouseMoveRef = null;\r\n\t\t/*this.util.removeEvent(target,\"mousedown\",this.__headerMouseDownRef);\r\n\t\tthis.__headerMouseDownRef = null;*/\r\n\t\t\r\n\t\tthis.util.removeStyleClass(target,\"nsResizeHandleActive\");\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMouseMoveHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\ttarget = this.util.findParent(target,\"TD\");\r\n\t\tif(target)\r\n\t\t{\r\n\t\t\tvar objColumn = this.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t\t//var offset = this.util.getEventPosition(event);\r\n\t\t\tif(objColumn && objColumn[\"resizable\"])\r\n\t\t\t{\r\n\t\t\t\tvar posEvent = this.util.getEventPosition(event,this.__divCenterTableHeaderContainer);\r\n\t\t\t\tif(this.__isMouseOnElement(target,posEvent.left,posEvent.top))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addStyleClass(target,\"nsResizeHandleActive\");\r\n\t\t\t\t\tthis.__onGridLine = true;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.removeStyleClass(target,\"nsResizeHandleActive\");\r\n\t\t\t\t\tthis.__onGridLine = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMouseDownHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t    var target = this.util.getTarget(event);\r\n\t    target = this.util.findParent(target,\"TD\");\r\n\t    if(target)\r\n\t\t{\r\n\t    \tvar objColumn = this.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t    if(objColumn)\r\n\t\t\t{\r\n\t\t    \tif(objColumn[\"resizable\"])\r\n\t\t    \t{\r\n\t\t    \t\t//this.__nsGridColumnResize.startResize(event,target);\r\n\t\t    \t}\r\n\t\t    \tif(objColumn[\"draggable\"])\r\n\t\t    \t{\r\n\t\t\t\t   this.__nsGridColumnMove.handle(event,target);\r\n\t\t    \t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMenuClickHandler = function(event)\r\n\t{\r\n\t\t event = this.util.getEvent(event);\r\n\t     event.stopImmediatePropagation();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__bodyCellEventHandler = function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t\tvar target = this.util.getTarget(event);\r\n\t    target = this.util.findParent(target,\"TD\");\r\n\t    if(target)\r\n\t    {\r\n\t    \tvar index = target.cellIndex;\r\n\t\t\tswitch(event.type)\r\n\t\t\t{\r\n\t\t\t\tcase \"mouseover\":\r\n\t\t\t\t\tvar colGroup = document.getElementById(this.getID() + \"BodyColGroup\" + this.__columns[index].dataField);\r\n\t\t\t\t\tthis.util.addStyleClass(colGroup,\"nsGridCellHover\");\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"mouseleave\":\r\n\t\t\t\t\tvar colGroup = document.getElementById(this.getID() + \"BodyColGroup\" + this.__columns[index].dataField);\r\n\t\t\t\t\tthis.util.removeStyleClass(colGroup,\"nsGridCellHover\");\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"click\":\r\n\t\t\t\t\t/*if(this.__lastBodyCellFocus)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.util.removeStyleClass(this.__lastBodyCellFocus,\"nsCellFocus\");\r\n\t\t\t\t\t\tif(this.__enableCellSelection)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar row = this.util.findParent(this.__lastBodyCellFocus,\"TR\");\r\n\t\t\t\t\t\t\tvar rowIndex = this.__getIndexFromRow(this.__lastBodyCellFocus);\r\n\t\t\t\t\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\t\t\t\tthis.__dispatchEvent(NSGrid.CELL_UNSELECTED,item,{cellIndex:this.__lastBodyCellFocus.cellIndex,rowIndex:rowIndex,item:item,cell:this.__lastBodyCellFocus,row:row});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.__lastBodyCellFocus = null;\r\n\t\t\t\t\t}*/\r\n\t\t\t\t\tvar row = this.util.findParent(target,\"TR\");\r\n\t\t\t\t    var rowIndex = this.__getIndexFromRow(row);\r\n\t\t\t\t    var item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\t    this.__dispatchEvent(NSGrid.CELL_CLICKED,item,{cellIndex:index,rowIndex:rowIndex,item:item,cell:target,row:row});\r\n\t\t\t\t    /*if(this.__enableCellSelection)\r\n\t\t\t\t    {\r\n\t\t\t\t    \tthis.util.addStyleClass(target,\"nsCellFocus\");\r\n\t\t\t\t\t\tthis.__dispatchEvent(NSGrid.CELL_SELECTED,item,{cellIndex:index,rowIndex:rowIndex,item:item,cell:target,row:row});\r\n\t\t\t\t\t\tthis.__lastBodyCellFocus = target;\r\n\t\t\t\t    }*/\r\n\t\t\t\tbreak;\r\n\t\t\t\tcase \"dblclick\":\r\n\t\t\t\t\tvar row = this.util.findParent(target,\"TR\");\r\n\t\t\t\t    var rowIndex = this.__getIndexFromRow(row);\r\n\t\t\t\t    var item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\t    this.__dispatchEvent(NSGrid.CELL_DOUBLE_CLICKED,item,{cellIndex:index,rowIndex:rowIndex,item:item,cell:target,row:row});\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getHeaderMenuDataProvider = function(target)\r\n\t{\r\n\t\tvar source = [];\r\n\t\tif(target)\r\n\t\t{\r\n\t\t\ttarget = this.util.findParent(target,\"TD\");\r\n\t\t\tvar objColumn = this.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tvar colIndex = objColumn[this.__fieldColIndex];\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tif(objColumn[\"sortable\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tsource.push({id:\"sort\",title: \"Sort\",children:[{id:\"sortAsc\",title: \"Ascending\"},{id:\"sortDesc\",title: \"Descending\"}]});\r\n\t\t\t\t}\r\n\t\t\t\tif(objColumn[\"draggable\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tsource.push({id:\"pin\",title: \"Pin\",children:[{id:\"pinLeft\",title: \"Left\"},{id:\"pinRight\",title: \"Right\"},{id:\"pinNo\",title: \"No Pin\"}]});\r\n\t\t\t\t}\r\n\t\t\t\tif(objColumn[\"hideable\"] && this.__isColumnValidForSwapOrRemove(colIndex))\r\n\t\t\t\t{\r\n\t\t\t\t\tsource.push({id:\"hideColumn\",title: \"Hide Column\"});\r\n\t\t\t\t}\r\n\t\t\t\tif(objColumn[\"autoSize\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tsource.push({id:\"autoSize\",title: \"Autosize Column\"});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn source;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__headerMenuHandler = function(target,item)\r\n\t{\r\n\t\tif(target && item)\r\n\t\t{\r\n\t\t\ttarget = this.util.findParent(target,\"TD\");\r\n\t\t\tvar objColumn = this.__getColumnObject(target.getAttribute(\"currentColumnIndex\"));\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tvar colIndex = objColumn[this.__fieldColIndex];\r\n\t\t\t\tswitch(item[\"id\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tcase \"sortAsc\":\r\n\t\t\t\t\t\tthis.sortBy(colIndex,true);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"sortDesc\":\r\n\t\t\t\t\t\tthis.sortBy(colIndex,false);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"hideColumn\":\r\n\t\t\t\t\t\tthis.hideColumn(colIndex);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"autoSize\":\r\n\t\t\t\t\t\tthis.autoResizeColumn(colIndex);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"pinLeft\":\r\n\t\t\t\t\t\tthis.pinColumn(colIndex,\"left\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"pinRight\":\r\n\t\t\t\t\t\tthis.pinColumn(colIndex,\"right\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase \"pinNo\":\r\n\t\t\t\t\t\tthis.pinColumn(colIndex,\"no\");\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__rowMouseHover = function(event)\r\n\t{\r\n\t\t event = this.util.getEvent(event);\r\n\t     var target = this.util.getTarget(event);\r\n\t     target = this.util.findParent(target,\"TR\");\r\n\t\t var index = this.__getIndexFromRow(target);\r\n\t\t if(target && index > -1 && this.__isMouseHoverAllowed(index))\r\n\t     {\r\n\t\t\t this.util.addStyleClass(target,\"nsRowHover\");\r\n\t\t\t this.__navigationIndex = index;\r\n\t\t\t var item = this.__getItemByIndex(index);\r\n\t\t\t this.__dispatchEvent(NSGrid.ROW_NAVIGATED,item,{rowIndex:index,item:item,row:target});\r\n\t     }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__rowMouseOut = function(event)\r\n\t{\r\n\t\t var target = this.util.getTarget(event);\r\n\t\t target = this.util.findParent(target,\"TR\");\r\n\t     if(target)\r\n\t     {\r\n\t    \t this.util.removeStyleClass(target,\"nsRowHover\");\r\n\t     }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__rowClickHandler= function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t    var target = this.util.getTarget(event);\r\n\t    target = this.util.findParent(target,\"TR\");\r\n\t    var index = this.__getIndexFromRow(target);\r\n\t    var item = this.__getItemByIndex(index);\r\n\t\tthis.__dispatchEvent(NSGrid.ROW_CLICKED,item,{rowIndex:index,item:item,row:target});\r\n\t\tif(this.__enableRowSelection)\r\n\t\t{\r\n\t\t    this.__setIndex(index,false);\r\n\t\t}\r\n\t    this.__lastNavigationDirection = null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__rowDblClickHandler= function(event)\r\n\t{\r\n\t\tevent = this.util.getEvent(event);\r\n\t    var target = this.util.getTarget(event);\r\n\t    target = this.util.findParent(target,\"TR\");\r\n\t    var index = this.__getIndexFromRow(target);\r\n\t    var item = this.__getItemByIndex(index);\r\n\t\tthis.__dispatchEvent(NSGrid.ROW_DOUBLE_CLICKED,item,{rowIndex:index,item:item,row:target});\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setIndex = function(index,isMultiSelect)\r\n\t{\r\n\t\tif(index > -1)\r\n\t\t{\r\n\t\t\tisMultiSelect = Boolean.parse(isMultiSelect);\r\n\t\t\tif (this.__isShiftPressed && this.__enableMultipleSelection)\r\n\t\t    {\r\n\t\t    \tthis.__multiSectionHandler(index);\r\n\t\t    }\r\n\t\t    else if(isMultiSelect || (this.__isCtrlPressed && this.__enableMultipleSelection))\r\n\t\t    {\r\n\t\t    \tif(this.__isRowSelected(index))\r\n\t\t    \t{\r\n\t\t    \t\tthis.__markRowUnselected(index);\r\n\t\t    \t}\r\n\t\t    \telse\r\n\t\t    \t{\r\n\t\t    \t\tthis.__markRowSelected(index);\r\n\t\t    \t}\r\n\t\t    }\r\n\t\t    else\r\n\t\t    {\r\n\t\t    \tthis.__clearAllRowSelection(false);\r\n\t\t    \tthis.__markRowSelected(index);\r\n\t\t    } \r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__bodyScrollHandler = function(event)\r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\tif(this.__stopScroll)\r\n\t\t{\r\n\t\t\ttarget.scrollLeft = this.__lastScrollPos[0];\r\n\t\t\ttarget.scrollTop = this.__lastScrollPos[1];\r\n\t\t\tconsole.log(this.__stopScroll);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar scrollPos = target.scrollTop;\r\n\t\tvar scrollValue = (target.scrollHeight * this.__bottomPercentageForAddRows) /100;\r\n\t\tif(scrollPos > this.__bodyScrollPos)\r\n\t\t{\r\n\t\t\tif((target.scrollHeight - scrollPos) < scrollValue)\r\n\t\t    {\r\n\t\t\t\tif((this.__isPaginationModeAuto || this.__rowsRendered) && this.__enableAsyncLoadPagination)\r\n\t\t        {\r\n\t\t\t\t\tif(this.__totalRecords > this.__getTotalRows())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.__processArrayAsync)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.__processArrayAsync.stop();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar totalRows = this.__getTotalRows();\r\n\t\t\t\t\t\tthis.__createBodyBody(this.__arrInternalSource,totalRows,totalRows + 20,true);\r\n\t\t\t\t\t}\r\n\t\t        }\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tvar fromRecord =  this.__getTotalRows();\r\n\t\t\t\t\tif(fromRecord === this.__totalRecords)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__rowsRendered = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar toRecord = fromRecord +  this.__pageSize - 1;\r\n\t\t\t\t\t\ttoRecord = (toRecord < this.__totalRecords) ? toRecord : ((toRecord === this.__totalRecords) ? this.__totalRecords - 1 : this.__totalRecords);\r\n\t\t\t\t\t\tthis.__paginationFetchRecordCallBack(fromRecord,toRecord,this.__pageSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t}\r\n\t\tthis.__lastScrollPos = [target.scrollLeft,target.scrollTop];\r\n\t\tthis.__bodyScrollPos = target.scrollTop;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__infiniteScrollEnabler = function(event)\r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\tvar scrollPos = target.scrollTop;\r\n\t\tvar itemToBegin = 0;\r\n\t\tvar tableTop = 0; \r\n\t    if(scrollPos > this.__scrollOffsetPosition)\r\n\t    {\r\n\t    \ttableTop = scrollPos - this.__scrollOffsetPosition;\r\n\t    \titemToBegin = Math.ceil(tableTop/this.__virtualRowHeight);\r\n\t    }\r\n\t    else\r\n\t    {\r\n\t    \ttableTop = 0;\r\n\t    \titemToBegin = 0;\r\n\t    }\r\n\t    return (itemToBegin <= this.__getTotalRows());\r\n\t};\r\n\t\r\n\t/******************************End of Event Listeners*************************************/\r\n\t\r\n\t/******************************************************Start of Selection Functions*************************************************************/\r\n\tNSGrid.prototype.__isMouseHoverAllowed = function(index)\r\n\t{\r\n\t\t/*var item = this.__getItemByIndex(index);\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\treturn !item[this.__fieldDisableHover];\r\n\t\t}*/\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__markRowSelected= function(index)\r\n\t{\r\n\t\tif(index > -1)\r\n\t    {\r\n\t        if(!this.__isRowSelected(index))\r\n\t        {\r\n\t        \tthis.__setMultiSelectedVars(index,true);\r\n\t            this.__setValuesForSelectedRow(index);\r\n\t        \tif(this.__enableVirtualScroll)\r\n\t        \t{\r\n\t        \t\tthis.__virtualRowSelection();\r\n\t        \t}\r\n\t        \telse\r\n\t        \t{\r\n\t        \t\tvar row = this.__getRowByIndex(index);\r\n\t            \tthis.util.addStyleClass(row,this.__CLASS_SELECTED_ROW); \r\n\t        \t}\r\n\t        }\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__markRowUnselected= function(index)\r\n\t{\r\n\t\tif(this.__isRowSelected(index) && this.__isMouseHoverAllowed(index))\r\n\t    {\r\n\t    \tvar isUnselected = this.__setMultiSelectedVars(index,false);\r\n\t        if(isUnselected)\r\n\t        {\r\n\t        \tthis.__setValuesForUnselectedRow(index);\r\n\t        }\r\n\t        if(this.__enableVirtualScroll)\r\n\t    \t{\r\n\t    \t\tthis.__virtualRowSelection();\r\n\t    \t}\r\n\t    \telse\r\n\t    \t{\r\n\t    \t\tvar row = this.__getRowByIndex(index);\r\n\t    \t\tthis.util.removeStyleClass(row,this.__CLASS_SELECTED_ROW);\r\n\t    \t}\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setValuesForSelectedRow = function(index)\r\n\t{\r\n\t\tif(index > -1 && this.__isMouseHoverAllowed(index))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldSelected] = true;\r\n\t\t\t    this.__selectedIndex = index;\r\n\t\t\t    this.__navigationIndex = index;\r\n\t\t\t    this.__dispatchEvent(NSGrid.ROW_SELECTED,item,{index:index});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setValuesForUnselectedRow = function(index)\r\n\t{\r\n\t\tif(index > -1 && this.__isMouseHoverAllowed(index))\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\titem[this.__fieldSelected] = false;\r\n\t\t\t\tthis.__dispatchEvent(NSGrid.ROW_UNSELECTED,item,{index:index});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__virtualRowSelection = function()\r\n\t{\r\n\t\tvar arrRows = this.__getAllBodyRows();\r\n\t\tif(arrRows && arrRows.length > 0 && this.__arrInternalSource)\r\n\t\t{\r\n\t\t\tvar row = null;\r\n\t\t\tvar index = null;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = 0; count < arrRows.length; count++) \r\n\t\t\t{\r\n\t\t\t\trow = arrRows[count];\r\n\t\t\t\tindex = this.__getIndexFromRow(row);\r\n\t\t\t\titem = this.__getItemByIndex(index);\r\n\t\t\t\tif(item && this.__isMouseHoverAllowed(index))\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item[this.__fieldSelected])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//DONOT REPLACE WITH __markRowSelected\r\n\t\t\t\t\t\tthis.util.addStyleClass(row,this.__CLASS_SELECTED_ROW); \r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//DONOT REPLACE WITH __markRowUnselected\r\n\t\t\t\t\t\tthis.util.removeStyleClass(row,this.__CLASS_SELECTED_ROW);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__clearAllRowSelection= function(setIndexVariables)\r\n\t{\r\n\t\tvar size = this.__selectedIndexes.length;\r\n\t    for (var count = size - 1; count >= 0 ; count--)\r\n\t    {\r\n\t    \tvar index = this.__selectedIndexes[count];\r\n\t        this.__markRowUnselected(index);\r\n\t    }\r\n\t    this.__setMultiSelectedVars(-1,true);\r\n\t    if(setIndexVariables)\r\n\t    {\r\n\t    \tthis.__selectedIndex = -1;\r\n\t        this.__navigationIndex = -1;\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__tableCellNavigatorEventHandler = function(event)\r\n\t{\r\n\t\tswitch(event.type)\r\n\t\t{\r\n\t\t\tcase NSTableCellNavigator.CELL_SELECTED:\r\n\t\t\t\tvar cell = event.cell;\r\n\t\t\t\tthis.util.addStyleClass(cell,\"nsCellFocus\");\r\n\t\t\t\tvar row = event.row;\r\n\t\t\t    var rowIndex = this.__getIndexFromRow(row);\r\n\t\t\t    var item = this.__getItemByIndex(rowIndex);\r\n\t\t\t    this.__dispatchEvent(NSGrid.CELL_SELECTED,item,{cellIndex:event.cellIndex,rowIndex:rowIndex,item:item,cell:cell,row:row});\r\n\t\t\tbreak;\r\n\t\t\tcase NSTableCellNavigator.CELL_UNSELECTED:\r\n\t\t\t\tvar cell = event.cell;\r\n\t\t\t\tthis.util.removeStyleClass(cell,\"nsCellFocus\");\r\n\t\t\t\tvar row = event.row;\r\n\t\t\t\tvar rowIndex = this.__getIndexFromRow(row);\r\n\t\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\tthis.__dispatchEvent(NSGrid.CELL_UNSELECTED,item,{cellIndex:event.cellIndex,rowIndex:rowIndex,item:item,cell:cell,row:row});\r\n\t\t\tbreak;\r\n\t\t\tcase NSTableCellNavigator.CELL_SELECTABLE:\r\n\t\t\t\t//var cell = event.cell;\r\n\t\t\t\t//var row = event.row;\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__tableCellSelectionEventHandler = function(event)\r\n\t{\r\n\t\tswitch(event.type)\r\n\t\t{\r\n\t\t\tcase NSCellSelection.SELECTION_START:\r\n\t\t\t\tconsole.debug(\"Selection Started\");\r\n\t\t\tbreak;\r\n\t\t\tcase NSCellSelection.SELECTION_END:\r\n\t\t\t\tconsole.debug(\"Selection Ended with cells \" + event.selectedCells);\r\n\t\t\tbreak;\r\n\t\t\tcase NSCellSelection.SET_CELL_VALUE:\r\n\t\t\t\tvar cellIndex = event.cellIndex;\r\n\t\t\t\tvar cell = event.cell;\r\n\t\t\t\tvar row = event.row;\r\n\t\t\t\tvar dataToBeSet = event.dataToBeSet;\r\n\t\t\t\tvar rowIndex = this.__getIndexFromRow(row);\r\n\t\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\t\t\tif(headerBodyRow)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar headerCell = headerBodyRow.cells[cellIndex];\r\n\t\t\t\t\tvar columnDetail = this.__getColumnObject(headerCell.getAttribute(\"currentColumnIndex\"));\r\n\t\t\t\t\tif(item && columnDetail)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[columnDetail[\"dataField\"]] = dataToBeSet;\r\n\t\t\t\t\t\tthis.updateItemInDataSource(item);\r\n\t\t\t\t\t\tthis.__updateCellText(row,cell,item,columnDetail,rowIndex,columnDetail[self.__fieldColIndex]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__resetPluggins = function()\r\n\t{\r\n\t\t//this.__nsGridSort.resetVariables();\r\n\t\t//this.__nsGridColumnMove = new NSGridColumnMove(this);\r\n\t\tif(this.__nsGridFilter)\r\n\t\t{\r\n\t\t\tthis.__nsGridFilter.resetVariables();\r\n\t\t}\r\n\t\tif(this.__nsGridEditor)\r\n\t\t{\r\n\t\t\tthis.__nsGridEditor.resetVariables();\r\n\t\t}\r\n\t\t//this.__nsToolTipInElement = new this.util.nsToolTipInElement();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__callPlugginsInitialize = function()\r\n\t{\r\n\t\tif(this.__nsGridEditor)\r\n\t\t{\r\n\t\t\tthis.__nsGridEditor.initialize();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__multiSectionHandler= function(lastIndex)\r\n\t{\r\n\t\t if(!lastIndex)\r\n\t\t {\r\n\t\t\t return;\r\n\t\t }\r\n\t\t if (this.__selectedItems.length === 0)\r\n\t\t {\r\n\t\t\t this.__isRowSelected(lastIndex);\r\n\t\t     return;\r\n\t\t }\r\n\t\t var firstIndex = this.__selectedIndexes[this.__selectedIndexes.length - 1];\r\n\t\t if(lastIndex === firstIndex)\r\n\t\t {\r\n\t\t\t this.__markRowUnselected(lastIndex);\r\n\t\t\t return;\r\n\t\t }\r\n\t\t var isDown = lastIndex > firstIndex;\r\n\t\t var isSelection = !this.__isRowSelected(lastIndex);\r\n\t\t var counter = firstIndex;\r\n\t\t do\r\n\t\t {\r\n\t\t\t  counter = isDown ? (counter + 1) : (counter - 1);\r\n\t\t\t  if (isSelection)\r\n\t\t\t  {\r\n\t\t\t\t  this.__markRowSelected(counter);\r\n\t\t\t  }\r\n\t\t\t  else\r\n\t\t\t  {\r\n\t\t\t\t  this.__markRowUnselected(counter);\r\n\t\t\t  }\r\n\t\t }\r\n\t\t while(counter != lastIndex);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setMultiSelectedVars = function(index,add)\r\n\t{\r\n\t\tif(index === -1)\r\n\t\t{\r\n\t\t\tthis.__selectedItems = [];\t\r\n\t\t\tthis.__selectedIndexes = [];\t\r\n\t\t}\r\n\t\telse if(add)\r\n\t\t{\r\n\t\t\tvar data = this.__getItemByIndex(index);\r\n\t\t\tthis.__selectedItems.push(data);\r\n\t\t\tthis.__selectedIndexes.push(index);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar isUnselected = false;\r\n\t\t\tfor (var count= 0; count < this.__selectedIndexes.length ; count++)\r\n\t        {\r\n\t            if (this.__selectedIndexes[count] === index)\r\n\t            {\r\n\t                this.__selectedItems.splice(count,1);\r\n\t                this.__selectedIndexes.splice(count,1);\r\n\t                isUnselected = true;\r\n\t                break;\r\n\t            }\r\n\t        }\r\n\t\t\treturn isUnselected;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isRowSelected= function(index)\r\n\t{\r\n\t\tif(index > -1)\r\n\t    {\r\n\t    \tvar item = this.__getItemByIndex(index);\r\n\t    \tif(item)\r\n\t    \t{\r\n\t    \t\treturn item[this.__fieldSelected];\r\n\t    \t}\r\n\t    }   \r\n\t    return false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setVisibilityOfColumn = function(index,isVisible)\r\n\t{\r\n\t\tvar style;\r\n\t    if (isVisible) \r\n\t    {\r\n\t    \tstyle = \"\";\r\n\t    }\r\n\t    else\r\n\t    {\r\n\t    \tstyle = \"none\";\r\n\t    }\r\n\t\tvar rows = this.__tblCenterHeader.getElementsByTagName(\"tr\");\r\n\t\tfor (var count = 0; count < rows.length;count++) \r\n\t\t{\r\n\t\t     var cells = rows[count].cells;\r\n\t\t     if(cells.length > index)\r\n\t\t     {\r\n\t\t    \t cells[index].style.display = style;\r\n\t\t     }\r\n\t\t     else\r\n\t\t     {\r\n\t\t    \t return;\r\n\t\t     }\r\n\t\t}\r\n\t\trows = this.__tblCenterBody.getElementsByTagName(\"tr\");\r\n\t\tfor (var count = 0; count < rows.length;count++) \r\n\t\t{\r\n\t\t     var cells = rows[count].cells;\r\n\t\t     cells[index].style.display = style;\r\n\t\t}\r\n\t\t\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__keyDownHandler = function(event)\r\n\t{\r\n\t\tif(this.hasFocus())\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tif(this.__enableMultiSort)\r\n\t\t\t{\r\n\t\t\t\tthis.__isMultiColumnKeyPressed = event[this.__multiColumnKey + \"Key\"];\r\n\t\t\t}\r\n\t\t\tthis.__isShiftPressed = event.shiftKey;\r\n\t\t\tthis.__isCtrlPressed = event.ctrlKey;\r\n\t\t\tvar isShiftCtrlPressed = this.__isShiftPressed || this.__isCtrlPressed;\r\n\t\t\tvar keyCode = this.util.getKeyUnicode(event);\r\n\t\t\tif(this.__enableKeyboardNavigation)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGridKeyboard.keyDownHandler(event,keyCode);\r\n\t\t\t}\r\n\t\t\tif(keyCode === this.util.KEYCODE.SHIFT)\r\n\t\t\t{\r\n\t\t\t\tthis.util.makeBodyUnselectable();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__keyUpHandler = function(event)\r\n\t{\r\n\t\tif(this.util.getKeyUnicode(event) === this.util.KEYCODE.CTRL)\r\n\t\t{\r\n\t\t\tthis.__isCtrlPressed = false;\r\n\t\t}\r\n\t\tif(this.util.getKeyUnicode(event) === this.util.KEYCODE.SHIFT)\r\n\t\t{\r\n\t\t\tthis.__isShiftPressed = false;\r\n\t\t\tthis.util.makeBodySelectable();\r\n\t\t}\r\n\t\tif(this.util.getKeyUnicode(event) === this.util.KEYCODE[this.__multiColumnKey.toUpperCase()] && this.__enableMultiSort)\r\n\t\t{\r\n\t\t\tthis.__isMultiColumnKeyPressed = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\t/******************************************************End of Selection Functions*************************************************************/\r\n\t/******************************************************Start of Filter Logic*************************************************************/\r\n\tNSGrid.prototype.__highlightDiv = function(divText,colIndex)\r\n\t{\r\n\t\tthis.__nsGridFilter.__highlightDiv(divText,colIndex);\r\n\t};\r\n\t/******************************************************End of Filter Logic*************************************************************/\r\n\t/******************************************************Start of Context Menu*************************************************************/\r\n\t\r\n\tNSGrid.prototype.__initializeContextMenu = function()\r\n\t{\r\n\t\t//if(!this.__contextMenu)\r\n\t\t//{\r\n\t\t\tvar contextMenuSetting = {parent:this.__tblCenterBody,isContextMenu:true,createRunTime:true,sourceProvider:this.__getContextMenuDataProvider.bind(this),targetType:\"TD\"};\r\n\t\t\tif(this.__contextMenuSetting)\r\n\t\t\t{\r\n\t\t\t\tfor(var key in this.__contextMenuSetting)\r\n\t\t\t\t{\r\n\t\t\t\t\t//grid setting should not be overriden by the users\r\n\t\t\t\t\tif(!contextMenuSetting[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontextMenuSetting[key] = this.__contextMenuSetting[key];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__contextMenu = new NSMenu(contextMenuSetting);\r\n\t\t//}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getContextMenuDataProvider = function(cell)\r\n\t{\r\n\t\tif(cell)\r\n\t\t{\r\n\t\t\tcell = this.util.findParent(cell,\"TD\");\r\n\t\t\tif(cell)\r\n\t\t\t{\r\n\t\t\t\tvar row = this.util.findParent(cell,\"TR\");\r\n\t\t\t\tif(row)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar index = parseInt(row.getAttribute(\"ns-index\"));\r\n\t\t\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\t\t\tif(item && this.__contextMenuProvider) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn this.__contextMenuProvider(item,cell.cellIndex,index);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t/******************************************************End of Context Menu*************************************************************/\r\n\t/******************************Custom Function *************************************/\r\n\t\r\n\tNSGrid.prototype.__createTableAndParent = function(containerID,containerStyle,tableID)\r\n\t{\r\n\t\tvar divTableContainer = this.util.createDiv(containerID,containerStyle); \r\n\t\tvar table = document.createElement(\"TABLE\");\r\n\t\ttable.setAttribute(\"id\",tableID);\r\n\t\tthis.util.addStyleClass(table , this.__CLASS_TABLE);\r\n\t\tthis.util.addStyleClass(table , \"nsDataGridTableTheme\");\r\n\t\tdivTableContainer.appendChild(table);\r\n\t\treturn divTableContainer;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setMeasurement = function()\r\n\t{\r\n\t\tthis.__bodyScrollPos = 0;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addListenerForBody = function()\r\n\t{\r\n\t\tif(!this.__keyDownRef)\r\n\t\t{\r\n\t\t\tthis.__keyDownRef = this.__keyDownHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document,\"keydown\",this.__keyDownRef);\r\n\t\t}\r\n\t\tif(!this.__keyUpRef)\r\n\t\t{\r\n\t\t\tthis.__keyUpRef = this.__keyUpHandler.bind(this);\r\n\t\t\tthis.util.addEvent(document,\"keyup\",this.__keyUpRef);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setBodyMeasurement = function()\r\n\t{\r\n\t\tvar divTitleBar = this.util.getElement(this.getID() + this.__TITLE_CONTAINER_ID);\r\n\t\tvar divPagination = this.util.getElement(this.getID() + this.__PAGINATION_CONTROL_ID);\r\n\t\tvar topHeight = this.__divCenterTableHeaderContainer.offsetHeight;\r\n\t\tif(divTitleBar)\r\n\t\t{\r\n\t\t\ttopHeight += divTitleBar.offsetHeight;\r\n\t\t}\r\n\t\tif(divPagination)\r\n\t\t{\r\n\t\t\ttopHeight += divPagination.offsetHeight;\r\n\t\t}\r\n\t\tvar containerHeight = this.__divOuterContainer.offsetHeight;\r\n\t\tvar containerWidth = this.__divOuterContainer.offsetWidth;\r\n\t\tvar bodyContainerHeight = containerHeight - topHeight;\r\n\t\tthis.__divCenterTableBodyContainer.style.height = bodyContainerHeight + \"px\";\r\n\t\tvar scrollBarWidth = this.util.getScrollBarWidth(this.__divCenterTableBodyContainer);\r\n\t\tthis.__divCenterTableHeaderContainer.style.width = (this.__divCenterTableBodyContainer.offsetWidth - scrollBarWidth) + \"px\";\r\n\t\tthis.__initialTableWidth = containerWidth - scrollBarWidth;\r\n\t\tif(!this.__synchronizeTablesRef)\r\n\t\t{\r\n\t\t\tthis.__synchronizeTablesRef = this.__synchronizeTables.bind(this);\r\n\t\t\tthis.util.addEvent(this.__getHorizontalScrollableContainer(),\"scroll\",this.__synchronizeTablesRef);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__alignTables = function(fromSort)\r\n\t{\r\n\t\tvar getCells = function(tbl)\r\n\t\t{\r\n\t\t\tif(tbl && tbl.tHead && tbl.tHead.rows.length > 0)\r\n\t\t\t{\r\n\t\t\t\treturn tbl.tHead.rows[0].cells;\r\n\t\t\t}\r\n\t\t\treturn [];\r\n\t\t};\r\n\t\tvar setCellWidth = function(arrCells,index,setWidth)\r\n\t\t{\r\n\t\t\tarrCells[index].style.width = setWidth + \"px\";\r\n\t\t};\r\n\t\tvar headerCells = getCells(this.__tblCenterHeader);\r\n\t\tvar bodyCells = getCells(this.__tblCenterBody);\r\n\t\tvar footerCells = getCells(this.__tblCenterFooter);\r\n\t\tif(headerCells && headerCells.length > 0 && bodyCells && bodyCells.length > 0)\r\n\t\t{\r\n\t\t\tvar totalWidth = 0;\r\n\t\t\tvar count = 0;\r\n\t\t\tvar widthToBeSet = 0;\r\n\t\t\tvar self = this;\r\n\t\t\tvar setWidths = function()\r\n\t\t\t{\r\n\t\t\t\ttotalWidth += widthToBeSet;\r\n\t\t\t\tsetCellWidth(headerCells,count,widthToBeSet);\r\n\t\t\t\tsetCellWidth(bodyCells,count,widthToBeSet);\r\n\t\t\t\t(footerCells && footerCells.length > 0) ? setCellWidth(footerCells,count,widthToBeSet) : null;\r\n\t\t\t};\r\n\t\t\tvar setTotalCellWidth = function(arrCells)\r\n\t\t\t{\r\n\t\t\t\tfor(count = 0;count < arrCells.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar cell = arrCells[count];\r\n\t\t\t\t\tvar item = self.__columns[count];\r\n\t\t\t\t\twidthToBeSet = self.util.getDimensionAsNumber(cell,cell.style.width);\r\n\t\t\t\t\tif(widthToBeSet === 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\twidthToBeSet = cell.getBoundingClientRect().width;//cell.offsetWidth;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!item.hasOwnProperty(self.__fieldColVisible) || item[self.__fieldColVisible])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsetWidths();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tif(fromSort)\r\n\t\t\t{\r\n\t\t\t\tsetTotalCellWidth(headerCells);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tsetTotalCellWidth(bodyCells);\r\n\t\t\t}\r\n\t\t\tif(this.__fillParentWidth && this.__initialTableWidth > totalWidth)\r\n\t\t\t{\r\n\t\t\t\ttotalWidth = this.__initialTableWidth;\r\n\t\t\t}\r\n\t\t\tthis.__setTableWidth(totalWidth); \r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__synchronizeTables = function(event) \r\n\t{\r\n\t\tvar target = this.util.getTarget(event);\r\n\t\t//if(this.__scroller)\r\n\t\t//{\r\n\t\t//\tthis.__divCenterTableHeaderContainer.scrollLeft = event.scrollLeft;\r\n\t\t//}\r\n\t\t//else\r\n\t\t//{\r\n\t\t\t\r\n\t\t\tthis.__divCenterTableHeaderContainer.scrollLeft = target.scrollLeft;\r\n\t\t\t(target != this.__divCenterTableBodyContainer) ? this.__divCenterTableBodyContainer.scrollLeft = target.scrollLeft : null;\r\n\t\t\t//console.log(target.id + \",\" + target.scrollLeft + \",\" + this.__divCenterTableHeaderContainer.scrollLeft);\r\n\t\t\t//console.log(target.scrollLeft + \",\" + );\r\n\t\t//}\r\n\t\tif(this.__enableFixedColumnAnimation)\r\n\t\t{\r\n\t\t\tif(this.__fixedTimerTimeout != -1)\r\n\t\t\t{\r\n\t\t\t\tclearTimeout(this.__fixedTimerTimeout);\r\n\t\t\t\tthis.__fixedTimerTimeout = -1;\r\n\t\t\t}\r\n\t\t\tvar self = this;\r\n\t\t\tthis.__fixedTimerTimeout = setTimeout(function()\r\n\t\t\t{ \r\n\t\t\t\t//self.__setFixedCellsPosition.bind(self)();\r\n\t\t\t},250);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//this.__setFixedCellsPosition();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setTableWidth = function(totalWidth) \r\n\t{\r\n\t\tvar setWidth = function(tbl)\r\n\t\t{\r\n\t\t\ttbl ? tbl.style.width = totalWidth : null;\r\n\t\t};\r\n\t\tif(this.util.isUndefinedOrNull(totalWidth))\r\n\t\t{\r\n\t\t\ttotalWidth = null;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttotalWidth = totalWidth + \"px\";\r\n\t\t}\r\n\t\tsetWidth(this.__tblCenterHeader);\r\n\t\tsetWidth(this.__tblCenterBody);\r\n\t\tsetWidth(this.__tblCenterFooter);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__expandCollapseAll = function(isCollapse)\r\n\t{\r\n\t\tif(!this.__enableVirtualScroll && this.__getTotalRows() < this.__totalRecords)\r\n\t\t{\r\n\t\t\tthis.util.warning(\"NSGrid\",\"Please let all the rows to render.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar dataSource = this.__arrInternalSource;\r\n\t\tif(dataSource && dataSource.length > 0)\r\n\t\t{\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__setCustomScrollBarScrollTop(0);\r\n\t\t\t}\r\n\t\t\tif(this.__getVerticalScrollableContainer())\r\n\t\t\t{\r\n\t\t\t\tthis.__getVerticalScrollableContainer().scrollTop = 0;\r\n\t\t\t}\r\n\t\t    this.__lastScrollPos = [0,0];\r\n\t\t    this.__lastScrollPosition = 0;\r\n\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t{\r\n\t\t\t\tthis.__expandCollapseAllVirtual(dataSource,isCollapse);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__expandCollapseAllNormal(dataSource,isCollapse);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__expandCollapseAllNormal = function(dataSource,isCollapse)\r\n\t{\r\n\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t{\r\n\t\t\tvar item = dataSource[count];\r\n\t\t\t//setting __fieldIsCollapsed here assuming that __showHideAllArrows() will be called after this function\r\n\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\tif(parseInt(item[this.__fieldRowLevel]) > 0)\r\n\t\t\t{\r\n\t\t\t\tvar row = item[this.__fieldRow];\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"none\";\r\n\t\t\t\t\titem[this.__fieldRowVisible] = false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"\";\r\n\t\t\t\t\titem[this.__fieldRowVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.__objGrid.expandCollapseHandler(item,isCollapse);\r\n\t\t}\r\n\t\tthis.__showHideAllArrows(isCollapse);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__expandCollapseAllVirtual = function(dataSource,isCollapse)\r\n\t{\r\n\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t{\r\n\t\t\tvar item = dataSource[count];\r\n\t\t\t//setting __fieldIsCollapsed here assuming that __showHideAllArrows() will be called after this function\r\n\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\tif(parseInt(item[this.__fieldRowLevel]) > 0)\r\n\t\t\t{\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__fieldRowVisible] = false;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\titem[this.__fieldRowVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//this.__objGrid.expandCollapseHandler(item,isCollapse);\r\n\t\t}\r\n\t\tthis.__showHideAllArrows(isCollapse);\r\n\t\tthis.__updateVisibleIndex(null,0);\r\n\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t\tfor(var count = 0;count < dataSource.length;count++)\r\n\t\t{\r\n\t\t\tvar item = dataSource[count];\r\n\t\t\tthis.__objGrid.expandCollapseHandler(item,isCollapse);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__showHideRow = function(rowIndex,compArrow,isCollapse)\r\n\t{\r\n\t\tif(rowIndex > 0)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(rowIndex);\r\n\t\t\tif(!compArrow)\r\n\t\t\t{\r\n\t\t\t\tcompArrow = this.__getArrow(item[this.__fieldIndex]);\r\n\t\t\t}\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldRowLevel]);\r\n\t\t\tvar arrChildItems = [];\r\n\t\t\tif(item && item[this.__fieldHasChild])\r\n\t\t\t{\r\n\t\t\t\tvar startIndex = 0;\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildItems = this.__arrInternalSource;\r\n\t\t\t\t\tstartIndex = rowIndex;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildItems = this.__getImmediateChildItems(arrChildItems, item);\r\n\t\t\t\t}\r\n\t\t\t\tif(this.__enableVirtualScroll)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__showHideRowVirtual(item,arrChildItems,startIndex,rowLevel,isCollapse);\r\n\t\t\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\t\t\t//this.__updateItemInSource(item);\r\n\t\t\t\t\tthis.__setNSVirtualScroll(this.__arrInternalSource);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__showHideRowNormal(item,arrChildItems,startIndex,rowLevel,isCollapse);\r\n\t\t\t\t\tthis.__setArrowDirection(compArrow,isCollapse);\r\n\t\t\t\t\titem[this.__fieldIsCollapsed] = isCollapse;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__showHideRowNormal = function(item,arrChildItems,startIndex,rowLevel,isCollapse)\r\n\t{\r\n\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t{\r\n\t\t\tif(isCollapse)\r\n\t\t\t{\r\n\t\t\t\tvar retIndex = this.__getActualIndex(arrChildItems,startIndex);\r\n\t\t\t\tif(retIndex !== startIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar rowItem = null;\r\n\t\t\tfor(var count = startIndex;count < arrChildItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\trowItem = arrChildItems[count];\r\n\t\t\t\tvar row = rowItem[this.__fieldRowHtml];\r\n\t\t\t\tif(!row)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__createBodyRowAt(rowItem,rowItem[this.__fieldIndex]);\r\n\t\t\t\t\trow = rowItem[this.__fieldRowHtml];\r\n\t\t\t\t\tthis.__updateSourceIndex();\r\n\t\t\t\t}\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLevel >= parseInt(rowItem[this.__fieldRowLevel]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trow.style.display = \"none\";\r\n\t\t\t\t\trowItem[this.__fieldRowVisible] = false;\r\n\t\t\t\t\tif(rowItem[this.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trowItem[this.__fieldIsCollapsed] = true;\r\n\t\t\t\t\t\tif(rowItem[this.__fieldRowArrow])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar divArrow = rowItem[this.__fieldRowArrow];\r\n\t\t\t\t\t\t\tif(divArrow)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tthis.__setArrowDirection(divArrow,true);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trow.style.display = \"\";\r\n\t\t\t\t\trowItem[this.__fieldRowVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__showHideRowVirtual = function(item,arrChildItems,startIndex,rowLevel,isCollapse)\r\n\t{\r\n\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t{\r\n\t\t\tif(isCollapse)\r\n\t\t\t{\r\n\t\t\t\tvar retIndex = this.__getActualIndex(arrChildItems,startIndex);\r\n\t\t\t\tif(retIndex !== startIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar rowItem = null;\r\n\t\t\tfor(var count = startIndex;count < arrChildItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\trowItem = arrChildItems[count];\r\n\t\t\t\tif(isCollapse)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rowLevel >= parseInt(rowItem[this.__fieldRowLevel]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\trowItem[this.__fieldRowVisible] = false;\r\n\t\t\t\t\tif(rowItem[this.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trowItem[this.__fieldIsCollapsed] = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\trowItem[this.__fieldRowVisible] = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t//this.__updateVisibleIndex(null,index - 1);\r\n\t\t\t//done the below for MasterDetail Grid .. if there is an issue in Hierarchical or Grouping Grid while filtering then use a callback to get the index like afterFilter which we will override only for MasterDetailGrid with the below condition\r\n\t\t\t//var sendIndex = (index % 2) == 0 ? index : index - 1;\r\n\t\t\t//this.__updateVisibleIndex(null,sendIndex);\r\n\t\t\tthis.__updateVisibleIndex(null,index);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__showHideAllArrows = function(isCollapse)\r\n\t{\r\n\t\tvar arrDivs = this.__getAllArrows();\r\n\t\tif(arrDivs && arrDivs.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrDivs.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar div = arrDivs[count];\r\n\t\t\t\tif(div && div.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__setArrowDirection(div,isCollapse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isNodeLastParent = function(item)\r\n\t{\r\n\t\tvar retValue = false;\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChildItems = item[this.__childField];\r\n\t\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t\t{\r\n\t\t\t\tvar hasChild = false;\r\n\t\t\t\tfor(var count = 0;count < arrChildItems.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar rowItem = arrChildItems[count];\r\n\t\t\t\t\tif(rowItem && rowItem[this.__fieldHasChild])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thasChild = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!hasChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tretValue = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateSourceIndex = function(source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__getAllItems();\r\n\t\t}\r\n\t\tvar item = null;\r\n\t\tvar row = null;\r\n\t\tvar length = source.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\titem = source[count];\r\n\t\t\tvar index = (this.__enableHierarchical || this.__enableGrouping || this.__enableMasterDetail) ? (count + 1) : count;\r\n\t\t\titem[this.__fieldIndex] = index;\r\n\t\t\trow = item[this.__fieldRowHtml];\r\n\t\t\tif(row && this.util.isElementOfType(row,\"tr\"))\r\n\t\t\t{\r\n\t\t\t\trow.setAttribute(\"ns-index\",index);\r\n\t\t\t\tvar compArrow = row.querySelector(\".nsArrow\");\r\n\t\t\t\tif(compArrow)\r\n\t\t\t\t{\r\n\t\t\t\t\tcompArrow.setAttribute(\"ns-parent-row-count\",index);\r\n\t\t\t\t\tvar arrowID = this.getID() + \"compArrow\" + index;\r\n\t\t\t\t\tcompArrow.setAttribute(\"id\",arrowID);\r\n\t\t\t\t\tvar compSvg = compArrow.querySelector(\"svg\");\r\n\t\t\t\t\tif(compSvg)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar svgID = arrowID + \"svg\";\r\n\t\t\t\t\t\tcompSvg.setAttribute(\"id\",svgID);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar compUse = compArrow.querySelector(\"use\");\r\n\t\t\t\t\tif(compUse)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar useID = arrowID + \"use\";\r\n\t\t\t\t\t\tcompUse.setAttribute(\"id\",useID);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__applyCustomClass = function(element,type)\r\n\t{\r\n\t\tif(this.__customClass && element && type)\r\n\t\t{\r\n\t\t\tvar itemProperty = {\"outerContainer\":{property:\"outerContainer\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"titleBar\":{property:\"titleBar\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"headerRow\":{property:\"headerRow\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"headerCell\":{property:\"headerCell\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"filterRow\":{property:\"filterRow\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"filterCell\":{property:\"filterCell\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"bodyRow\":{property:\"bodyRow\",defaultValue:null},\r\n\t\t\t\t\t\t\t    //for Hierarchies and Grouping grid\r\n\t\t\t\t\t\t\t    \"firstBodyColumn\":{property:\"firstBodyColumn\",defaultValue:null},\r\n\t\t\t\t\t\t\t    \"nonFirstBodyColumn\":{property:\"nonFirstBodyColumn\",defaultValue:null}\r\n\t\t\t\t\t\t\t   };\r\n\t\t\tif(itemProperty[type])\r\n\t\t\t{\r\n\t\t\t\tif(this.__customClass[itemProperty[type][\"property\"]])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addStyleClass(element,this.__customClass[itemProperty[type][\"property\"]]);\r\n\t\t\t\t}\r\n\t\t\t\telse if(itemProperty[type][\"defaultValue\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.addStyleClass(element,itemProperty[type][\"defaultValue\"]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addCellText = function(row,item,div,colItem,colIndex)\r\n\t{\r\n\t\tif(item && div && colItem)\r\n\t\t{\r\n\t\t\tvar dataField = colItem[\"dataField\"];\r\n\t\t\tvar templateRenderer = colItem[\"templateRenderer\"];\r\n\t\t\tvar setData = colItem[\"setData\"];\r\n\t\t\tvar itemRenderer = colItem[\"itemRenderer\"];\r\n\t\t\tvar labelFunction = colItem[\"labelFunction\"];\r\n\t\t\tvar groupRenderer = colItem[\"groupRenderer\"];\r\n\t\t\tvar truncateToFit = colItem[\"truncateToFit\"];\r\n\t\t\tvar toolTipField = colItem[\"toolTipField\"];\r\n\t\t\tvar toolTipRenderer = colItem[\"toolTipRenderer\"];\r\n\t\t\tvar toolTipText = null;\r\n\t\t\tvar isGroupedParent = (this.__enableGrouping && item[this.__isParentRowField]);\r\n\t\t\t//for Grouping\r\n\t\t\tif(isGroupedParent && groupRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar arrAllChildItems = this.__getAllChildItemsForGroup(null,item);\r\n\t\t\t\tvar objRenderer = groupRenderer(item,dataField,item[this.__fieldIndex],colIndex,row,item[this.__childField],item[this.__objGrid.__childrenCountField],arrAllChildItems,parseInt(item[this.__fieldRowLevel]) + 1);\r\n\t\t\t\tvar callback = function(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar compBodySpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\tcompBodySpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\tdiv.appendChild(compBodySpan);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdiv.appendChild(objRenderer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(objRenderer,callback.bind(this));\r\n\t\t\t}\r\n\t\t\telse if(!isGroupedParent && itemRenderer)\r\n\t\t\t{\r\n\t\t\t\tvar objRenderer = itemRenderer(item,dataField,item[this.__fieldIndex],colIndex,row);\r\n\t\t\t\tvar callback = function(objRenderer)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objRenderer)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(this.util.isString(objRenderer))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar compBodySpan = document.createElement(\"span\");\r\n\t\t\t\t\t\t\tcompBodySpan.innerHTML = objRenderer;\r\n\t\t\t\t\t\t\tdiv.appendChild(compBodySpan);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdiv.appendChild(objRenderer);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tthis.util.resolveFunctionOrPromise(objRenderer,callback.bind(this));\r\n\t\t\t}\r\n\t\t\telse if(!isGroupedParent && templateRenderer)\r\n\t\t\t{\r\n\t\t\t\tdiv.appendChild(templateRenderer.cloneNode(true));\r\n\t\t\t\tthis.__setDataInTemplateRenderer(div,item,dataField,setData,colItem,row);\r\n\t\t\t}\r\n\t\t\telse if(!isGroupedParent && labelFunction)\r\n\t\t\t{\r\n\t\t\t\tvar text = labelFunction(item,dataField,colItem);\r\n\t\t\t\tdiv.appendChild(document.createTextNode(text));\r\n\t\t\t}\r\n\t\t\telse if(item.hasOwnProperty(dataField) && !this.util.isUndefined(item[dataField]) && item[dataField] != null)\r\n\t\t    {\r\n\t\t\t\tvar text = item[dataField];\r\n\t\t\t\tdiv.appendChild(document.createTextNode(text));\r\n\t\t    }\r\n\t\t\telse if(dataField)\r\n\t\t    {\r\n\t\t\t\tvar text = null;\r\n\t\t\t\tif(dataField.includes(\".\")) \r\n\t\t\t\t{\r\n\t\t\t\t\ttext = this.util.getValueByKeys(item,dataField);\r\n\t\t\t\t}\r\n\t\t\t\telse if(item.hasOwnProperty(dataField)) \r\n\t\t\t\t{\r\n\t\t\t\t\ttext = item[dataField];\r\n\t\t\t\t}\r\n\t\t\t\tif(text)\r\n\t\t\t\t{\r\n\t\t\t\t\tdiv.appendChild(document.createTextNode(text));\r\n\t\t\t\t}\r\n\t\t    }\r\n\t\t\tthis.__highlightDiv(div,colIndex);\r\n\t\t\tif(toolTipField)\r\n\t\t\t{\r\n\t\t\t\ttoolTipText = item[toolTipField];\r\n\t\t\t}\r\n\t\t\telse if(toolTipRenderer)\r\n\t\t\t{\r\n\t\t\t\ttoolTipText = toolTipRenderer(item,dataField,item[this.__fieldIndex],colIndex,row);\r\n\t\t\t}\r\n\t\t\tif(truncateToFit)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addStyleClass(div,\"nsTruncateToFit\");\r\n\t\t\t\t//This condition is above so that toolTip and title are not set togeather\r\n\t\t\t\tif(!toolTipText || toolTipText === \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__enableToolTipForTruncateText)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttoolTipText = div.textContent;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdiv.setAttribute(\"title\",div.textContent);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar callback = function(toolTipText)\r\n\t\t\t{\r\n\t\t\t\tif(toolTipText && toolTipText !== \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__nsToolTipInElement.addToolTip(div,toolTipText);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tthis.util.resolveFunctionOrPromise(toolTipText,callback.bind(this));\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateCellText = function(row,cell,item,colItem,rowIndex,colIndex)\r\n\t{\r\n\t\tthis.__objGrid.__updateCellText(row,cell,item,colItem,rowIndex,colIndex);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setDataInTemplateRenderer = function(cellItem,data,dataField,setData,colItem,row)\r\n\t{\r\n\t\tif(cellItem && setData)\r\n\t\t{\r\n\t\t\tthis.__setRendererProperties(cellItem);\r\n\t\t\tthis.__setRendererInData(cellItem,data,row);\r\n\t\t\t//IE bug\r\n\t\t\tcellItem.data = data;\r\n\t\t\tif(this.util.isFunction(setData))\r\n\t\t    {\r\n\t\t\t\tvar strParam = \"(cellItem,data,dataField,colItem,row)\"; \r\n\t\t    \tif(this.util.isString(setData))\r\n\t\t    \t{\r\n\t\t    \t\tthis.util.callFunctionFromString(setData + strParam,function(paramValue){\r\n\t\t\t\t\t\tif(paramValue === \"cellItem\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn cellItem;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"data\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn data;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"dataField\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn dataField;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"colItem\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn colItem;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(paramValue === \"row\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\treturn row;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn paramValue;\r\n\t\t\t\t\t});\r\n\t\t    \t}\r\n\t\t    \telse\r\n\t\t    \t{\r\n\t\t    \t\tsetData(cellItem,data,dataField,colItem,row);\r\n\t\t    \t}\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setRendererInData = function(cellItem,data,row)\r\n\t{\r\n\t\tif(cellItem)\r\n\t\t{\r\n\t\t\tvar compChild = null;\r\n\t\t\tfor(var count = 0; count < cellItem.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tcompChild = cellItem.children[count];\r\n\t\t\t\tif(compChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tcompChild.data = data;\r\n\t\t\t\t\tcompChild.row = row;\r\n\t\t\t\t}\r\n\t\t\t\t//IE 9 Bug,you got to assign it back\r\n\t\t\t\t//listItem.children[count] = compChild;\r\n\t\t\t\tthis.__setRendererInData(compChild,data,row);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setRendererProperties = function(cellItem)\r\n\t{\r\n\t\tif(cellItem)\r\n\t\t{\r\n\t\t\tvar compChild = null;\r\n\t\t\tfor(var count = 0; count < cellItem.children.length; count++) \r\n\t\t\t{\r\n\t\t\t\tcompChild = cellItem.children[count];\r\n\t\t\t\tvar grid = this;\r\n\t\t\t\tArray.prototype.slice.call(compChild.attributes).forEach(function(attribute) \r\n\t\t\t\t{\r\n\t\t\t        if(grid.util.isFunction(attribute.value))\r\n\t\t\t        {\r\n\t\t\t        \tvar newValue = attribute.value + \"(this)\";\r\n\t\t\t        \tcompChild.removeAttribute(attribute.name);\r\n\t\t\t\t\t\tcompChild.setAttribute(attribute.name,newValue);\r\n\t\t\t        }\r\n\t\t\t\t});\r\n\t\t\t\tif(compChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(compChild.hasAttribute(\"accessor-name\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcellItem[compChild.getAttribute(\"accessor-name\")] = compChild;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.__setRendererProperties(compChild);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__calculateCellExpectedHeight = function(templateRenderer)\r\n\t{\r\n\t\tvar retHeight =  -1;\r\n\t\tif(templateRenderer)\r\n\t\t{\r\n\t\t\tvar tempRenderer = templateRenderer.cloneNode(true);\r\n\t\t\ttempRenderer.removeAttribute(\"id\");\r\n\t\t\tthis.addChild(tempRenderer);\r\n\t\t\tretHeight = tempRenderer.offsetHeight;\r\n\t\t\tif(retHeight <= 0)\r\n\t\t\t{\r\n\t\t\t\tretHeight = this.util.getDimensionAsNumber(tempRenderer,tempRenderer.style.height);\r\n\t\t\t}\r\n\t\t\tthis.deleteChild(tempRenderer);\r\n\t\t}\r\n\t\treturn retHeight;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setRowHover = function(indexToSet)\r\n\t{\r\n\t\tif(this.__nsGridKeyboard)\r\n\t\t{\r\n\t\t\tthis.__nsGridKeyboard.__setRowHover(indexToSet);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllItems = function()\r\n\t{\r\n\t\treturn this.__objGrid.__getFlatSource();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isCellEditable = function(objColumn,item,cell,cellIndex,row,rowIndex)\r\n\t{\r\n\t\treturn this.__objGrid.__isCellEditable(objColumn,item,cell,cellIndex,row,rowIndex);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getImmediateChildItems = function(arrItems,item)\r\n\t{\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = [];\r\n\t\t}\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChild = this.__arrInternalSource;\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldRowLevel]);\r\n\t\t\tvar startIndex = item[this.__fieldIndex];\r\n\t\t\tvar retIndex = this.__getActualIndex(arrChild,startIndex);\r\n\t\t\tif(retIndex !== startIndex)\r\n\t\t\t{\r\n\t\t\t\tstartIndex = (retIndex + 1);\r\n\t\t\t}\r\n\t\t\t/*//for Filter condition\r\n\t\t\t//(startIndex + 1) as __fieldIndex starts from 1\r\n\t\t\tif(arrChild.length < startIndex || arrChild[startIndex][this.__fieldIndex] !== (startIndex + 1))\r\n\t\t\t{\r\n\t\t\t\tvar rowItem = null;\r\n\t\t\t\tfor(var count = 0;count < arrChild.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\trowItem = arrChild[count];\r\n\t\t\t\t\tif(rowItem[this.__fieldIndex] === startIndex)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstartIndex = (count + 1);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}*/\r\n\t\t\t//end of Filter condition\r\n\t\t\tvar length = arrChild.length;\r\n\t\t\tfor(var count = startIndex;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar itemChild = arrChild[count];\r\n\t\t\t\tvar childRowLevel = parseInt(itemChild[this.__fieldRowLevel]);\r\n\t\t\t\tif(rowLevel >= childRowLevel)\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif((rowLevel + 1) === childRowLevel)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrItems.push(itemChild);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrItems;\r\n\t};\r\n\t\r\n\t//generally used for Filter condition\r\n\tNSGrid.prototype.__getActualIndex = function(arrChild,startIndex,addCompareOne)\r\n\t{\r\n\t\t//(startIndex + 1) as __fieldIndex starts from 1\r\n\t\t//if(arrChild && arrChild.length < startIndex || arrChild[startIndex][this.__fieldIndex] !== (startIndex + 1))\r\n\t\tif(arrChild && arrChild.length > startIndex && arrChild[startIndex][this.__fieldIndex] !== (startIndex + 1))\r\n\t\t{\r\n\t\t\tvar compareIndex = startIndex;\r\n\t\t\tif(addCompareOne)\r\n\t\t\t{\r\n\t\t\t\tcompareIndex += 1;\r\n\t\t\t}\r\n\t\t\tvar rowItem = null;\r\n\t\t\tfor(var count = 0;count < arrChild.length;count++)\r\n\t\t\t{\r\n\t\t\t\trowItem = arrChild[count];\r\n\t\t\t\tif(rowItem[this.__fieldIndex] === compareIndex)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn count;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn startIndex;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllChildItems = function(arrItems,item)\r\n\t{\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = [];\r\n\t\t}\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChild = this.__arrInternalSource;\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldRowLevel]);\r\n\t\t\tvar startIndex = item[this.__fieldIndex];\r\n\t\t\tvar length = arrChild.length;\r\n\t\t\tfor(var count = startIndex;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar itemChild = arrChild[count];\r\n\t\t\t\tif(rowLevel >= parseInt(itemChild[this.__fieldRowLevel]))\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tarrItems.push(itemChild);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrItems;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllChildItemsForGroup = function(arrItems,item)\r\n\t{\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = [];\r\n\t\t}\r\n\t\tif(item && item[this.__fieldHasChild])\r\n\t\t{\r\n\t\t\tvar arrChild = this.__arrInternalSource;\r\n\t\t\tvar rowLevel = parseInt(item[this.__fieldRowLevel]);\r\n\t\t\tvar startIndex = item[this.__fieldIndex];\r\n\t\t\tvar length = arrChild.length;\r\n\t\t\tfor(var count = startIndex;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar itemChild = arrChild[count];\r\n\t\t\t\tvar hasChild = itemChild[this.__fieldHasChild];\r\n\t\t\t\tif(rowLevel >= parseInt(itemChild[this.__fieldRowLevel]))\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t//in group collection we are giving values for rows which are not generated by grid\r\n\t\t\t\tif(!hasChild)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrItems.push(itemChild);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrItems;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllVisibleItems = function()\r\n\t{\r\n\t\tvar totalRecords = 0;\r\n\t\tvar arrItems = this.__getAllItems();\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = arrItems[count];\r\n\t\t\t\tif(item && item[this.__fieldRowVisible])\r\n\t\t\t\t{\r\n\t\t\t\t\ttotalRecords += 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn totalRecords;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getFirstVisibleItemBeforeIndex = function(itemIndex)\r\n\t{\r\n\t\tvar arrItems = this.__getAllItems();\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar retIndex = this.__getActualIndex(arrItems,itemIndex);\r\n\t\t\tif(retIndex !== itemIndex)\r\n\t\t\t{\r\n\t\t\t\titemIndex = (retIndex + 1);\r\n\t\t\t}\r\n\t\t\t/*if(arrItems.length < itemIndex || arrItems[itemIndex][this.__fieldIndex] !== (itemIndex + 1))\r\n\t\t\t{\r\n\t\t\t\tvar rowItem = null;\r\n\t\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\trowItem = arrItems[count];\r\n\t\t\t\t\tif(rowItem[this.__fieldIndex] === itemIndex)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titemIndex = (count + 1);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}*/\r\n\t\t\tfor(var count = itemIndex;count >= 0;count--)\r\n\t\t\t{\r\n\t\t\t\tvar item = arrItems[count];\r\n\t\t\t\tif(item && item[this.__fieldRowVisible] && item[this.__fieldVisibleIndex] > -1)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getVisibleItemByIndex = function(source,index)\r\n\t{\r\n\t\tvar arrItems = source;\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = this.__getAllItems();\r\n\t\t}\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar self = this; \r\n\t\t\tvar findItem = function(itemCompare)\r\n\t\t\t{\r\n\t\t\t\t return (itemCompare[self.__fieldVisibleIndex] === (index + 1));\r\n\t\t\t};\r\n\t\t\treturn arrItems.find(findItem);\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateVisibleIndex = function(source,fromIndex)\r\n\t{\r\n\t\tvar arrItems = source;\r\n\t\tif(!arrItems)\r\n\t\t{\r\n\t\t\tarrItems = this.__getAllItems();\r\n\t\t}\r\n\t\tif(this.util.isUndefinedOrNull(fromIndex))\r\n\t\t{\r\n\t\t\tfromIndex = 0;\r\n\t\t}\r\n\t\tif(arrItems && arrItems.length > 0)\r\n\t\t{\r\n\t\t\tvar visibleRowIndex = 1;\r\n\t\t\tif(fromIndex > 0)\r\n\t\t\t{\r\n\t\t\t\tvar visibleItem = this.__getFirstVisibleItemBeforeIndex(fromIndex);\r\n\t\t\t\tif(visibleItem)\r\n\t\t\t\t{\r\n\t\t\t\t\tvisibleRowIndex = visibleItem[this.__fieldVisibleIndex];\r\n\t\t\t\t\tfromIndex = visibleItem[this.__fieldIndex] - 1;\r\n\t\t\t\t\tvar retIndex = this.__getActualIndex(arrItems,fromIndex,true);\r\n\t\t\t\t\tif(retIndex !== fromIndex)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfromIndex = retIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/*//for Filter condition\r\n\t\t\t\t\t//(startIndex + 1) as __fieldIndex starts from 1\r\n\t\t\t\t\tif(arrItems.length < fromIndex || arrItems[fromIndex][this.__fieldIndex] !== (fromIndex + 1))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar rowItem = null;\r\n\t\t\t\t\t\tfor(var count = 0;count < arrItems.length;count++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\trowItem = arrItems[count];\r\n\t\t\t\t\t\t\tif(rowItem[this.__fieldIndex] === (fromIndex + 1))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tfromIndex = count;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//end of Filter condition*/\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar length = arrItems.length;\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = fromIndex; count < length; count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrItems[count];\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(item[this.__fieldRowVisible])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = visibleRowIndex;\r\n\t\t\t\t\t\tvisibleRowIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateVisibleIndexByRow = function(source,arrAllItems)\r\n\t{\r\n\t\tif(source)\r\n\t\t{\r\n\t\t\tvar arrItems = arrAllItems;\r\n\t\t\tif(!arrItems)\r\n\t\t\t{\r\n\t\t\t\tarrItems = this.__getAllItems();\r\n\t\t\t}\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar item = null;\r\n\t\t\tvar objVisibleIndex = {};\r\n\t\t\tfor(var count = 0; count < length; count++)\r\n\t\t\t{\r\n\t\t\t\titem = source[count];\r\n\t\t\t\tif(item)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t\t\tobjVisibleIndex[index] = item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(arrItems && arrItems.length > 0)\r\n\t\t\t{\r\n\t\t\t\tlength = arrItems.length;\r\n\t\t\t\titem = null;\r\n\t\t\t\tvar visibleRowIndex = 1;\r\n\t\t\t\tfor(var count = 0; count < length; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = arrItems[count];\r\n\t\t\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t\t\tif(this.util.isUndefinedOrNull(objVisibleIndex[index]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = -1;\r\n\t\t\t\t\t\titem[this.__fieldRowVisible] = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem[this.__fieldVisibleIndex] = visibleRowIndex;\r\n\t\t\t\t\t\titem[this.__fieldRowVisible] = true;\r\n\t\t\t\t\t\tobjVisibleIndex[index][this.__fieldVisibleIndex] = visibleRowIndex;\r\n\t\t\t\t\t\tobjVisibleIndex[index][this.__fieldRowVisible] = true;\r\n\t\t\t\t\t\tvisibleRowIndex++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getArrow = function(rowCount)\r\n\t{\r\n\t\tvar arrDivs = this.__getAllArrows();\r\n\t\tif(arrDivs && arrDivs.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrDivs.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar div = arrDivs[count];\r\n\t\t\t\tif(div && div.hasAttribute(\"ns-parent-row-count\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar rowParentCount = div.getAttribute(\"ns-parent-row-count\");\r\n\t\t\t\t\tif(rowParentCount && rowParentCount == rowCount)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn div;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllArrows = function(divParent)\r\n\t{\r\n\t\tif(!divParent)\r\n\t\t{\r\n\t\t\tdivParent = this.__tblCenterBody;\r\n\t\t}\r\n\t\treturn divParent.querySelectorAll(\".nsArrow\");\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getAllBodyRows = function()\r\n\t{\r\n\t\tif(this.__tblCenterBodyBody && this.__tblCenterBodyBody.rows)\r\n\t\t{\r\n\t\t\treturn this.__tblCenterBodyBody.rows;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getTotalRows = function()\r\n\t{\r\n\t\tif(this.__tblCenterBodyBody && this.__tblCenterBodyBody.rows)\r\n\t\t{\r\n\t\t\treturn this.__tblCenterBodyBody.rows.length;\r\n\t\t}\r\n\t\treturn 0;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getIndexFromRow = function(row)\r\n\t{\r\n\t\tif(row)\r\n\t\t{\r\n\t\t\treturn parseInt(row.getAttribute(\"ns-index\"));\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getRowFromItem = function(item)\r\n\t{\r\n\t\tvar row = null;\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\trow = item[this.__fieldRow];\r\n\t\t\tvar index = item[this.__fieldIndex];\r\n\t\t\t//below case is true if row reference has been removed due to virtual scroll \r\n\t\t\tif(!row || row.rowIndex === -1)\r\n\t\t\t{\r\n\t\t\t\tvar arrRows = this.__tblCenterBodyBody.querySelectorAll('[ns-index=\"' + index + '\"]');\r\n\t\t\t\tif(arrRows && arrRows.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\trow = arrRows[0];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn row;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getRowByIndex = function(index)\r\n\t{\r\n\t\tvar row = null;\r\n\t\tif(index > -1)\r\n\t\t{\r\n\t\t\tvar item = this.__getItemByIndex(index);\r\n\t\t\trow = this.__getRowFromItem(item);\r\n\t\t}\r\n\t\treturn row;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getRowFromContainer = function(index)\r\n\t{\r\n\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\tif(this.__hasBodyRows() && arrRows.length > index)\r\n\t\t{\r\n\t\t\treturn arrRows[index];\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__hasBodyRows = function()\r\n\t{\r\n\t\tvar arrRows = this.__getBodyBodyRow(this.__tblCenterBody);\r\n\t\tif(arrRows && arrRows.length > 0)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getItemByIndex = function(indexToFind,source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__objGrid.__getFlatSource();\r\n\t\t}\r\n\t\tif(source && source.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item && item[this.__fieldIndex] === indexToFind)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getItemBykeyField = function(keyFieldValue,source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__objGrid.__getFlatSource();\r\n\t\t}\r\n\t\tif(source && source.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item && item[this.__rowKeyField] === keyFieldValue)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getIndexByItem = function(itemToFind,source)\r\n\t{\r\n\t\tif(!source)\r\n\t\t{\r\n\t\t\tsource = this.__getAllItems();\r\n\t\t}\r\n\t\tif(itemToFind && source && source.length > 0)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < source.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = source[count];\r\n\t\t\t\tif(item && item[this.__fieldIndex] === itemToFind[this.__fieldIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item[this.__fieldIndex];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnObject = function(index,arrColumn)\r\n\t{\r\n\t\tif(!arrColumn)\r\n\t\t{\r\n\t\t\tarrColumn = this.__columns;\r\n\t\t}\r\n\t\tindex = parseInt(index);\r\n\t\tif(arrColumn && index > -1 && index < arrColumn.length)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var count = 0;count < arrColumn.length;count++)\r\n\t\t\t{\r\n\t\t\t\titem = arrColumn[count];\r\n\t\t\t\tif(item[this.__fieldColIndex] === index)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnIndexByObject = function(objColumn,arrColumn)\r\n\t{\r\n\t\tif(!arrColumn)\r\n\t\t{\r\n\t\t\tarrColumn = this.__columns;\r\n\t\t}\r\n\t\tif(arrColumn && objColumn)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrColumn.length;count++)\r\n\t\t\t{\r\n\t\t\t\tif(arrColumn[count][this.__fieldColIndex] === objColumn[this.__fieldColIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\treturn count;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnObjectByDataField = function(dataField,arrColumn)\r\n\t{\r\n\t\tif(!arrColumn)\r\n\t\t{\r\n\t\t\tarrColumn = this.__columns;\r\n\t\t}\r\n\t\tif(arrColumn && dataField)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < arrColumn.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar item = arrColumn[count];\r\n\t\t\t\tif(item[\"dataField\"] === dataField)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnIndexForSwapOrRemove = function(column,arrColumn)\r\n\t{\r\n\t\tif(!arrColumn)\r\n\t\t{\r\n\t\t\tarrColumn = this.__columns;\r\n\t\t}\r\n\t\tvar index = -1;\r\n\t\t//checking below like this because column = 0 then column will return false;\r\n\t\tif(!this.util.isUndefined(column) && column != null)\r\n\t\t{\r\n\t\t\tif(this.util.isNumber(column) && arrColumn && column < arrColumn.length)\r\n\t\t\t{\r\n\t\t\t\tindex = column;\r\n\t\t\t}\r\n\t\t\telse if(this.util.isString(column))\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrColumn.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar item = arrColumn[count];\r\n\t\t\t\t\tif(item[\"dataField\"] === column)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tindex = count;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.warning(\"NSGrid\",\"Please pass valid column information.\");\r\n\t\t}\r\n\t\treturn index;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isColumnValidForSwapOrRemove = function(columnIndex,operation)\r\n\t{\r\n\t\tif(this.__isColumnIndexValid(columnIndex))\r\n\t\t{\r\n\t\t\tif((this.__enableHierarchical && columnIndex === 0) || (this.__enableGrouping && (columnIndex === 0 || this.__columns[columnIndex][\"dataField\"] === this.__groupByField)) \r\n\t\t\t\t\t|| (this.__enableMasterDetail && columnIndex === 0))\r\n\t\t\t{\r\n\t\t\t\tif(operation)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.util.warning(\"NSGrid\",\"This column cannot be \" + operation + \".\");\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t\t\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__swapCell = function(sourceCell,destinationCell)\r\n\t{\r\n\t\tif(sourceCell && destinationCell)\r\n\t\t{\r\n\t\t\tvar destinationCellIndex = destinationCell.cellIndex;\r\n\t\t\tthis.__moveCell(destinationCell,sourceCell.cellIndex);\r\n\t\t\tthis.__moveCell(sourceCell,destinationCellIndex);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__moveCell = function(fromCell,toIndex)\r\n\t{\r\n\t\tif(fromCell && toIndex > -1)\r\n\t\t{\r\n\t\t\tvar row = fromCell.parentNode;\r\n\t\t\trow.removeChild(fromCell);\r\n\t\t\trow.insertBefore(fromCell,row.cells[toIndex]);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__createColumnProvider = function(arrColumns)\r\n\t{\r\n\t\tif(arrColumns && arrColumns.length > 0)\r\n\t\t{\r\n\t\t\tvar hasColumnProviderChanged = this.__hasColumnProviderChanged(arrColumns);\r\n\t\t\tvar self = this;\r\n\t\t\tvar getOrignalColumnInfo = function(dataField)\r\n\t\t\t{\r\n\t\t\t\tfor (var count = 0;count < self.__orignalColumns.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar colOrigItem = self.__orignalColumns[count];\r\n\t\t\t\t\tif(colOrigItem[\"dataField\"] === dataField)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn colOrigItem;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn null;\r\n\t\t\t};\r\n\t\t\tthis.__columns = [];\r\n\t\t\tfor (var count = 0;count < arrColumns.length;count++)\r\n\t\t\t{\r\n\t\t\t\tvar objColumn = arrColumns[count];\r\n\t\t\t\tvar columnInfo = getOrignalColumnInfo(objColumn[\"dataField\"]);\r\n\t\t\t\tif(columnInfo)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(objColumn.hasOwnProperty(this.__fieldColSortedAsc) && objColumn[this.__fieldColSortedAsc] != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcolumnInfo[this.__fieldColSortedAsc] = objColumn[this.__fieldColSortedAsc];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(objColumn.hasOwnProperty(this.__fieldColIndex) && objColumn[this.__fieldColIndex] != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcolumnInfo[this.__fieldColIndex] = objColumn[this.__fieldColIndex];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(objColumn.hasOwnProperty(this.__fieldColVisible) && objColumn[this.__fieldColVisible] != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcolumnInfo[this.__fieldColVisible] = objColumn[this.__fieldColVisible];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!hasColumnProviderChanged && objColumn.hasOwnProperty(\"width\") && objColumn[\"width\"] != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcolumnInfo[\"width\"] = objColumn[\"width\"];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar index = columnInfo[this.__fieldColIndex];\r\n\t\t\t\t\tif(this.__columns[index])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__columns.splice(index, 0, columnInfo);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.__columns[index] = columnInfo;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__columns = this.__orignalColumns.slice(0);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__hasColumnProviderChanged = function(arrColumns)\r\n\t{\r\n\t\tif(!arrColumns || !this.__orignalColumns || this.__orignalColumns.length !== arrColumns.length)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tvar length = this.__orignalColumns.length;\r\n\t\tvar count = 0;\r\n\t\tfor(count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\tvar colItem = this.__orignalColumns[count];\r\n\t\t\tfor(var innerCount = 0;innerCount < length;innerCount++)\r\n\t\t\t{\r\n\t\t\t\tif(colItem[\"dataField\"] === arrColumns[innerCount][\"dataField\"])\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (count !== length);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__processDefaultSort = function()\r\n\t{\r\n\t\tfor(var count = 0; count < this.__columns.length;count++)\r\n\t\t{\r\n\t\t\tvar objColumn = this.__columns[count];\r\n\t\t\tif(objColumn.hasOwnProperty(this.__fieldColSortedAsc) && objColumn[this.__fieldColSortedAsc] != null)\r\n\t\t\t{\r\n\t\t\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\t\t\tvar arrHeaderCells = headerBodyRow.cells;\r\n\t\t\t\tvar cell = arrHeaderCells[count];\r\n\t\t\t\tthis.__nsGridSort.handle(cell,objColumn,false,objColumn[this.__fieldColSortedAsc]);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__editColumnArray = function(mode,item)\r\n\t{\r\n\t\t//item should be column object\r\n\t\tif(mode === \"add\")\r\n\t\t{\r\n\t\t\tthis.__columns[this.__columns.length] = item;\r\n\t\t\tthis.__orignalColumns[this.__orignalColumns.length] = item;\r\n\t\t}\r\n\t\telse if(mode === \"swap\")\r\n\t\t{\r\n\t\t\t\r\n\t\t}\r\n\t\t//item should be column index\r\n\t\telse if(mode === \"hide\")\r\n\t\t{\r\n\t\t\tvar colItem = this.__columns[item];\r\n\t\t\tcolItem[this.__fieldColVisible] = false;\r\n\t\t}\r\n\t\telse if(mode === \"show\")\r\n\t\t{\r\n\t\t\tvar colItem = this.__columns[item];\r\n\t\t\tcolItem[this.__fieldColVisible] = true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isColumnIndexValid = function(columnIndex)\r\n\t{\r\n\t\tif(columnIndex > -1 && columnIndex < this.__columns.length)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t\t\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isMouseOnElement = function(element, currentX, currentY)\r\n\t{\r\n\t\tvar offset = this.util.getCumulativeOffset(element);\r\n\t\treturn (currentY >= offset.y &&\r\n\t\t\t\tcurrentY <  offset.y + element.offsetHeight &&\r\n\t            currentX >= offset.x + element.offsetWidth - 5 &&\r\n\t            currentX <  offset.x + element.offsetWidth);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateTotalRecords = function(totalCount)\r\n\t{\r\n\t\tif(!totalCount)\r\n\t\t{\r\n\t\t\ttotalCount = this.__arrInternalSource.length; \r\n\t\t}\r\n\t\t//update total Rows if no server side call and pagination mode is manual\r\n\t\tif(!(this.__enableServerCall || (this.__enablePagination && !this.__isPaginationModeAuto)) || this.__rowsRendered)\r\n\t\t{\r\n\t\t\tthis.__totalRecords = totalCount;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addPriorityClassInCell = function(cell,colItem)\r\n\t{\r\n\t\tif(this.__isResponsiveModeColumnToggle && cell && colItem)\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(cell,\"column-priority-\" + colItem[\"priority\"]);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setGridType = function()\r\n\t{\r\n\t\tif(this.__type === this.GRID_TYPE_HIERARCHICAL)\r\n\t\t{\r\n\t\t\tthis.__enableHierarchical = true;\r\n\t\t\tthis.__objGrid = new NSHierarchicalGrid(this,this.util);\r\n\t\t}\r\n\t\telse if(this.__type === this.GRID_TYPE_GROUP)\r\n\t\t{\r\n\t\t\tthis.__enableGrouping = true;\r\n\t\t\tthis.__objGrid = new NSGroupingGrid(this,this.util);\r\n\t\t}\r\n\t\telse if(this.__type === this.GRID_TYPE_MASTER_DETAIL)\r\n\t\t{\r\n\t\t\tthis.__enableMasterDetail = true;\r\n\t\t\tthis.__objGrid = new NSMasterDetailGrid(this,this.util);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__objGrid = new NSFlatGrid(this,this.util);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__callFunctionInsideGridType = function(functionName,...args)\r\n\t{\r\n\t\tthis.util.callFunctionOfObject(this.__objGrid,functionName,...args);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setPaginationType = function()\r\n\t{\r\n\t\tif(!this.__paginationType || this.__paginationType === this.PAGINATION_TYPE_SCROLL)\r\n\t\t{\r\n\t\t\tthis.__isPaginationTypeScroll = true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__isPaginationTypeScroll = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setPaginationMode = function()\r\n\t{\r\n\t\tif(!this.__paginationMode || this.__paginationMode === this.PAGINATION_MODE_AUTO)\r\n\t\t{\r\n\t\t\tthis.__isPaginationModeAuto = true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__isPaginationModeAuto = false;\r\n\t\t}\r\n\t\tif(!(this.__isPaginationTypeScroll && this.__isPaginationModeAuto))\r\n\t\t{\r\n\t\t\tthis.__enableAsyncLoadPagination = false;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setResponsiveMode = function()\r\n\t{\r\n\t\tif(this.__enableResponsive)\r\n\t\t{\r\n\t\t\tif(!this.__responsiveMode || this.__responsiveMode === this.RESPONSIVE_MODE_STACK)\r\n\t\t\t{\r\n\t\t\t\tthis.__isResponsiveModeStack = true;\r\n\t\t\t\tthis.__isResponsiveModeColumnToggle = false;\r\n\t\t\t\tthis.__arrQueries = [\"only screen and (max-width: 760px),(min-device-width: 768px) and (max-device-width: 1024px)\"];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__arrQueries = [\"only screen and (min-width: 960px)\",\r\n\t\t\t\t                     \"only screen and (max-width: 960px) and (min-width: 800px)\",\r\n\t\t\t\t                     \"only screen and (max-width: 800px) and (min-width: 640px)\",\r\n\t\t\t\t                     \"only screen and (max-width: 640px) and (min-width: 480px)\",\r\n\t\t\t\t                     \"only screen and (max-width: 480px) and (min-width: 320px)\",\r\n\t\t\t\t                     \"only screen and (max-width: 320px)\"];\r\n\t\t\t\tthis.__isResponsiveModeColumnToggle = true;\r\n\t\t\t\tthis.__isResponsiveModeStack = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__isResponsiveModeColumnToggle = false;\r\n\t\t\tthis.__isResponsiveModeStack = false;\r\n\t\t}\r\n\t\t\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__checkForVirtualMode = function()\r\n\t{\r\n\t\tif(this.__enableVirtualScroll)\r\n\t\t{\r\n\t\t\t/*if(this.__enableHierarchical || this.__enableGrouping)\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVirtualScroll = false;\r\n\t\t\t}*/\r\n\t\t\tif(this.__enablePagination)\r\n\t\t\t{\r\n\t\t\t\tthis.__enableVirtualScroll = false;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setCustomScrollBarScrollTop = function(scrollTop)\r\n\t{\r\n\t\tif(this.__enableCustomScrollBar)\r\n\t\t{\r\n\t\t\tif(this.__scroller)\r\n\t\t\t{\r\n\t\t\t\tthis.__scroller.setScrollTop(scrollTop);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getHorizontalScrollableContainer = function() \r\n\t{\r\n\t\tvar container = this.__enableFooter ? this.__divCenterTableFooterContainer : this.__divCenterTableBodyContainer;\r\n\t\treturn container;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getVerticalScrollableContainer = function() \r\n\t{\r\n\t\tvar container = this.__divCenterTableBodyContainer;\r\n\t\treturn container;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addSVGInPage = function()\r\n\t{\r\n\t\tif(typeof NSSvg != 'undefined')\r\n\t\t{\r\n\t\t\tvar objSVG = new NSSvg();\r\n\t\t\tvar svgShapes = new NSSvgShapes();\r\n\t\t\t//for header Menu\r\n\t\t\tvar circleDownArrowID = \"svgCircleDownArrow\";\r\n\t\t\tvar groupDown = objSVG.createGroup(circleDownArrowID + \"group\");\r\n\t\t\tvar circle = objSVG.createCircle(circleDownArrowID + \"circle\",8,8,8,null);\r\n\t\t\tgroupDown.appendChild(circle);\r\n\t\t\tvar polygon = objSVG.createPolygon(circleDownArrowID + \"polygon\",\"2,5.5 14,5.5 8,11.5\",\"nsMenuArrow\");\r\n\t\t\tgroupDown.appendChild(polygon);\r\n\t\t\tobjSVG.addElementInSymbol(circleDownArrowID,\"0 0 16 16\",groupDown);\r\n\t\t\tif(this.__enableExport)\r\n\t\t\t{\r\n\t\t\t\tsvgShapes.addExportInPage();\r\n\t\t\t}\r\n\t\t\tif(this.__enableColumnSetting)\r\n\t\t\t{\r\n\t\t\t\tsvgShapes.addColumnSettingIcon();\r\n\t\t\t}\r\n\t\t\tif(this.__enableFilter)\r\n\t\t\t{\r\n\t\t\t\tsvgShapes.addFilterIcon();\r\n\t\t\t\tsvgShapes.addSearchIcon();\r\n\t\t\t}\r\n\t\t\tthis.__objGrid.__addSVGInPage(objSVG);\r\n\t\t\tsvgShapes.addMoveIcon();\r\n\t\t\tsvgShapes.addLeftIcon();\r\n\t\t\tsvgShapes.addRightIcon();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.warning(\"NSGrid\",\"NSSvg has not been included so the icons might not appear\");\r\n\t\t}\r\n\t\tthis.__imgUtil = new this.util.image();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addStyleInDOM = function()\r\n\t{\r\n\t\tif(this.__enableMouseHover)\r\n\t    {\r\n\t\t\t//this.util.addCSSClassInDOM([\"#\" + this.getID() + \" .nsGridRow:hover > td\"],[\"background-color: \" + this.__mouseHoverColor + \"!important;\"]);\r\n\t    }\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addRowHeightInDOM = function()\r\n\t{\r\n\t\tif(!this.__enableVariableRowHeight)\r\n\t\t{\r\n\t\t\tvar rowHeight = null;\r\n\t\t\tif(this.__rowHeight > 0)\r\n\t\t\t{\r\n\t\t\t\trowHeight = this.__rowHeight + \"px\";\r\n\t\t\t}\r\n\t\t\telse if(this.__virtualRowHeight > 0)\r\n\t\t\t{\r\n\t\t\t\trowHeight = this.__virtualRowHeight + \"px\";\r\n\t\t\t}\r\n\t\t\tif(rowHeight)\r\n\t\t    {\r\n\t\t\t\tthis.util.addCSSClassInDOM([\"#\" + this.getID() + \" .nsBodyDataGridCell > div\"],[\"max-height:\" + rowHeight + \";\"]);\r\n\t\t    }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__initializePluggins = function()\r\n\t{\r\n\t\tif(!this.__nsGridSort)\r\n\t\t{\r\n\t\t\tthis.__nsGridSort = new NSGridSort(this);\r\n\t\t\tthis.__nsGridColumnMove = new NSGridColumnMove(this);\r\n\t\t\tthis.__nsGridFilter = new NSGridFilter(this);\r\n\t\t\tthis.__nsGridColumnResize = new NSGridColumnResize(this);\r\n\t\t\tthis.__nsGridEditor = new NSGridEditor(this);\r\n\t\t\tthis.__nsToolTipInElement = new this.util.nsToolTipInElement();\r\n\t\t\tif(this.__enableKeyboardNavigation)\r\n\t\t\t{\r\n\t\t\t\tthis.__nsGridKeyboard = new NSGridKeyboard(this);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getCellDetailsForEditing = function(item,dataField)\r\n\t{\r\n\t\tif(this.__nsGridEditor)\r\n\t\t{\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tvar colItem = this.__getColumnObjectByDataField(dataField);\r\n\t\t\t\tif(colItem)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar colIndex = colItem[this.__fieldColIndex];\r\n\t\t\t\t\tvar row = this.__getRowFromItem(item);\r\n\t\t\t\t\tif(row)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar cells = row.cells;\r\n\t\t\t\t\t\tvar cell = cells[colIndex];\r\n\t\t\t\t\t\treturn {cell: cell,item: item};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__handleHiddenColumn = function()\r\n\t{\r\n\t\tvar length = this.__columns.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\tvar objColumn = this.__columns[count];\r\n\t\t\tif(objColumn[this.__fieldColVisible] === false)\r\n\t\t\t{\r\n\t\t\t\tthis.__setColumnVisibility(count,false,objColumn);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setColumnVisibility = function(index,isVisible,item)\r\n\t{\r\n\t\tvar headerColGroupID = null;\r\n\t\tvar bodyColGroupID = null;\r\n\t\tvar objColumn = null;\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tif(this.util.isString(item))\r\n\t\t\t{\r\n\t\t\t\tobjColumn = this.__getColumnObjectByDataField(item);\r\n\t\t\t}\r\n\t\t\telse if(this.util.isNumber(item))\r\n\t\t\t{\r\n\t\t\t\tobjColumn = this.__getColumnObject(item);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjColumn = item;\r\n\t\t\t}\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\theaderColGroupID = this.getID() + \"HeaderColGroup\" + objColumn.dataField;\r\n\t\t\t\tbodyColGroupID = this.getID() + \"BodyColGroup\" + objColumn.dataField;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(isVisible)\r\n\t\t{\r\n\t\t\tthis.util.removeCSSClassInDOM([\"#\" + this.getID() + \" :nth-child(\" + (index + 1) +\").nsGridCell\"]);\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tthis.util.removeCSSClassInDOM([\"#\" + headerColGroupID + \", #\" + bodyColGroupID]);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.addCSSClassInDOM([\"#\" + this.getID() + \" :nth-child(\" + (index + 1) +\").nsGridCell\"],[\"display:none;\"]);\r\n\t\t\tif(objColumn)\r\n\t\t\t{\r\n\t\t\t\tthis.util.addCSSClassInDOM([\"#\" + headerColGroupID + \", #\" + bodyColGroupID],[\"display:none;\"]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__addColumnPseudoStyle = function()\r\n\t{\r\n\t\tvar arrClass = [];\r\n\t\tvar arrCSSText = [];\r\n\t\tvar headerBodyRow = this.__getHeaderBodyRow(this.__tblCenterHeader);\r\n\t\tif(headerBodyRow)\r\n\t\t{\r\n\t\t\tvar headerCells = headerBodyRow.cells;\r\n\t\t\tvar colIndex = 0;\r\n\t\t\tvar cell = null;\r\n\t        for(colIndex = 0; colIndex < headerCells.length; colIndex++)\r\n\t        {\r\n\t        \tcell = headerCells[colIndex];\r\n\t        \tarrClass.push(\"#\" + this.getID() + \".nsMobileStackGrid td:nth-of-type(\" + (colIndex + 1) + \"):before\");\r\n\t        \tvar text = cell.textContent.trim();\r\n\t        \tif(text && text.length > 0)\r\n\t        \t{\r\n\t        \t\ttext = text + \": \";\r\n\t        \t}\r\n\t        \tarrCSSText.push(\"content: '\" + text + \"';\");\r\n\t        }\r\n\t\t}\r\n\t\tthis.util.addCSSClassInDOM(arrClass,arrCSSText,false);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateItemInSource = function(item)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tthis.__updateItemInArray(this.__dataSource,item);\r\n\t\t\tthis.__updateItemInArray(this.__arrWrapper,item);\r\n\t\t\tthis.__updateItemInArray(this.__arrInternalSource,item);\r\n\t\t\tthis.__updateItemInArray(this.__arrFlatHierarchicalSource,item,true);\r\n\t\t\tthis.__updateItemInArray(this.__arrFilteredGroupedSource,item);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__updateItemInArray = function(source,item,excludeChildren)\r\n\t{\r\n\t\tvar isFound = false;\r\n\t\tif(source && source.length > 0 && item)\r\n\t\t{\r\n\t\t\texcludeChildren = Boolean.parse(excludeChildren);\r\n\t\t\tvar length = source.length;\r\n\t\t\tvar tempItem = {};\r\n\t\t\tvar arrChildItems = [];\r\n\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t{\r\n\t\t\t\ttempItem = source[count];\r\n\t\t\t\tif(tempItem[this.__fieldIndex] === item[this.__fieldIndex])\r\n\t\t\t\t{\r\n\t\t\t\t\tsource[count] = item;\r\n\t\t\t\t\tisFound = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif((this.__enableHierarchical || this.__enableGrouping || this.__enableMasterDetail) && !excludeChildren)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildItems = tempItem[this.__childField];\r\n\t\t\t\t\tif(arrChildItems && arrChildItems.length > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tisFound = this.__updateItemInArray(arrChildItems,item,excludeChildren);\r\n\t\t\t\t\t\tif(isFound)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn isFound;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__setComponentHeight = function()\r\n\t{\r\n\t\tvar offset = this.util.getNumber(this.__heightOffset);\r\n\t\tif(offset > 0)\r\n\t\t{\r\n\t\t\tvar compHeight = this.util.getBodyDimension().height;\r\n\t\t\tthis.__baseComponent.style.height = (compHeight - offset) + \"px\";\r\n\t\t}\r\n\t};\r\n\t\r\n\t//to get header row which has column width\r\n\tNSGrid.prototype.__getHeaderHeaderRow = function(table)\r\n\t{\r\n\t\tvar headerRow = null;\r\n\t\tif(table && table.tHead && table.tHead.rows && table.tHead.rows.length > 0)\r\n\t\t{\r\n\t\t\theaderRow = table.tHead.rows[0];\r\n\t\t}\r\n\t\treturn headerRow;\r\n\t};\r\n\t\r\n\t//to get header row which has column header Name\r\n\tNSGrid.prototype.__getHeaderBodyRow = function(table)\r\n\t{\r\n\t\tvar headerBodyRow = null;\r\n\t\tif(table)\r\n\t\t{\r\n\t\t\theaderBodyRow = table.querySelector(\".nsGridHeaderRow\");\r\n\t\t}\r\n\t\treturn headerBodyRow;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getHeaderFilterRow = function(table)\r\n\t{\r\n\t\tvar headerFilterRow = null;\r\n\t\tif(table)\r\n\t\t{\r\n\t\t\theaderFilterRow = table.querySelector(\".nsGridFilterRow\");\r\n\t\t}\r\n\t\treturn headerFilterRow;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getHeaderExtraRow = function(table)\r\n\t{\r\n\t\tvar arrExtraRows = null;\r\n\t\tif(table)\r\n\t\t{\r\n\t\t\tarrExtraRows = table.querySelectorAll(\".nsHeaderExtraRow\");\r\n\t\t}\r\n\t\treturn arrExtraRows;\r\n\t};\r\n\t\r\n\t//to get body row which has column width\r\n\tNSGrid.prototype.__getBodyHeaderRow = function(table)\r\n\t{\r\n\t\tvar bodyRow = null;\r\n\t\tif(table && table.tHead && table.tHead.rows && table.tHead.rows.length > 0)\r\n\t    {\r\n\t\t\tbodyRow = table.tHead.rows[0];\r\n\t\t}\r\n\t\treturn bodyRow;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getBodyBodyRow = function(table)\r\n\t{\r\n\t\tvar arrRows = null;\r\n\t\tif(table && table.tBodies && table.tBodies.length > 0 && table.tBodies[0].rows && table.tBodies[0].rows.length > 0)\r\n\t\t{\r\n    \t\tarrRows = table.tBodies[0].rows;\r\n\t\t}\r\n\t\treturn arrRows;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getCustomIcon = function(iconField)\r\n\t{\r\n\t\tif(this.__icons && this.__icons[iconField])\r\n\t\t{\r\n\t\t\treturn this.__icons[iconField];\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getColumnCustomIcon = function(colItem,iconField)\r\n\t{\r\n\t\tif(colItem && colItem.icons && colItem.icons[iconField])\r\n\t\t{\r\n\t\t\treturn colItem.icons[iconField];\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isSortingIconCustom = function(colItem)\r\n\t{\r\n\t\tif(this.__getColumnCustomIcon(colItem,\"sortAscending\") && this.__getColumnCustomIcon(colItem,\"sortDescending\"))\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__isRowExpansionIconCustom = function()\r\n\t{\r\n\t\tif(this.__getCustomIcon(\"rowExpanded\") && this.__getCustomIcon(\"rowCollapsed\"))\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getViewportHeight = function()\r\n\t{\r\n\t\treturn this.__divTableHeaderContainerWrapper.offsetHeight + this.__divTableBodyContainerWrapper.offsetHeight + this.__divTableFooterContainerWrapper.offsetHeight;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__dispatchEvent = function(eventType,data,param,bubbles,cancelable)\r\n\t{\r\n\t\tif(this.__eventDispatcher)\r\n\t\t{\r\n\t\t\tthis.__eventDispatcher(eventType,data,param,bubbles,cancelable);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.util.dispatchEvent(this.__baseComponent,eventType,data,param,bubbles,cancelable);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__dispatchInternalEvent = function(eventType,data,param,bubbles,cancelable)\r\n\t{\r\n\t\tthis.util.dispatchEvent(this.__baseComponent,this.__getInternalEvent(eventType),data,param,bubbles,cancelable);\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__listenInternalEvent = function(eventType,callback)\r\n\t{\r\n\t\tthis.util.addEvent(this.__baseComponent,this.__getInternalEvent(eventType),function(event){\r\n\t\t\tcallback(event,event.detail);\r\n\t\t});\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__getInternalEvent = function(eventType)\r\n\t{\r\n\t\treturn \"__\" + eventType;\r\n\t};\r\n\t/******************************End of Custom Function *************************************/\r\n\t/******************************Touch Related Function *************************************/\r\n\tNSGrid.prototype.__addTouchEvent = function(element)\r\n\t{\r\n\t\tvar objTouch = null;\r\n\t\tif(element && this.__enableTouchEvents)\r\n\t\t{\r\n\t\t\tif(this.__objTouchEvents.has(element))\r\n\t\t\t{\r\n\t\t\t\tobjTouch = this.__objTouchEvents.get(element);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tobjTouch = new NSTouchToMouse(element);\r\n\t\t\t\tthis.__objTouchEvents.set(element,objTouch);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn objTouch;\r\n\t};\r\n\t\r\n\tNSGrid.prototype.__removeTouchEvent = function(element)\r\n\t{\r\n\t\tvar objTouch = null;\r\n\t\tif(element && this.__enableTouchEvents)\r\n\t\t{\r\n\t\t\tif(this.__objTouchEvents.has(element))\r\n\t\t\t{\r\n\t\t\t\t/*objTouch = this.__objTouchEvents.get(element);\r\n\t\t\t\tthis.__objTouchEvents.delete(objTouch);*/\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn objTouch;\r\n\t};\r\n\t\r\n\t/******************************End of Touch Related Function *************************************/\r\n\t/******************************Loader Related Function *************************************/\r\n\tNSGrid.prototype.showLoader = function()\r\n\t{\r\n\t\tif(!this.__loader)\r\n\t\t{\r\n\t\t\tthis.__loader = new this.util.loader(this.__divOuterContainer);\r\n\t\t}\r\n\t\tthis.__loader.show();\r\n\t};\r\n\t\r\n\tNSGrid.prototype.hideLoader = function()\r\n\t{\r\n\t\tif(this.__loader)\r\n\t\t{\r\n\t\t\tthis.__loader.hide();\r\n\t\t}\r\n\t};\r\n\t/******************************End of Loader Related Function *************************************/\r\n\t/******************************Start of Export Related Function *************************************/\r\n\tNSGrid.prototype.__exportHandler = function(target,item)\r\n\t{\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tif(!this.__exportFileName || this.__exportFileName === \"\")\r\n\t\t\t{\r\n\t\t\t\tthis.__exportFileName = \"Download\";\r\n\t\t\t}\r\n\t\t\tvar nsExport = new NSExport(this,this.__exportFileName);\r\n\t\t\tswitch (item.id) \r\n\t\t\t{\r\n\t\t\t    case 0:\r\n\t\t\t    \tvar setting = {type:\"xls\",event:null,sheetName:this.__exportFileName,element:null,properties:item};\r\n\t\t\t    \tnsExport.excel(setting);\r\n\t\t\t        break;\r\n\t\t\t    case 1:\r\n\t\t\t    \tnsExport.csv();\r\n\t\t\t        break;\r\n\t\t\t    case 2:\r\n\t\t\t    \tvar setting = {type:\"doc\",event:null,orientation:null,element:null};\r\n\t\t\t    \tnsExport.word(setting);\r\n\t\t\t        break;\r\n\t\t\t    case 3:\r\n\t\t\t    \tnsExport.text();\r\n\t\t\t        break;\r\n\t\t\t    case 4:\r\n\t\t\t    \tnsExport.xml();\r\n\t\t\t        break;\r\n\t\t\t    case 5:\r\n\t\t\t    \tnsExport.json();\r\n\t\t\t        break;\r\n\t\t\t    case 6:\r\n\t\t\t    \tnsExport.pdf();\r\n\t\t\t        break;\r\n\t\t\t    case 7:\r\n\t\t\t    \tnsExport.image();\r\n\t\t\t        break;\r\n\t\t\t    case 8:\r\n\t\t\t    \tvar setting = {type:\"xlsx\",event:null,sheetName:this.__exportFileName,element:null,properties:item};\r\n\t\t\t    \tnsExport.excel(setting);\r\n\t\t\t        break;\r\n\t\t\t    case 9:\r\n\t\t\t    \tvar setting = {type:\"doc\",event:null,orientation:null,element:null};\r\n\t\t\t    \tnsExport.word(setting);\r\n\t\t\t        break;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t//Events\r\n\tNSGrid.GRID_RENDERED = \"gridRendered\";\r\n\tNSGrid.ROW_SELECTED = \"rowSelected\";\r\n\tNSGrid.ROW_UNSELECTED = \"rowUnselected\";\r\n\tNSGrid.ROW_CLICKED = \"rowClicked\";\r\n\tNSGrid.ROW_DOUBLE_CLICKED = \"rowDoubleClicked\";\r\n\tNSGrid.ROW_NAVIGATED = \"rowNavigated\";\r\n\tNSGrid.CELL_SELECTED = \"cellSelected\";\r\n\tNSGrid.CELL_UNSELECTED = \"cellUnselected\";\r\n\tNSGrid.CELL_CLICKED = \"cellClicked\";\r\n\tNSGrid.CELL_DOUBLE_CLICKED = \"cellDoubleClicked\";\r\n\tNSGrid.SORT_CHANGING = \"sortChanging\";\r\n\tNSGrid.SORT_CHANGED = \"sortChanged\";\r\n\tNSGrid.ADVANCED_FILTER_CLOSING = \"advancedFilterClosing\";\r\n\tNSGrid.FILTER_CHANGING = \"filterChanging\";\r\n\tNSGrid.FILTER_CHANGED = \"filterChanged\";\r\n\tNSGrid.FILTER_RESETTED = \"filterResetted\";\r\n\tNSGrid.COLUMN_RESIZING = \"columnResizing\";\r\n\tNSGrid.COLUMN_RESIZED = \"columnResized\";\r\n\tNSGrid.COLUMN_MOVING = \"columnMoving\";\r\n\tNSGrid.COLUMN_MOVED = \"columnMoved\";\r\n\tNSGrid.MULTI_SELECTION_EDITORS_TEXT = \"TEXT\";\r\n\tNSGrid.MULTI_SELECTION_EDITORS_TEXTAREA = \"TEXTAREA\";\r\n\tNSGrid.EDITOR_CELL_VALUE_CHANGED = \"editorCellValueChanged\";\r\n\t\r\n\t\r\n\t//Editors\r\n\tNSGrid.EDITOR_EDITTYPE_CELL = \"cell\";\r\n\tNSGrid.EDITOR_EDITTYPE_ROW = \"row\";\r\n\tNSGrid.EDITOR_EDITING_SINGLECLICK = \"singleClick\";\r\n\tNSGrid.EDITOR_EDITING_DOUBLECLICK = \"doubleClick\";\r\n\tNSGrid.EDITOR_EDITING_NOCLICK = \"noClick\";\r\n\tNSGrid.EDITOR_TYPE_TEXT = \"text\";\r\n\tNSGrid.EDITOR_TYPE_TEXTAREA = \"textArea\";\r\n\tNSGrid.EDITOR_TYPE_CUSTOM = \"custom\";\r\n\t\r\n\tNSGrid.FILTER_TYPE_DATE = \"date\";\r\n\tNSGrid.ADVANCED_FILTER_TEXT = \"text\";\r\n\tNSGrid.ADVANCED_FILTER_NUMBER = \"number\";\r\n\tNSGrid.ADVANCED_FILTER_LIST = \"list\";\r\n\tNSGrid.ADVANCED_FILTER_DATE = \"date\";\r\n\t\r\n\t\r\n\treturn NSGrid;\r\n})();\r\nnsModuleExport(this,\"NSGrid\",NSGrid);";
