Jump to content

DBGrid Cell Exit


freedowsRoO

Recommended Posts

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?

  • Like 1
Link to comment
Share on other sites

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 =]

Link to comment
Share on other sites

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!?

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

35 minutes ago, Sherzod said:

Can you make a simple testcase?

I'll make a GIF with what i want. 

giphy.gif

 

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)
    }
}

 

  • Like 2
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 !?

  • Like 1
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...