freedowsRoO Posted October 29, 2019 Share Posted October 29, 2019 Is there a way to get any event like 'onExit' on DBGrid? I need to set a value to the next column of the grid based on the value of the current cell. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2019 Share Posted October 29, 2019 7 minutes ago, freedowsRoO said: Is there a way to get any event like 'onExit' on DBGrid? I need to set a value to the next column of the grid based on the value of the current cell. Hi, Sorry, can you please explain in more detail? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 29, 2019 Author Share Posted October 29, 2019 24 minutes ago, Sherzod said: Hi, Sorry, can you please explain in more detail? Sure, for example: i have a DBGrid with 3 columns i need that when i leave column number 2 the system get the values of columns 1 and 2, calc the values and save in column number 3. Thanks =] Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2019 Share Posted October 30, 2019 7 hours ago, freedowsRoO said: Sure, for example: i have a DBGrid with 3 columns i need that when i leave column number 2 the system get the values of columns 1 and 2, calc the values and save in column number 3. Hi, Maybe you need to use a calculated field!? 1 Quote Link to comment Share on other sites More sharing options...
Stemon63 Posted October 30, 2019 Share Posted October 30, 2019 Hi, Sherzod I need the same calc but on client side, without server calls. Calculated field is on server side... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2019 Share Posted October 30, 2019 5 minutes ago, Stemon63 said: I need the same calc but on client side, without server calls. Calculated field is on server side... Hi, I’ll try to analyze, but if I’m not mistaken, was a similar thread on the forum. 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 30, 2019 Author Share Posted October 30, 2019 7 hours ago, Sherzod said: Hi, Maybe you need to use a calculated field!? It's similar but calculated fields just work if you save the row, i need to calc the next column int the exactly moment that i leave the previous column. i almost managed to do using the "OnSetCellValue" event on DBGrid but i did not managed to set the next cell value in this event or get another cell value. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2019 Share Posted October 30, 2019 18 minutes ago, freedowsRoO said: It's similar but calculated fields just work if you save the row, i need to calc the next column int the exactly moment that i leave the previous column. i almost managed to do using the "OnSetCellValue" event on DBGrid but i did not managed to set the next cell value in this event or get another cell value. Can you make a simple testcase? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 30, 2019 Author Share Posted October 30, 2019 35 minutes ago, Sherzod said: Can you make a simple testcase? I'll make a GIF with what i want. Note that when i input the number 30 on field 'Desconto' the field '% Desc' change automatic. I want to do this with the DBGrid...... Is that possible? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2019 Share Posted October 30, 2019 I understood what you want, I just thought that if you already have a test case. Ok, I will try to analyze... And another question, how do you save the data after editing cells, or do you use "autosave"? Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 30, 2019 Author Share Posted October 30, 2019 14 minutes ago, Sherzod said: I understood what you want, I just thought that if you already have a test case. Ok, I will try to analyze... And another question, how do you save the data after editing cells, or do you use "autosave"? Sorry... i don't have a test case, i'm trying in my application and it's huge... I'm using autosave in grid. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 30, 2019 Share Posted October 30, 2019 50 minutes ago, freedowsRoO said: Sorry... i don't have a test case, i'm trying in my application and it's huge... Ok, no problem, I will check. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2019 Share Posted October 31, 2019 On 10/30/2019 at 12:51 AM, freedowsRoO said: Is there a way to get any event like 'onExit' on DBGrid? I need to set a value to the next column of the grid based on the value of the current cell. Hi, Can you test with this approach? UniDBGrid.ClientEvents.ExtEvents - > function reconfigure: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { //columns[3] - calculated field index - "3" //get('1') - field index - "1" //get('2') - field index - "2" columns[3].renderer = function(value, metadata, record) { return (parseFloat(record.get('1')) * parseFloat(record.get('2'))).toFixed(2) } } 2 Quote Link to comment Share on other sites More sharing options...
mehamada Posted October 31, 2019 Share Posted October 31, 2019 also if you use a dataset you can use Event onChange (for selected field) Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 31, 2019 Author Share Posted October 31, 2019 57 minutes ago, mehamada said: also if you use a dataset you can use Event onChange (for selected field) i tried this approach, doesn't work...... Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted October 31, 2019 Author Share Posted October 31, 2019 1 hour ago, Sherzod said: Hi, Can you test with this approach? UniDBGrid.ClientEvents.ExtEvents - > function reconfigure: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { //columns[3] - calculated field index - "3" //get('1') - field index - "1" //get('2') - field index - "2" columns[3].renderer = function(value, metadata, record) { return (parseFloat(record.get('1')) * parseFloat(record.get('2'))).toFixed(2) } } YOU ARE THE BEST!!! This work perfectly!!! Thanks man!!! 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted November 18, 2019 Author Share Posted November 18, 2019 Hello again, i'm using a dbgrid with an edit on cell editor and trying to use the 'OnExit' event to get the value input on edit and throw to another edit. The problem is that the command 'edit.text' return empty. Here a example.... GridEditors.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2019 Share Posted November 19, 2019 8 hours ago, freedowsRoO said: i'm using a dbgrid with an edit on cell editor and trying to use the 'OnExit' event to get the value input on edit and throw to another edit. The problem is that the command 'edit.text' return empty. Hello, I think it’s not right to use the editor for such purposes. What do you want to get from this? Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted November 19, 2019 Author Share Posted November 19, 2019 6 hours ago, Sherzod said: Hello, I think it’s not right to use the editor for such purposes. What do you want to get from this? I need to do some calcs based on the value of the cells..... example i input 400 in the first cell, when i go to second cell i need to get the value of the first cell (400) and make some validations and calcs. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2019 Share Posted November 19, 2019 5 minutes ago, freedowsRoO said: I need to do some calcs based on the value of the cells..... example i input 400 in the first cell, when i go to second cell i need to get the value of the first cell (400) and make some validations and calcs. But it seems we already decided using reconfigure function for this !? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted November 19, 2019 Author Share Posted November 19, 2019 33 minutes ago, Sherzod said: But it seems we already decided using reconfigure function for this !? Yes and no.... I dont know how to do conditions in ext, i need to make some if and else with the values, and need to validate null values, can you help me? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 19, 2019 Share Posted November 19, 2019 3 hours ago, freedowsRoO said: Yes and no.... I dont know how to do conditions in ext, i need to make some if and else with the values, and need to validate null values, can you help me? Try to provide a few examples of the conditions you want to apply. Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted November 21, 2019 Author Share Posted November 21, 2019 On 11/19/2019 at 1:40 PM, Sherzod said: Try to provide a few examples of the conditions you want to apply. I managed to did what i wanted using the reconfigure, thanks for your help. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 21, 2019 Share Posted November 21, 2019 7 minutes ago, freedowsRoO said: I managed to did what i wanted using the reconfigure, thanks for your help. Very good, thanks Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted November 28, 2019 Author Share Posted November 28, 2019 I'm with a litle problem with reconfigure. Look this gif: Quote Link to comment Share on other sites More sharing options...
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.