sodri126 / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 0 forks source link

When you use a column which not contain string data, error has no method 'toLowerCase' happens #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It must be contemplated with try catch or something when the data is not 
string, but numeric.

Thanks,

Original issue reported on code.google.com by axi...@gmail.com on 16 Sep 2012 at 4:56

GoogleCodeExporter commented 9 years ago
This error is happening in _fnGetCleanedGroup(sGroup) and is caused by sGroup 
being typeof number, A fix would be changing:
            function _fnGetCleanedGroup(sGroup) {
                if (sGroup === "") return "-";
                return sGroup.toLowerCase().replace(/[^a-zA-Z0-9\u0080-\uFFFF]+/g, "-"); //fix for unicode characters (Issue 23)
                //return sGroup.toLowerCase().replace(/\W+/g, "-"); //Fix provided by bmathews (Issue 7)
            }

to 

            function _fnGetCleanedGroup(sGroup) {
                if (sGroup === "") return "-";
        if (typeof sGroup == "number") sGroup = sGroup.toString();
                return sGroup.toLowerCase().replace(/[^a-zA-Z0-9\u0080-\uFFFF]+/g, "-"); //fix for unicode characters (Issue 23)
                //return sGroup.toLowerCase().replace(/\W+/g, "-"); //Fix provided by bmathews (Issue 7)
            }

Original comment by chris.go...@jupix.com on 29 Jan 2015 at 1:52