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

GridTableView.swapColumns(index) doesn't work

14 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Murray
Top achievements
Rank 1
Murray asked on 04 Feb 2009, 10:27 PM
I have the following in my main page:
        var mtv = $find("<%= grdMain.ClientID %>").get_masterTableView();
        var un1 = mtv.get_columns()[1].get_uniqueName();
        var un2 = mtv.get_columns()[2].get_uniqueName();
        mtv.swapColumns(un1, un2);
        alert('mtv.swapColumns');
        mtv.moveColumnToLeft(3);
        alert('mtv.moveColumnToLeft');

swapColumns works and 1st alert displays and columns are swapped
but moveColumnToLeft doesn't work and 2nd alert is never called.


14 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 05 Feb 2009, 08:32 AM
Hi Murray,

I also tried to use the moveColumnToLeft() and moveColumnToRight() methods. I tried to find these methods for the MasterTableView with the help of QuickWatch window. But I was not able to find that. I hope the telerik team will have a solution for this.

Regards
Shinu

0
Nikolay Rusev
Telerik team
answered on 05 Feb 2009, 08:34 AM
Hello Murray,

There is no moveColumnToLeft method of GridTableView in RadGrid for ASP.NET AJAX.
You can use swapColumn or reorderColumns instead. moveColumnToLeft and moveColumnToRight are available in RadGrid for ASP.NET.

I hope this helps.

All the best,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Murray
Top achievements
Rank 1
answered on 11 Feb 2009, 09:50 PM
Nikolay,

I finally figured a way to reorder columns in grid based on list. Make sure you have ClientSettings set as below:
<script type="text/javascript">
    // columns is var of what order i want in grid using UniqueNames
    var columns = "City|Address|Region|Phone|CompanyName|CustomerID";
...
    function reorderColumns()
    {
        var mtv = $find("<%= grdMain.ClientID %>").get_masterTableView();
        var colNames = columns.split('|');
        var size = colNames.length;
        for (i = 0; i < size; i++)
        {
            var col = colNames[i];
            // 1st col in grid is at index 1
            var curCol = mtv.get_columns()[i+1].get_uniqueName();
            if (col != curCol)
                mtv.reorderColumns(col, curCol);
        }
    }
...

</script>
...
            <telerik:RadGrid
                    ID="grdMain" runat="server"
                    AllowPaging="True"
                    AutoGenerateColumns="False"
                    Skin="Sunset"
                    GridLines="None"
                    PageSize="12"
                    EnableViewState="false">
                <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="reorder">
                    <Selecting AllowRowSelect="True" />
...
                    <Columns>
                        <telerik:GridBoundColumn
                                HeaderText="Customer ID"
                                DataField="CustomerID"
                                UniqueName="CustomerID">
                            <HeaderStyle Width="80px" HorizontalAlign="left" />
                            <ItemStyle Width="80px" HorizontalAlign="left" />
                        </telerik:GridBoundColumn>
...

Thanks for your help.
Murray
0
Brian Azzi
Top achievements
Rank 2
answered on 15 Feb 2012, 08:19 PM
I realize this is a very old thread, but I am working on a similar problem with these methods & found that the current documentation does indeed show moveColumnToRight and moveColumnToLeft methods for the master table (and they do not appear to exist). You guys may want to update the documentation on this one... : )
0
Maria Ilieva
Telerik team
answered on 20 Feb 2012, 03:49 PM
Hi,

Find the topics for the both methods you mentioned:
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-movecolumntoleft.html
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-movecolumntoright.html

Regards,
Maria Ilieva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Brian Azzi
Top achievements
Rank 2
answered on 21 Feb 2012, 03:53 PM
Right... but that's my point. The documentation exists, but the client-side methods do not... (if you try to invoke either of these operations per the documentation it will throw a method does not exist type error).
0
Maria Ilieva
Telerik team
answered on 24 Feb 2012, 12:03 PM
Hello,

Note that moveColumnToLeft and moveColumnToRight are available in RadGrid for ASP.NET.
It seems we have missed to remove the mentioned properties from the documentation for the RadGrid for ASP.NET AJAX and accept our apologizes for that.
You can use swapColumn or reorderColumns instead.


Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Brian Azzi
Top achievements
Rank 2
answered on 24 Feb 2012, 02:47 PM
I assume you mean it is available for ASP.NET MVC? As far as I am aware there is no separate product between ASP.NET and ASP.NET AJAX... ? Or did you just mean that it is available in the server side code and not the client api?
0
Maria Ilieva
Telerik team
answered on 24 Feb 2012, 03:13 PM
Hi,

I mean that the mentioned properties have been available for the old classic RadGrid control for ASP.NET and not for the current version for RadControls for ASP.NET AJAX.  ASP.NET AJAX is a set of extensions to ASP.NET developed by Microsoft for implementing Ajax functionality.

All the best,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Brian Azzi
Top achievements
Rank 2
answered on 24 Feb 2012, 03:16 PM
Thanks for the clarification. ;)   ... and yes, I was referring to Telerik products, not MS (I know what ASP.NET AJAX extensions are *grin*). I hadn't realized that the older version of your product was labeled a little differently (though it makes sense).

0
Andy
Top achievements
Rank 2
answered on 16 Jan 2014, 08:06 PM
This still has not been corrected.
0
Maria Ilieva
Telerik team
answered on 17 Jan 2014, 03:36 PM
Hi Andy,

Could you please elaborate a bit more on the exact issue you are currently facing? Our local tests do not show any related to this thread issues to appear in our latest release.
It will be very helpful if you could open a separate thread and provide descriptive explanation of your problem, so that we could further assist.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Andy
Top achievements
Rank 2
answered on 17 Jan 2014, 03:55 PM
The issue is with your documentation, and it is very much related to this thread. RadGrid for ASP.NET AJAX does not contain the methods mentioned here.

Your documentation on the following pages shows methods for moveColumnToLeft and moveColumnToRight that do not exist in the actual controls:

http://www.telerik.com/help/aspnet-ajax/grid-getting-familiar-with-client-side-api.html
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-movecolumntoleft.html
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-movecolumntoright.html

RadGrid.TableView.moveColumnToRight() and RadGrid.TableView.moveColumnToLeft() do not exist on the client, and should either be removed from the documentation, or added to the control.
0
Maria Ilieva
Telerik team
answered on 20 Jan 2014, 03:41 PM
Hi Andy,

Thank you for your clarification.

It appears that we have missed to remove the mentioned deprecated methods from our documentation which obviously leads to misleading. Thank you for pointing this again. We will do our best to update the documentation for the next upload of our online help.

As a token of gratitude for pointing this out you will find your Telerik points updated.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Murray
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Murray
Top achievements
Rank 1
Brian Azzi
Top achievements
Rank 2
Maria Ilieva
Telerik team
Andy
Top achievements
Rank 2
Share this question
or