Article View: borland.public.delphi.aspdotnet.components.using
Article #162Re: Sorting in DBWebGrid
From: John Mace
Date: Thu, 02 Feb 2006 19:16
Date: Thu, 02 Feb 2006 19:16
59 lines
3042 bytes
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
> --
>
Technical Details
Message-ID:
<43e259d9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43e0a63b$1@newsgroups.borland.com> <43e18447@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 21665a,389ecb60fa9cc66d X-Google-Attributes: gid21665a,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "John Mace" <mace@gmavt.net> From: "John Mace" <mace@gmavt.net> Newsgroups: borland.public.delphi.aspdotnet.components.using References: <43e0a63b$1@newsgroups.borland.com> <43e18447@newsgroups.borland.com> Subject: Re: Sorting in DBWebGrid Date: Thu, 2 Feb 2006 14:16:49 -0500 Lines: 61 Organization: Times*Sign X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 69.54.29.11 Message-ID: <43e259d9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1138907609 69.54.29.11 (2 Feb 2006 11:13:29 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail