Roberto Nicchi Posted July 8, 2021 Posted July 8, 2021 If some data is changed in the current cell, is there a way to force the grid to post the data ? I have tryed to use the dataset (if dataset.state=dsedit then dataset post) but seems that the dataset state is not changed if the focus doesn't exit the cell. This lead to an exception later in the app: "Grid is in dirty state. No more updates can be applied." thanks Quote
Roberto Nicchi Posted July 8, 2021 Author Posted July 8, 2021 1 hour ago, Sherzod said: Hello, Could you please clarify your case? I can try I have a form with some unigui components. One is a TuniDbGrid (let's call it the Xgrid). The xgrid is connected to a mem table (a TdxMemData) The form shows the data of a specific subject (let's say a customer) F10 is defined to execute a procedure that save the data. F8 save data and move to the prior customer, F9 save data and move to the next customer. In the Xgrid the user change a cell (could be a numeric value or a lookup field or whatever you want) and doesn't press tab or click in another component, the focus remain in the cell. If now press F10 or F8 or F9 how can i save in the dataset the data in the cell ? thanks Quote
Sherzod Posted July 8, 2021 Posted July 8, 2021 40 minutes ago, Roberto Nicchi said: In the Xgrid the user change a cell (could be a numeric value or a lookup field or whatever you want) and doesn't press tab or click in another component, the focus remain in the cell. If now press F10 or F8 or F9 how can i save in the dataset the data in the cell ? if (dbGrid.DataSource.DataSet.State in [dsEdit]) then dbGrid.DataSource.DataSet.Post; ? Quote
Roberto Nicchi Posted July 8, 2021 Author Posted July 8, 2021 1 hour ago, Sherzod said: if (dbGrid.DataSource.DataSet.State in [dsEdit]) then dbGrid.DataSource.DataSet.Post; ? No, this doesn't work because the state in not dsEdit. The state wil be dsedit only if the user type the value and exit the cell (with tab for example or click in another component). Quote
Sherzod Posted July 8, 2021 Posted July 8, 2021 3 minutes ago, Roberto Nicchi said: No, this doesn't work because the state in not dsEdit. The state wil be dsedit only if the user type the value and exit the cell (with tab for example or click in another component). I'm not sure... Quote
Roberto Nicchi Posted July 8, 2021 Author Posted July 8, 2021 Just now, Sherzod said: I'm not sure... Just tryed. Actually i have tryed for all this morning Quote
Sherzod Posted July 8, 2021 Posted July 8, 2021 Just now, Roberto Nicchi said: Just tryed. Actually i have tryed for all this morning Could you make a simple testcase to check!? Quote
Roberto Nicchi Posted July 8, 2021 Author Posted July 8, 2021 Just now, Sherzod said: Could you make a simple testcase to check!? ok Quote
Roberto Nicchi Posted July 8, 2021 Author Posted July 8, 2021 12 minutes ago, Sherzod said: Could you make a simple testcase to check!? I have done it. Project1.zip Quote
Sherzod Posted July 8, 2021 Posted July 8, 2021 6 minutes ago, Roberto Nicchi said: I have done it. Project1.zip 56.16 kB · 0 downloads Ok thanks. I will check. Quote
Sherzod Posted July 8, 2021 Posted July 8, 2021 2 hours ago, Roberto Nicchi said: Project1.zip 56.16 kB · 1 download Can you try this approach? UniDBGrid1 -> ClientEvents -> UniEvents -> function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { if (e.keyCode === 121) { sender.editingPlugin.completeEdit(); } } Quote
Roberto Nicchi Posted July 9, 2021 Author Posted July 9, 2021 18 hours ago, Sherzod said: Can you try this approach? UniDBGrid1 -> ClientEvents -> UniEvents -> function cellkeydown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) { if (e.keyCode === 121) { sender.editingPlugin.completeEdit(); } } I have tryed this workaround and in the example work. Unfortunately in my application i have problems to make it work. The cause seems to be the "bug" i have reported in portal: FSD-4075 Onkeydown executed twice Quote
Roberto Nicchi Posted July 9, 2021 Author Posted July 9, 2021 Regarding this thing i have rethinked my idea. I thing i'll leave the default behaviour. The user change the cell value and have to press enter or press tab to confirm the data. It's acceptable. Anyway the autopost property, present for checkboxes, could be extended to others comumn types. If possible add this request to the future unigui development. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.