In my project i use sorting with column header is clicked , it works well with standard version but when i use the 2.1.1.0 beta , only the selected row is updated ...
can you help ?
procedure TWebDBGridHelper.ChangeTri(ACol: Integer; Dataset: TXDataWebDataSet);
var
LIndex: string;
desc: boolean;
opt: TIndexOptions;
begin
if ACol < Self.FixedCols then
Exit;
LIndex := 'By' + Self.Columns[ACol - Self.FixedCols].DataField;
// toggle sort order when the same column is clicked
desc := SameText(Dataset.ActiveIndex, LIndex);
if desc then
LIndex := LIndex + 'Desc';
opt := [];
if desc then
opt := opt + [ixDescending];
// clear any previous indexes and add the new index to sort
Dataset.Indexes.Clear;
Dataset.Indexes.Add(LIndex, Self.Columns[ACol - Self.FixedCols].DataField, opt);
Dataset.ActiveIndex := LIndex;
// set the sort indicator in the grid column header
if ixDescending in Dataset.Indexes.Find(LIndex).Options then
Self.Columns[ACol - Self.FixedCols].SortIndicator := siDescending
else
Self.Columns[ACol - Self.FixedCols].SortIndicator := siAscending;
end;
Can you check the demo Demo\Basics\DBGrid for an example of how to sort from the TWebDBGrid.
I retested this demo and this works as expected with the latest version of TMS WEB Core.
Hi, the demo works as expected in both version but i use TXdataWebDataset instead of TClientdataset
so in the following videos i install beta version , recompile and run , nothing else changed
you can see it working in standard but in beta only the first line is changing.
Standard version
beta version
Do you implement OnFixedCellClick like in demo Demo\Basics\DBGrid ?
If not, what exact code do you use?
Please provide a test project with which we can reproduce this here.
Hi,
I made exactly as it is in the dbgrid demo except i use a procedure in webdbgrid helper and dataset is a TXdataWebDataset
procedure TFrmTotalTickets.WebDBGrid1FixedCellClick(Sender: TObject; ACol, ARow: Integer);
begin
WebDBGrid1.ChangeTri(ACol, adsTotal_tickets);
end;
procedure TWebDBGridHelper.ChangeTri(ACol: Integer; Dataset: TXDataWebDataSet);
var
LIndex: string;
desc: boolean;
opt: TIndexOptions;
begin
if ACol < Self.FixedCols then
Exit;
LIndex := 'By' + Self.Columns[ACol - Self.FixedCols].DataField;
// toggle sort order when the same column is clicked
desc := SameText(Dataset.ActiveIndex, LIndex);
if desc then
LIndex := LIndex + 'Desc';
opt := [];
if desc then
opt := opt + [ixDescending];
// clear any previous indexes and add the new index to sort
Dataset.Indexes.Clear;
Dataset.Indexes.Add(LIndex, Self.Columns[ACol - Self.FixedCols].DataField, opt);
Dataset.ActiveIndex := LIndex;
// set the sort indicator in the grid column header
if ixDescending in Dataset.Indexes.Find(LIndex).Options then
Self.Columns[ACol - Self.FixedCols].SortIndicator := siDescending
else
Self.Columns[ACol - Self.FixedCols].SortIndicator := siAscending;
end;
modStats.ClientStats.RawInvoke(OperationId, [idMagasin, DateDebut, DateFin],
procedure(Response: TXDataClientResponse)
begin
if Response.StatusCode = 200 then
begin
adsTotal_tickets.Close;
adsTotal_tickets.SetJsonData(Response.DataSetValue);
adsTotal_tickets.open;
Did you inspect the dataset is effectively sorted?
Hi,
If i add this right after the activeindex , it displays the grid correctly !!
Dataset.ActiveIndex := LIndex;
Dataset.First;
while not Dataset.eof do
begin
for I := 0 to Dataset.FieldCount - 1 do
console.log(format('%s %s', [Self.Columns[ACol - Self.FixedCols].DataField, Dataset.FieldByName(Self.Columns[ACol - Self.FixedCols].DataField).Asstring]));
Dataset.Next;
end;