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
Infragistics - show/hide columns in code (not using default column chooser dialog)
I have implemented custom column chooser dialog. When user submit changes I have two arrays:
keysOfColumnsToShow (example: ['key1', 'key2', ...])
keysOfColumnsToHide (example: ['key3', 'key4', ...])

I have debugged and keys are fine. Now I try to apply changes in code. To do this I use igGridHiding method:

$(".grid").igGridHiding("showMultiColumns", keysOfColumnsToShow)
$(".grid").igGridHiding("hideMultiColumns", keysOfColumnsToHide)

The problem is that after calling igGridHiding method, some headers are not above corrent column and some headers are empty.

What is the correct way to manage hiding/showing columns in code without using default dialog?

  • 345
    Offline posted

    Hello Pawel,


    Both the showMultiColumns and hideMultiColumns methods are asynchronous, meaning if you call them like you showed in the code they could be running in parallel.

    That is why they accept a callback function – it would allow you to call the second one only after the first one has finished.

    Could you try calling them like this and see if this would fix the problem:

    $("#grid").igGridHiding("showMultiColumns", keysOfColumnsToShow, function(){
       $("#grid").igGridHiding("hideMultiColumns", keysOfColumnsToHide)

    Please note that I have also changed the jQuery CSS selector, as I noticed you are targeting a class instead of an ID.


    If you need any additional assistance, feel free to contact me.