Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81688

ColReorder 1.9.1-1.9.4 -> 'this.s.aoTargets[...].x' is null or not an obj

$
0
0
I tried 1.9.1 and 1.9.4 with IE8 and I get this error. It doesn't happen with FireFox.

this.s.aoTargets is being dereferenced by -1 because this.s.aoTargets.length is 0. But I do not know why. It should not be 0. I don't think I am doing anything too special.

This error happens here:

/* The insert element wasn't positioned in the array (less than operator), so we put it at 
 * the end
 */
if ( !bSet )
{
	this.dom.pointer.style.left = this.s.aoTargets[this.s.aoTargets.length-1].x +"px";
	this.s.mouse.toIndex = this.s.aoTargets[this.s.aoTargets.length-1].to;
}

I am using this option:

, "oColReorder": {
                "iFixedColumns": 7
} 

My ~initial~ column setup looks like this:

var aoColumnDefs = [
        {
            "aTargets": [0]
            , "sTitle": "Group"
            , "bSearchable": false
            , "bVisible": false
        }
        , {
            "aTargets": [1]
            , "sTitle": "Name"
            , "bSearchable": false
            , "bVisible": false
        }
        , {
            "aTargets": [2]
            , "sTitle": "Parameter"
            , "bSearchable": true
            , "bVisible": true
        }
        , {
            "aTargets": [3]
            , "sTitle": "Flavor"
            , "bSearchable": true
            , "bVisible": true
        }
        , {
            "aTargets": [4]
            , "sTitle": "Unit"
            , "bSearchable": true
            , "bVisible": true
        }
        , {
            "aTargets": [5]
            , "sTitle": "Difference"
            , "bSearchable": true
            , "bVisible": false
            , "fnRender": function (obj) {

                var numRecipes = obj.oSettings.aoColumns.length - 7;
                if (numRecipes < 2) {
                    return "N";
                }
                
                for (var i = 7; i < (7 + numRecipes); i++) {
                    if (i == 7) {
                        continue;
                    }

                    if (obj.aData[7] != obj.aData[i]) {
                        return "Y";
                    }
                }

                return "N";
            }
            , "bUseRendered": true
        }
        , {
            "aTargets": [6]
            , "sTitle": "NonEmpty"
            , "bSearchable": true
            , "bVisible": false
            , "fnRender": function (obj) {
                            
                var numRecipes = obj.oSettings.aoColumns.length - 7;
                if (numRecipes == 0) {
                    return "N";
                }
                
                for (var i = 7; i < (7 + numRecipes); i++) {
                    
                    if ($(obj.aData[i]).text().length == 0) {
                        return "N";
                    }
                }

                return "Y";

            }
            , "bUseRendered": true
        }
    ];

The reason I am fixing the first 7 columns when there are only 7 columns is that I am dynamically adding columns to aaData and & aoColumnDefs and completely recreating the datatable from scratch after removing and replacing the html table. But I don't see how this would cause my problem.

If I unhide the columns which set bVisible to false, then it works. But I want some columns to be always hidden.

Can ColReorder handle hidden columns? Is iFixedColumns supposed to specify the number of fixed columns excluding hidden columns?

Thanks a lot!

Robert

Viewing all articles
Browse latest Browse all 81688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>