07-23-2021, 10:20 PM
Thanks Remko, it helped a lot!
I ended up doing:
It is a simplification for the sake of readability, in reality the cell contains various fields, on change they are read, a json is build than it is merged with the one contained in the sister cell and overwritten.
I have one more question:
How do I "bind" a CustomLayoutElement to a column?
I mean if in the definition for a specific sType i have:
I suppose I should put a "spt_input_value" and update it accordingly in my_wdg on_change behavior and then do the usual addClass("spt_cell_changed"), addClass("spt_row_changed") and pt.table.set_changed_color
but how do I tell the parent CustomLayoutWdg to save my my_wdg_name.spt_input_value to a specific column name when the row is saved?
I ended up doing:
Code:
let my_value = bvr.src_el.value;
let row = spt.table.get_row_by_cell(bvr.src_el);
let sister_cell = spt.table.get_cell("colunm_name", row);
let sister_value = sister_cell.getAttribute("spt_input_value");
sister_cell.setAttribute("spt_input_value", sister_value + my_value);
sister_cell.addClass("spt_cell_changed");
row.addClass("spt_row_changed");
spt.table.set_changed_color(row, data_cell);
It is a simplification for the sake of readability, in reality the cell contains various fields, on change they are read, a json is build than it is merged with the one contained in the sister cell and overwritten.
I have one more question:
How do I "bind" a CustomLayoutElement to a column?
I mean if in the definition for a specific sType i have:
Code:
<element name="my_wdg_name">
<display class="tactic.ui.table.CustomLayoutElementWdg">
<view>my_wdg</view>
</display>
</element>
I suppose I should put a "spt_input_value" and update it accordingly in my_wdg on_change behavior and then do the usual addClass("spt_cell_changed"), addClass("spt_row_changed") and pt.table.set_changed_color
but how do I tell the parent CustomLayoutWdg to save my my_wdg_name.spt_input_value to a specific column name when the row is saved?