Jump to content

TUniDBGrid doesn't have properties SelectAll and UnSelectAll


abhimanyu

Recommended Posts

Hi,

 

For now can you try this?!:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSCall('getSelectionModel().selectAll', []);
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSCall('getSelectionModel().deselectAll', []);
end;

Best regards.

Link to comment
Share on other sites

Hi all,

 

If DBGrid finde this situation:

procedure TfrmXXX.gridMainMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  If Shift=[ssAlt] Then
    inherited;  //
end;

procedure TfrmXXX.gridMainMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  If Shift=[ssAlt] Then
    inherited;  //
end;

Value of Shift is always '[]'. i.e. i can't catch pressed button SHIFT, ALT, CTRL.

 

What is this, bug? 

Link to comment
Share on other sites

 

Which build are you using?!

 

Also you can use like this:

UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();');
UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll();');

 

 

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll');
 
  ShowMessage(IntToStr(UniDBGrid1.SelectedRows.Count));
end;
 
 
After clicking on button it will not showing the count of all rows and not selecting all records. Is that need anything else to call that JS?
Link to comment
Share on other sites

 

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll');
 
  ShowMessage(IntToStr(UniDBGrid1.SelectedRows.Count));
end;
 
 
After clicking on button it will not showing the count of all rows and not selecting all records. Is that need anything else to call that JS?

 

 

UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll');

 

Correct:

UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();');

Link to comment
Share on other sites

procedure TMainForm.SelectALLClick(Sender: TObject);

begin

  UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().selectAll();');

  ShowMessage(inttostr(UniDBGrid1.SelectedRows.Count));

end;

 

procedure TMainForm.UnSelectAllClick(Sender: TObject);

begin

  UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll()');

  ShowMessage(inttostr(UniDBGrid1.SelectedRows.Count));

end;

 

In my case it not showing proper count of the selected records.

 

If I select 2 record and then click on SelectALL it gives me count is 2 after that if  I click on UnSelectAll it gives me total count and again If I click on SelectALL it gives me count 0. I am not sure what I missing. 

Link to comment
Share on other sites

Hi,

 

In my case it not showing proper count of the selected records.

 
If I select 2 record and then click on SelectALL it gives me count is 2 after that if  I click on UnSelectAll it gives me total count and again If I click on SelectALL it gives me count 0. I am not sure what I missing. 

 

 

Then try this:

 

1. UniButton1 (selectAll):

 

UniButton1->ClientEvents->ExtEvents-> click fn:

function click(sender, e, eOpts)
{
    MainForm.UniDBGrid1.getSelectionModel().selectAll();
}
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  ShowMessage(inttostr(UniDBGrid1.SelectedRows.Count));
end;

2. UniButton2 (deselectAll): ...

Link to comment
Share on other sites

  • 6 years later...
UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll();');
 
Only works if called after grid is finished loading at front-end. Which happens after some unknown amount of time.
 
Can I deselect everything all in a timely manner? Or even better disable auto selection of the first row on grid open.
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...