Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1015
Error: Cannot call methods on igGridHiding prior to initialization
posted

igGrid - IgniteUI 12.2.20122.2029

I'm getting this error when I try to show the Column Chooser.  I'm using jquery-1.8.3 if that makes a difference.

Error: cannot call methods on igGridHiding prior to initialization; attempted to call method 'showColumnChooser'
http://localhost:3000/Scripts/jquery-1.8.3.js

Essentially, I'm trying to add a button to the pager that will open up the column chooser.  I don't know why, but when I click the button it doesn't seem to know about the hiding feature of the grid.  Any ideas?  (full code attached)

rendered: function(evt, ui){
	var waitForPager = setInterval(function() {
		if ($('.ui-iggrid-pagerrecordslabel').length > 0)
		{
			clearInterval(waitForPager);

			$('<button>Choose Columns</button>')
				.insertAfter('.ui-iggrid-pagerrecordslabel')
				.button({icons: {primary: "ui-icon-wrench"}, text: true})
				.css('margin-left', '40px')
				.click(function(clickEvt){ 
					$("#MyGrid").igGridHiding("showColumnChooser"); 
				});					
		}
	}, 10);
}

  • 24671
    Verified Answer
    posted

    Hi Dirq,

    is #MyGrid a div? 

    Thanks,

    Angel

  • 1015
    posted in reply to Alexander Todorov

    I just read that in the known issues! I wish I would have seen this post a couple hours ago.  

    If a grid is instantiated from a DIV element, the API calls to the grid's features do not work as expected. The best solution is to use a TABLE element as the base element for the igGrid. If a DIV must be used, continue with the following workaround.

    The calls to the API of the grid's features should rely on the table that they are actually attached to: [gridElementId]_table. If the grid is bound to a DIV with id attribute set to "grid1"the easiest way to reference that table is to use either the grid's id() or widget() API methods like shown here:

    http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/Known_Issues_and_Limitations_2012_Volume_2.html#_Ref321736823