🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.aspdotnet.components.using
3 messages
3 total messages Started by John Mace Wed, 01 Feb 2006 12:18
Sorting in DBWebGrid
#160
Author: John Mace
Date: Wed, 01 Feb 2006 12:18
11 lines
1295 bytes
Hi,

Using D2006E, I'm having a problem sorting a DBWebGrid. When I set 
AllowSorting to True, the header is underlined and makes a round trip to the 
server when clicked as expected. Althought the Sort Expression is properly 
set through the Property Builder, the grid is not sorted.

It seems to me that there is sufficient information in the property settings 
to perform the sort. What am I missing?

John 
Re: Sorting in DBWebGrid
#161
Author: John Moshakis
Date: Thu, 02 Feb 2006 03:02
43 lines
2081 bytes
John Mace wrote:

> Hi,
> 
> Using D2006E, I'm having a problem sorting a DBWebGrid. When I set
> AllowSorting to True, the header is underlined and makes a round trip
> to the server when clicked as expected. Althought the Sort Expression
> is properly set through the Property Builder, the grid is not sorted.
> 
> It seems to me that there is sufficient information in the property
> settings to perform the sort. What am I missing?
> 
> John

Hi John,

You need to add a SortCommand event handler and perform the sorting
yourself.

A couple of things to be aware of with the dbwebgrid. When you postback
it applies any changes you have made on the client into the dataset.
You therefore have to make sure that the selected row is the same
before and after you have applied the sort. Something like

SortCommand(source:TObject;e:DataGridSortCommandEventArgs)
begin
selectedIndex:=dbWebGrid1.SelectedIndex
{get the primary key value for that row
{perform the sort}
{find the index of the row with the primary key value}
(dbWebDataSource1 as Borland.Data.Web.IDBPostStateManager).SetCurrentRow


end

The other thing you need to be aware of that the dbwebdatasource is
caching the dataset and I think this interferes with the sorting so set
AutoRefresh to true and do the caching yourself.


Cheers,
John
-- 
Re: Sorting in DBWebGrid
#162
Author: John Mace
Date: Thu, 02 Feb 2006 19:16
59 lines
3042 bytes
Hi John,

What, then, do you suppose is the purpose of the Sort Expresson on the 
Columns tab of the Property Builder?

I notice that neither the Data Member nor the Data Key Field on the General 
tab of the Property Builder are persisted. Since both of these values would 
be required for the DBWebGrid to perform a sort, I suspect that this is 
related to the problem. Would you agree?


John

"John Moshakis" <john@moshakis.com> wrote in message 
news:43e18447@newsgroups.borland.com...
> John Mace wrote:
>
>> Hi,
>>
>> Using D2006E, I'm having a problem sorting a DBWebGrid. When I set
>> AllowSorting to True, the header is underlined and makes a round trip
>> to the server when clicked as expected. Althought the Sort Expression
>> is properly set through the Property Builder, the grid is not sorted.
>>
>> It seems to me that there is sufficient information in the property
>> settings to perform the sort. What am I missing?
>>
>> John
>
> Hi John,
>
> You need to add a SortCommand event handler and perform the sorting
> yourself.
>
> A couple of things to be aware of with the dbwebgrid. When you postback
> it applies any changes you have made on the client into the dataset.
> You therefore have to make sure that the selected row is the same
> before and after you have applied the sort. Something like
>
> SortCommand(source:TObject;e:DataGridSortCommandEventArgs)
> begin
> selectedIndex:=dbWebGrid1.SelectedIndex
> {get the primary key value for that row
> {perform the sort}
> {find the index of the row with the primary key value}
> (dbWebDataSource1 as Borland.Data.Web.IDBPostStateManager).SetCurrentRow
>
>
> end
>
> The other thing you need to be aware of that the dbwebdatasource is
> caching the dataset and I think this interferes with the sorting so set
> AutoRefresh to true and do the caching yourself.
>
>
> Cheers,
> John
> -- 
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads