{"action":"created","issue":{"url":"https://api.github.com/repos/handsontable/handsontable/issues/2399","repository_url":"https://api.github.com/repos/handsontable/handsontable","labels_url":"https://api.github.com/repos/handsontable/handsontable/issues/2399/labels{/name}","comments_url":"https://api.github.com/repos/handsontable/handsontable/issues/2399/comments","events_url":"https://api.github.com/repos/handsontable/handsontable/issues/2399/events","html_url":"https://github.com/handsontable/handsontable/issues/2399","id":70426879,"number":2399,"title":"Handsontable.renderers.registerRenderer runs twice when fixedColumnsLeft is used","user":{"login":"glmonroe2001","id":10235505,"avatar_url":"https://avatars.githubusercontent.com/u/10235505?v=3","gravatar_id":"","url":"https://api.github.com/users/glmonroe2001","html_url":"https://github.com/glmonroe2001","followers_url":"https://api.github.com/users/glmonroe2001/followers","following_url":"https://api.github.com/users/glmonroe2001/following{/other_user}","gists_url":"https://api.github.com/users/glmonroe2001/gists{/gist_id}","starred_url":"https://api.github.com/users/glmonroe2001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glmonroe2001/subscriptions","organizations_url":"https://api.github.com/users/glmonroe2001/orgs","repos_url":"https://api.github.com/users/glmonroe2001/repos","events_url":"https://api.github.com/users/glmonroe2001/events{/privacy}","received_events_url":"https://api.github.com/users/glmonroe2001/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/handsontable/handsontable/labels/Assistance%20needed","name":"Assistance needed","color":"0052cc"},{"url":"https://api.github.com/repos/handsontable/handsontable/labels/Improvement%20suggestion","name":"Improvement suggestion","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-23T14:30:14Z","updated_at":"2016-03-03T15:24:37Z","closed_at":null,"body":"In the below code, when the fixedColumnsLeft is configured, then the validateNPI function will run twice for the first column. The other columns are unaffected.\r\n\t\t\tj$=jQuery.noConflict();\r\n\t\t\t\r\n\t\t\tvar ErrorMsg = '';\r\n\t\t\t\r\n\t\t\tvar runValidateNPI = false;\r\n\t\t\tvar runValidateName = false;\r\n\t\t\tvar runValidateColumnCount = false;\r\n\r\n\t\t\tvar NPIData = {!npisJSON}, container, hot1;\r\n\r\n\t\t\t// maps function to lookup string\r\n\t\t\tHandsontable.renderers.registerRenderer('validateNPI', validateNPI);\r\n\r\n\t\t\t// maps function to lookup string\r\n\t\t\tHandsontable.renderers.registerRenderer('validateName', validateName);\r\n\r\n\t\t\t// maps function to lookup string\r\n\t\t\tHandsontable.renderers.registerRenderer('validateColumnCount', validateColumnCount);\r\n\r\n\t\t\tcontainer = document.getElementById('dataTable');\r\n\r\n\t\t\thot1 = new Handsontable(container, {\r\n\t    \t\tdata: NPIData,\r\n\t    \t\tcolHeaders: ['NPI', 'First Name', 'Last Name'],\r\n\t    \t\trowHeaders: true,\r\n\t    \t\tcontextMenu: true,\r\n\t    \t\tcolumns: [\r\n\t    \t\t\t{data: 'NPI__c'},\r\n\t    \t\t\t{data: 'First_Name__c'},\r\n\t    \t\t\t{data: 'Last_Name__c'}\r\n\t    \t\t],\r\n\t    \t\tminspareRows: 1,\r\n\t    \t\t//////////////////////////////////////////////\r\n\t    \t\t//////////////////////////////////////////////\r\n\t    \t\t//////////////////////////////////////////////\r\n\t    \t\t// If the fixedColumnsLeft line is uncommented, then the Handsontable.renderers.registerRenderer('validateNPI', validateNPI) function runs twice\r\n\t    \t\t//////////////////////////////////////////////\r\n\t    \t\t//////////////////////////////////////////////\r\n\t    \t\t//////////////////////////////////////////////\r\n\t\t\t\t//fixedColumnsLeft: 1,\r\n\t\t\t\tcontextMenu: true,\r\n\t\t\t\tmanualColumnMove: true,\r\n\t\t\t\tmanualRowMove: true,\r\n\t\t\t\tminSpareRows: 1,\r\n\t\t\t\tcolWidths: [100, 800, 800],\r\n\t\t\t\tcolumnSorting: true,\r\n\t\t\t\tcells: function (row, col, prop)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar cellProperties = {};\r\n\r\n\t\t\t\t\tif (col == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcellProperties.renderer = \"validateNPI\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (col == 1 || col == 2)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcellProperties.renderer = \"validateName\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (col >= 3)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcellProperties.rendered = \"validateColumnCount\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn cellProperties;\r\n\t\t\t\t}\r\n\t  \t\t});\r\n\t  \t\tfunction saveNPI()\r\n\t  \t\t{\r\n\t  \t\t\tvar myJsonString = JSON.stringify(NPIData);\r\n\t  \t\t}\r\n\r\n\t  \t\tfunction returnJSON()\r\n\t  \t\t{\r\n\t  \t\t\tvar myJsonString = JSON.stringify(NPIData);\r\n\t  \t\t\treturn myJsonString;\r\n\t  \t\t}\r\n\r\n\t\t\tfunction setJson()\r\n\t\t\t{\r\n    \t\t\tjQuery('[id$=myHiddenJsonField]').val(returnJSON());\r\n    \t\t\t//passJsonToController();\r\n    \t\t\tNPIData = JsonParam\r\n\t\t\t}\r\n\r\n\t\t\t//function validateNPI()\r\n\t\t\tfunction validateNPI(instance, td, row, col, prop, value, cellProperties)\r\n\t\t\t{\r\n\t\t\t\t//if (value != null && !runValidateNPI)\r\n\t\t\t\tif (value != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tHandsontable.renderers.TextRenderer.apply(this, arguments);\r\n\t\r\n\t\t\t\t\t//var NPI = document.getElementById('{!$Component.NPIForm.NPIBlock.NPIField}');\r\n\t\t\t\t\tvar NPI = value;\r\n\t\t\t\t\t//alert(\"NPI is \" + NPI);\r\n\t\t\t\t\tvar sAnticipatedNPI = '';\r\n\t\t\t        if(NPI.length !=10)\r\n\t\t\t        {\r\n\t\t\t        \t//var d = new Date();\r\n\t\t\t            ErrorMsg += 'In Row ' + (row + 1) + ': NPI must be ten digits!!!<br/>';\r\n\t\t\t            //return false;\r\n\t\t\t            td.style.background = 'red';\r\n\t\t\t            td.style.color = 'white';\r\n\t\t\t        }\r\n\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t//alert(\"In NPI \" + ErrorMsg);\r\n\t\t\t\t//runValidateNPI = true;\r\n\t\t\t}\r\n\r\n\t\t\tfunction validateName(instance, td, row, col, prop, value, cellProperties)\r\n\t\t\t{\r\n\t\t\t\t//if (value != null && !runValidateName)\r\n\t\t\t\tif (value != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tHandsontable.renderers.TextRenderer.apply(this, arguments);\r\n\t\r\n\t\t\t\t\tvar Name = value;\r\n\r\n\t\t\t        if(Name.length > 80)\r\n\t\t\t        {\r\n\t\t\t        \t//var d = new Date();\r\n\t\t\t            ErrorMsg += 'In Row ' + (row + 1) + ': Name must be less than 80 digits!!!<br/>';\r\n\t\t\t            //return false;\r\n\t\t\t            td.style.background = 'red';\r\n\t\t\t            td.style.color = 'white';\r\n\t\t\t        }\r\n\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//alert(\"In name \" + ErrorMsg);\r\n\t\t\t\t//runValidateName = true;\r\n\t\t\t}\r\n\r\n\t\t\tfunction validateColumnCount(instance, td, row, col, prop, value, cellProperties)\r\n\t\t\t{\r\n\t\t\t\t//if (value != null  && !runValidateColumnCount)\r\n\t\t\t\tif (value != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tHandsontable.renderers.TextRenderer.apply(this, arguments);\r\n\t\r\n\t\t\t\t\tvar Name = value;\r\n\r\n\t\t\t        if(Name >= 3)\r\n\t\t\t        {\r\n\t\t\t        \t//var d = new Date();\r\n\t\t\t            ErrorMsg += 'In Row ' + (row + 1) + ': Too many columns<br/>';\r\n\t\t\t            //return false;\r\n\t\t\t            td.style.background = 'red';\r\n\t\t\t            td.style.color = 'white';\r\n\t\t\t        }\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//alert(\"In name \" + ErrorMsg);\r\n\t\t\t\t//runValidateColumnCount = true;\r\n\t\t\t}\r\n"},"comment":{"url":"https://api.github.com/repos/handsontable/handsontable/issues/comments/191813417","html_url":"https://github.com/handsontable/handsontable/issues/2399#issuecomment-191813417","issue_url":"https://api.github.com/repos/handsontable/handsontable/issues/2399","id":191813417,"user":{"login":"AMBudnik","id":10757813,"avatar_url":"https://avatars.githubusercontent.com/u/10757813?v=3","gravatar_id":"","url":"https://api.github.com/users/AMBudnik","html_url":"https://github.com/AMBudnik","followers_url":"https://api.github.com/users/AMBudnik/followers","following_url":"https://api.github.com/users/AMBudnik/following{/other_user}","gists_url":"https://api.github.com/users/AMBudnik/gists{/gist_id}","starred_url":"https://api.github.com/users/AMBudnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AMBudnik/subscriptions","organizations_url":"https://api.github.com/users/AMBudnik/orgs","repos_url":"https://api.github.com/users/AMBudnik/repos","events_url":"https://api.github.com/users/AMBudnik/events{/privacy}","received_events_url":"https://api.github.com/users/AMBudnik/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T15:24:37Z","updated_at":"2016-03-03T15:24:37Z","body":"Hi @glmonroe2001 there was many changes since this idea. Could you create a pull request for this one?"}}