Welcome Guest Search | Active Topics | Sign In | Register

Grid Sort - index doesn't change? Options
Bobby Lee
Posted: Monday, February 21, 2011 11:17:57 AM
Rank: Member
Groups: Member

Joined: 12/28/2010
Posts: 10
I know I'm probably doing something wrong here, but was hoping someone could help me identify and fix it.

I have a grid, and when I turn on sorting, the sort on screen works, but behind the scenes, all my values stay the same for the grid, even though the display changes as it should. for example.

SCREEN SHOWS 3 invoices, showing the vendor name here

Larry's Lounge
Shirty's Shirts
Archers Flemp

BEHIND THE SCENE VALUES (first value is the invoice ID)

[7,,,,7,,'1216','7/1/2010','8465.25','Larry\'s Lounge','1/1/2010',0,0]
[9,,,,9,,'1218','9/1/2010','546.54','Shirty\'s Shirts','1/1/2010',0,0]
[16,,,,16,,'1224','03/15/2001','124.45','Archers Flemp','1/1/2010',0,0]

I DO A SORT COLUMN ON SCREEN

SCREEN SHOWS

Sponge World
Fairy Tales
Toy Dogs

BUT NONE OF THE BEHIND THE SCENE VALUES CHANGE.
[7,,,,7,,'1216','7/1/2010','8465.25','Larry\'s Lounge','1/1/2010',0,0]
[9,,,,9,,'1218','9/1/2010','546.54','Shirty\'s Shirts','1/1/2010',0,0]
[16,,,,16,,'1224','03/15/2001','124.45','Archers Flemp','1/1/2010',0,0]


Is there a function I need to call to update this after a sort?
eo_support
Posted: Monday, February 21, 2011 11:41:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The "behind the scene" value you saw should not matter. Those are initial value. When the page loads, the Grid loads initial cell values from there. After that you can change/sort/add/delete on the Grid and all the changes are maintained by the Grid, it no longer has anything to do with those values.

You can use either our client side API to access the Grid cell value before posting back; Or access grid cell value on the server side after posting back. In both cases you will get the updated value. The initial value was internally used by the Grid to construct the updated values. However in no case that should matters to you at all.

Thanks!
Bobby Lee
Posted: Monday, February 21, 2011 2:04:01 PM
Rank: Member
Groups: Member

Joined: 12/28/2010
Posts: 10
Okay, when they click the grid I do this

function OnInvoiceItemSelected(grid) {
var item = grid.getSelectedItem();

grid.raiseItemCommandEvent(item.getIndex(), "select");

}


Then in my vb file I do this

Protected Sub GridInvoice_ItemCommand(ByVal sender As Object, ByVal e As EO.Web.GridCommandEventArgs) Handles GridInvoice.ItemCommand
Dim lId As Integer = 0
Id = e.Item.Key



This grabs the correct key until I change the sort, after sorting, it grabs the original key value, not the new sorted displayed value. What am I doing wrong?
Bobby Lee
Posted: Monday, February 21, 2011 2:09:09 PM
Rank: Member
Groups: Member

Joined: 12/28/2010
Posts: 10
Not sure if it matters or not, but here's my column setup for the sortable column in my grid and the ID field

<eo:StaticColumn DataField="ID" DataType="Integer" HeaderText="ID" ReadOnly="True" Visible="False"></eo:StaticColumn>
<eo:StaticColumn DataField="invoice_number" AllowSort="true" HeaderText="Invoice #" Name="Number"></eo:StaticColumn>
eo_support
Posted: Monday, February 21, 2011 2:51:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We tested your code and it's working correctly here. Can you create a full test page that demonstrates the problem?

Thanks!
Bobby Lee
Posted: Monday, February 21, 2011 3:01:23 PM
Rank: Member
Groups: Member

Joined: 12/28/2010
Posts: 10
did you sort the grid, then check it? That's what I'm getting the same initial key value for the cell after sorting.

Not sure how I'd make up a test page as the grid pulls data from my database.
eo_support
Posted: Monday, February 21, 2011 3:13:43 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Yes. We did sort the Grid first, then select a Grid item which triggers ClientSideOnItemSelected event handler.

You will have to isolate the problem from the rest of your project and your database. For example, to change your code to populate the Grid from a hardcoded DataTable. We will need to run the code here in order to see what's happening, so the test code can not rely on your database.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.