Jump to content

TuniDBGrid: select rows by code with a condition


Roberto Nicchi

Recommended Posts

What i need is to select the rows of a grid depending on some condition. The condition in this particular case is the value of a field; if the field has some value the record must be selected, otherwise not selected. This task must be executed after the grid has been loaded so i guess the right place where to place the code is in the OnAfterLoad event of the grid.

Now i have the code to select or deselect all the rows but i have no idea how to select/unselect rows with a condition.

Possible ?

thanks

Link to comment
Share on other sites

  • 1 year later...
On 5/12/2021 at 1:46 PM, Roberto Nicchi said:

What i need is to select the rows of a grid depending on some condition. The condition in this particular case is the value of a field; if the field has some value the record must be selected, otherwise not selected. This task must be executed after the grid has been loaded so i guess the right place where to place the code is in the OnAfterLoad event of the grid.

Now i have the code to select or deselect all the rows but i have no idea how to select/unselect rows with a condition.

This question is also important for me

Link to comment
Share on other sites

I have already found a solution - in the Russian segment. Here is the link to the topic: http://forums.unigui.com/index.php?/topic/12627-unidbgrid-selectedrows/

I use such designs to achieve what I want
1) Select all rows in the grid:

UniDbGrid.JSInterface.JSCall('getSelectionModel().selectAll', []);

2) Select only the lines that meet some condition:

UniDbGrid.JSInterface.JSCall('getSelectionModel().select', [Row, true]);

3) Unselect all rows:

UniDbGrid.JSInterface.JSCall('getSelectionModel().deselectAll', []);

So far everything is running fine

Link to comment
Share on other sites

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