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

Re-Ordering Rows in same grid

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 09 Jun 2010, 03:12 PM
hi,

  i've got a grid populated with data.

  i now want to alter the ordering of this data by dragging and dropping rows within this grid.

  i've looked at your drag/drop example ...

      http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx

  and it's more involved than i need.

  simply put, i want to re-order content, client side, without going back to the server -- or at least without having to load up my data again ... as it seems to be doing in your example - see GetOrders()

  are there any examples out there to do this ?

  thanks. info appreciated.

Andy

2 Answers, 1 is accepted

Sort by
0
Andy
Top achievements
Rank 1
answered on 10 Jun 2010, 11:01 AM
come on Telerik, 19 hours and no help ????

we're evaluating this product and need to make a decision on this products suitability as soon as possible.

help would be appreciated !! . please!! ...

to recap, i've got a grid, filled with data. server side binding.

i've set the grid up to allow drag and drop.

in your examples, you use server side logic.

there's no point for us. we don't need to go back to the server. we need a client side solution.

i've tried the server side solution, and it doesn't seem to work for us. I'm sure i've done something wrong, but i don't want to spend any more time on this, since a client side solution would make more sense for us.

this grid is accessible via client script, correct ? your documentation says yes, but i need to know the following:

1. is it possible to access individual cells and to change them ? if so, how ?
2. is is possible to get the index of the source and destination rows involved in the drag/drop operation ?  if so, how ?

(the idea being that i'm just going to swap the two rows around that are involved in the drag/drop operation)

and unless i've missed something , a previous product we evaluated made this process very easy. we simply set a flag on their grid object and that was it. drag and drop (on the same grid to reorder) worked. no hassles. so i'm wondering if i've missed something with your product because i seem to be having to spend a lot more time on this than i thought i would.
 and the rest of your functionality is largely automated.

so please, please, can you help us out. it would be very much appreciated so we can move onto other things.

here's my grid if this helps. ask if you need any more information. i will be happy to provide. thanks

<

 

telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1"

 

 

EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true"

 

 

AllowSorting="True" ShowGroupPanel="True" AllowPaging="True" PageSize="10" OnNeedDataSource="grdPendingOrders_NeedDataSource"

 

 

runat="server" GridLines="None"

 

 

OnExcelMLExportStylesCreated="RadGrid1_ExcelMLExportStylesCreated"

 

 

OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated"

 

 

OnItemCommand="RadGrid1_ItemCommand" ShowFooter="True"

 

 

AllowMultiRowSelection="true" EnableTheming="true" AutoGenerateColumns="false"

 

 

Skin="Windows7" OnRowDrop="grdPendingOrders_RowDrop" >

 

 

 

<MasterTableView CommandItemDisplay="Top" DataKeyNames="intArticleID" >

 

 

<PagerStyle Mode="Slider" />

 

 

<CommandItemSettings

 

 

ShowExportToWordButton="true"

 

 

ShowExportToExcelButton="true"

 

 

ShowExportToCsvButton="true"

 

 

ShowExportToPdfButton="true"

 

 

/>

 

 

<Columns>

 

 

<telerik:GridBoundColumn SortExpression="intArticleID" HeaderText="intArticleID" HeaderButtonType="TextButton" DataField="intArticleID" HeaderStyle-Width="200px"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn SortExpression="strHeadline" HeaderText="Headline" HeaderButtonType="TextButton" DataField="strHeadline" HeaderStyle-Width="200px"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn SortExpression="strPublicationName" HeaderText="Publication name" HeaderButtonType="TextButton" DataField="strPublicationName" HeaderStyle-Width="200px"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn SortExpression="strSummary" HeaderText="Summary" HeaderButtonType="TextButton" DataField="strSummary" />

 

 

<telerik:GridBoundColumn SortExpression="dteProcessed" HeaderText="Date" HeaderButtonType="TextButton" DataField="dteProcessed" HeaderStyle-Width="100px"/>

 

 

<telerik:GridBoundColumn SortExpression="dtePubDate" HeaderText="Pub Date" HeaderButtonType="TextButton" DataField="dtePubDate" HeaderStyle-Width="100px"/>

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

<ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True" AllowRowsDragDrop="true">

 

 

<Selecting AllowRowSelect="True" EnableDragToSelectRows="false"></Selecting>

 

 

<Scrolling AllowScroll="true" ScrollHeight="600px" UseStaticHeaders="true" FrozenColumnsCount="0" SaveScrollPosition="true" />

 

 

<Resizing AllowColumnResize="true"></Resizing>

 

 

<ClientEvents OnRowDropping="onRowDropping" />

 

 

</ClientSettings>

 

 

<GroupingSettings ShowUnGroupButton="true" />

 

 

 

</telerik:RadGrid>

 

0
Yavor
Telerik team
answered on 15 Jun 2010, 07:08 AM
Hello Andy,

The drag and drop functionality relies on persisting the change on the server, in the underlying database. This ensures the integrity of the information and the data. You can couple this with Ajax, to simulate client side performance.
You can also alter the values of any call in the grid, thus potentially simulating a client side reorder of the columns:

http://www.telerik.com/help/aspnet-ajax/grid_getcellbycolumnuniquename.html

However, this approach is prone to error, and will not persist the values on the server/database.
I hope this information help - let me know if further questions arise.

Kind regards,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Andy
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or