This is a migrated thread and some comments may be shown as answers.

[Solved] RAD Grid show/Hide Column issue

3 Answers 324 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ajay Khedekar
Top achievements
Rank 1
Ajay Khedekar asked on 10 Nov 2009, 12:43 PM

Hello,

        I want hide/unhide radgrid column depends on certain conditions.

       I have used Followinf Code provided by you on link
       http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientsideapi/defaultcs.aspx

       function HideColumn(index)
                    {
                     var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
                     if(index < 0 || index > columnCount)
                     {
                     alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
                     }
                     else
                     {
                         RadGrid1.get_masterTableView().hideColumn(index);
                        }
                    }

                    function ShowColumn(index)
                    {
                     var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
                     if(index < 0 || index > columnCount)
                     {
                     alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
                     }
                     else
                     {
                         RadGrid1.get_masterTableView().showColumn(index);
                        }
                    }

        I have also set  AllowColumnHide="True" property.

         This code works well only when I provide dedicated button to call this methods.But when I call this Methods in between execution of business logic, I get follwoing problems

      1. showColumn(columnindex) itself hides the column
      2. once column is not visibile, it will not become visible even after calling "showColumn" Method.
      3. showColumn(columnindex) takes significant time to execute

Am I missing any property or any thing....

any help will be highly appreciated...
 
thanks in advance,

Ajay



3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Nov 2009, 06:39 AM
Hi Ajay,

Could you be a bit more specific as to what you mean by  "in between execution of business logic" - could you provide your code for that - please, use the code formatter tool of the ticket editor to paste your code.

Greetings,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ajay Khedekar
Top achievements
Rank 1
answered on 13 Nov 2009, 07:08 AM
Hello,

          thanks for the reply....

         As per the Example shown on this link
          http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientsideapi/defaultcs.aspx

          If I have radgrid which is filled with data . and then I have 2 buttons, one as "ShowColumn" Button and second as "Hide Column"   button. Now I will have 2 delegate methods to handle this button's click events.In this method if i call following method respectively,it hide/Unhide column smoothly.

                 function HideColumn(index)
                    {
                     var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
                     if(index < 0 || index > columnCount)
                     {
                     alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
                     }
                     else
                     {
                         RadGrid1.get_masterTableView().hideColumn(index);
                        }
                    }

                    function ShowColumn(index)
                    {
                     var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
                     if(index < 0 || index > columnCount)
                     {
                     alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
                     }
                     else
                     {
                         RadGrid1.get_masterTableView().showColumn(index);
                        }
                    }

     Now ,what I mean by "in between execution of business logic" is, 

    1. I will click my Save Button, which will  save my screen data to database...
    2. Then I will populate the latest data on my screen, same time I will populate my Radgrid data
    3. Now I will check some boolean value,if it is "1" then I will call "HideColumn" method to hide column from grid, if that value is "0" then I will call "ShowColumn" method to show column from the grid...

    In this scenario , I get following problems

      1. showColumn(columnindex) itself hides the column
      2. once column is not visibile, it will not become visible even after calling "showColumn" Method.
      3. showColumn(columnindex) takes significant time to execute


thanks,
Ajay
0
Tsvetoslav
Telerik team
answered on 13 Nov 2009, 01:28 PM
Hello Ajay,

I read through your latest post, however, without a test project it is not possible to say what exactly might be causing the issues you have faced. I'd ask you to open a formal support ticket, attach a fully-runnable version of your implementation where the problems are reproduced and send it to us for  debugging. We shall inspect it and get back to you with our findings.

Thanks.

All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Ajay Khedekar
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Ajay Khedekar
Top achievements
Rank 1
Share this question
or