Jump to content

Runtime Enable MultiSelect not woking in UniDBGrid


abhimanyu

Recommended Posts

Hi,

When I try to enable multiselect of uniDBGrid on button click it was not working.
 

Below is code of button click, and attached a Demo as well.

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBGrid1.Options := UniDBGrid1.Options + [dgCheckSelect, dgRowSelect, dgMultiSelect];
end;


procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  UniDBGrid1.Options := UniDBGrid1.Options - [dgCheckSelect, dgRowSelect, dgMultiSelect];
end;

 

GridMultiSelect.zip

Link to comment
Share on other sites

Hi,

 

You can use this approach for now:

 

1. Enable in designtime:

[dgCheckSelect, dgRowSelect, dgMultiSelect]

 

2. Your logic:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  //UniDBGrid1.Options := UniDBGrid1.Options + [dgCheckSelect, dgRowSelect, dgMultiSelect];

  UniDBGrid1.JSInterface.JSCall('getSelectionModel().deselectAll', []);
  UniDBGrid1.JSInterface.JSCall('getSelectionModel().setSelectionMode', ['MULTI']);
end;

procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  //UniDBGrid1.Options := UniDBGrid1.Options - [dgCheckSelect, dgRowSelect, dgMultiSelect];

  UniDBGrid1.JSInterface.JSCall('getSelectionModel().deselectAll', []);
  UniDBGrid1.JSInterface.JSCall('getSelectionModel().setSelectionMode', ['SINGLE']);
end;

Best regards.

  • Upvote 3
Link to comment
Share on other sites

  • 1 year later...

"Well, my main problem is that I want to switch grid option between dgRwoSelect to dgEditing programmatically ! Is that possible ?

If so, what approach should I take ?

 

Thanks for your time !   ^_^"

Link to comment
Share on other sites

Hello Farshad, hello UniGUI Developers ! (:

 

I would really appreciate if you could at least tell me if it is already possible and I am doing something wrong or if it is not possible at the moment and you are searching a solution or if you are just thinking about it ..  -_-  :rolleyes:  ;)

 

Regards,

Link to comment
Share on other sites

Hi,

 

Sorry for delay, can you still use the "FreeAndNil" solution?

 

And I'm sorry that I again ask for clarification, what do you mean by saying "between dgRowSelect to dgEditing"?

 

I thought that the FreeAndNil matter was fixed?..

 

Clarification:

  • Grid configured at conception with dgRowSelect.
  • User click on a button and it programmatically change grid configuration to dgEditing.

Regards,

Link to comment
Share on other sites

Hello UniGUi users!

 

I wish I could have an answer concerning my question (waiting for two weeks now -_-) :

 

Clarification:

  • Grid configured at conception with dgRowSelect.
  • User click on a button and it programmatically change grid configuration to dgEditing.

Regards,

 

Is that possible or not ? :(

 

Link to comment
Share on other sites

Hello,

 

Sorry for delay

 

Not all Grid options can be enabled/disabled at runtime. The only place that it can be done is Form's or Frame's OnCreate event.

 

Sorry that maybe I do not really understand the situation, why you want that behavior,

But, we will try to find an approach if possible

Link to comment
Share on other sites

Hello,

 

Sorry for delay

 

 

Sorry that maybe I do not really understand the situation, why you want that behavior,

But, we will try to find an approach if possible

 

Well, our client need a grid where they can :

  • Some times select data for actions (PDF generation, validate data etc) --> dgMultiSelection
  • Some times Insert Update Delete data --> dgEditing

So in order to fulfill client's demands, we need a grid that is able to do these two things ..

 

For now, we are destroying the grid and recreating it with correct options..!

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Hello,

 

Sorry for delay

 

 

Sorry that maybe I do not really understand the situation, why you want that behavior,

But, we will try to find an approach if possible

 

Do you have any approach on this functionality ? We're still waiting for some news ! 

Regards,

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...