Datatable - change values after checkbox click

Hi,

I have a datatable with several columns. One is a checkbox.

When I click the checkbox on one row, another column of the same row should change to the actual date (datepicker editor).

Everything is fine except the saving to the datatable. Only the checkbox value is saved to the database (mysql via dhtmlx-php-connector).

See here:

$$("auswertung_datatable_externekosten_projekt").attachEvent("onCheck", function(row, column, state) {
  if ((column == "projekt_fremdkosten_abgerechnet") && (state == "1")) {
    //$$("auswertung_datatable_externekosten_projekt").editStop();
    var item = $$("auswertung_datatable_externekosten_projekt").getItem(row);
    item.projekt_fremdkosten_abgerechnet_wann = new Date();
    item.projekt_fremdkosten_abgerechnet_von = credentials.user_id;
    webix.delay(function() {
      $$("auswertung_datatable_externekosten_projekt").updateItem(row, item);
    }, 50); /////// THIS DOES NOT WORK
    
    //this.refresh(row);
  }
  
});

Hi Martin,

That’s an expected behaviour. If an item is updated before the previous server call for the same item finishes, the request is blocked.

You need to cancel datatable update when the checkbox is checked, yet it is not as simple. You need to set a custom checkbox template and a custom check action for it.

Please, follow the code and comments in the related snippet: http://webix.com/snippet/e9abf4c2

Hi Helga,

thanks! But unfortunately the snippet is empty…

Martin

I beg your pardon, there’s been some a global problem with our snippets. Here’s the working one: https://webix.com/snippet/c7cd15fd