Ok, so here's a proof of concept, it works but can certainly be improved in many ways.
In 60fd4cd/cboos.git, I added an updateData()
method which changes the data associated with a selector and tries to update all sub-elements which have specified to be updated. The specification is done in a very simple way, using classes. It's probably even too simple (what if an element wants to be updated for more than one data?).
Basically, it works like this. An element specifies that it wants to react on a change, and how:
<th colspan="$num_cols" class="colspan= trac_num_cols">
colspan="$num_cols"
is the initial value (Genshi data).
class="colspan= trac_num_cols"
means: set the colspan
attribute to the value of the data trac_num_cols
when it is updated via a call to updateData()
The latter happens when the batch modification Javascript code is activated:
var new_trac_num_cols = /* compute new value */;
$("table.listing").updateData('trac_num_cols', new_trac_num_cols);
$("table.listing")
is the element containing the data 'trac_num_cols'
- the way the
new_trac_num_cols
value is computed is a bit complex, i.e. we need to either propagate the initial value from the server via add_script_data
or we look at the effective number of cols; it would be much more convenient if we could rely on the initial value being directly associated with the element when it's built, and this is what 3c99d5d/cboos.git hints at…