Jump to content

Recommended Posts

Posted

Hi,

 

I want to select all rows and deselect all rows on one button click, Is that any property is exist for TUniDBGrid or not for do this? or need to write code manually selecting all rows and deselecting all rows?

Posted

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.

Posted

Which build are you using?!

 

Also you can use like this:

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

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? 

Posted

 

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?
Posted

 

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();');

Posted

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

 

Correct:

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

Oh Sorry :p,  Thank you very much !

Posted
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. 

Posted

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): ...

  • 6 years later...
Posted
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.
Posted
1 hour ago, rgreat said:

Can I deselect everything all in a timely manner? Or even better disable auto selection of the first row on grid open.

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...