Jump to content
uniGUI Discussion Forums
abhimanyu

Runtime Enable MultiSelect not woking in UniDBGrid

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

Share this post


Link to post
Share on other sites

Hi,

 

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.

Is that any other way to enable multiselect or not?  

Share this post


Link to post
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 2

Share this post


Link to post
Share on other sites

"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 !   ^_^"

Share this post


Link to post
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,

Share this post


Link to post
Share on other sites

Hello UniGUI developpers !

 

I am still waiting for an answer concerning that matter.... 

 

 

Regards,

Share this post


Link to post
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"?

Share this post


Link to post
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,

Share this post


Link to post
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 ? :(

 

Share this post


Link to post
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

Share this post


Link to post
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..!

Share this post


Link to post
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

 

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

Regards,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×