Hello,
I get a warning in the browser console on a table that uses checkboxes for different records, but having the same id:
Is it possible to fix it somehow, so that there is no warning?
Hello,
I get a warning in the browser console on a table that uses checkboxes for different records, but having the same id:
Is it possible to fix it somehow, so that there is no warning?
Are the IDs needed? If they are, you could name them dynamically:
dmx-bind:id="'staticpart' + $index"
IDs are used in the following expressions:
dmx-on:updated= " checkbox_idRecord.checked == true ? arrayChecked.addUniq($index) : arrayChecked.remove($index)"
dmx-on:change= " checkbox_idRecord.checked == true ? array_idRecords.remove(value) : array_idRecords.addUniq(value)"
Will these expressions work if I apply a dynamic id?
That’s a good question. I think it should be possible, but I just tried and couldn’t get it to work. Perhaps I couldn’t find the right syntax.
Perhaps @Teodor can help with the syntax?
dmx-bind:id="checkbox_idRecord' + $index"
Will work
This will assign unique IDs*, but doesn’t seem to work with the expressions following dmx-on:updated
or dmx-on:change
.
*but with straight quotes:
dmx-bind:id="'checkbox_idRecord' + $index"
@patrick, Hello. Tell me please, is there a solution to this question?
You need to give both static id and dynamic id (with dmx-bind:ID) to get it to work.
The static id - you can use into your expressions, the dynamic id is for the browser.
So in your case it will be something like:
id="checkbox_idRecord" dmx-bind:id="'checkbox_idRecord' + $index"
the expression you have will continue to work with the static id.
@George, thanks a lot! The solution works perfectly!
Sorry @George
Ive done this is and its working. Im just confused to how its working, does wappler know to update the expressions referencing static id, to the dynamic/bind id?