Datatable editable cell values are disappearing if template function is used.

Hi,

I notice that in my datatable if one cell under a particular column is getting the value from template function, then if I edit and put some text, it disappears.

Again, when I click on the cell, I see the edited value , otherwise it just shows the earlier value only.

What is the solution for this to display the newly typed value?

My snippet is here : https://webix.com/snippet/999874e4

Please look into the last ‘name’ column under parent column ‘Place’ and try to type something in those cells holding value as ‘dummy name’.

Note: It is only happening if I use template function, not for other editable cells.

Thanks.

https://webix.com/snippet/32faa843

Thanks, it works.

Hi integral,

There is a small problem. Let’s say if I want to edit the existing value ‘dummy name’ to ‘dummy name bla bla bla’ , then also the moment I click on the cell the existing value is disappearing. Then how will I know at the time of editing that which value I am changing ?

This is not happening if I just use a normal editable cell without the template function.

Thanks.

template returns not the value itself, but representation you want to show.
if you need the field to have default value, then you can use scheme->$init
https://docs.webix.com/desktop__data_scheme.html
https://webix.com/snippet/59e46648

Hi intregal,

In your snippet you have hard coded the value as ‘dummy name’ in scheme:$init. Let’s say if the default value I am getting from the ‘obj’ parameter of my show_values function, in that case how can I set that in $init ?
I have changed my snippet a bit as both columns under ‘Place’ is now editable and the cells under them have values both from obj and hardcoded together.

So just consider I always get the values from ‘obj’ of show_values tmeplate function, how can I achieve that as default value in $init while first loading the table?

snippet:https://webix.com/snippet/b7848799

(your $init is kept as commented out in the above snippet)

Thanks.

Note: Earlier, I just posted a simpler version of the problem without knowing that it may get this much complex.

https://webix.com/snippet/b7481c6e
please read this thoroughly
https://docs.webix.com/desktop__data_scheme.html
it will help you a lot

Hi intregal,

Thanks as always for your help.
I tried that way but might have made some mistakes hence it was not coming. My bad. Thanks once again.

Hi intregal,

I am facing a weird problem which I am explaining step by step:

  1. Let’s say id5 in one of the cells initially contains “good” (fetched from the database).

  2. I click on it, change ‘good’ to ‘good morning’. Remove control from the cell and it now shows ‘good morning’ as expected.

  3. I save that data from the datatable into the database. (This I can not show here).

  4. Next time I load the page and id5 again contains “good” only whereas I expect to see ‘good morning’ as it got saved properly in step #3.

Is this possible ? Because the ‘row’ object in $init should every time fetch the
newest value on page load.
As per my understanding of the doc, the $init works on loading and also while reloading the data for new Datastore. Please correct me if I have misunderstood anything.

Thanks.

Hi intregal,

Please ignore the above post, I found what was going wrong.

Thanks.