WTable::deleteRow question about implementation
Added by Jorge Paulo over 12 years ago
Hi,
I would like to know how WTable handles a deleteRow.
I need to make architecture decisions in my application, knowing what is happening behind the curtains will possibly contribute to better decisions, especially concerning UI responsiveness and scalability.
In a proof-of-concept for a widget, I have:
-a WTable with a around 100 rows, all visible.
-During user interaction I bypass Wt and access the DOM with custom JS to change cell contents (I know, I shouldn't do this and I won't release it like this)
-I then delete the first row of the table using WTable::deleteRow
-All my direct changes to the DOM disappear and the cell contents return to what was originally set using Wt.
What I would like to know is how Wt is able to restore the cell to it's original contents. Where is it getting the data from?
Is it getting it from the server-side C object?
Is it getting it from a client-side JS object (with data synchronized with the C object)?
(In other words, what I want to know is if after deleting the 1st row from the table the toolkit fetches all remaining rows from the server.)
If you are able to reply, it will save me a couple of hours looking at the code and trying to understand by myself.
Thank you!
Jorge
Replies (3)
RE: WTable::deleteRow question about implementation - Added by Wim Dumon over 12 years ago
Jorge,
I believe a WTable will repaint itself by resetting its InnerHtml, so the entire table will be rerendered from the server. A firebug trace could confirm this.
Best regards,
Wim.
RE: WTable::deleteRow question about implementation - Added by Koen Deforche over 12 years ago
Hey Jorge,
Indeed. The WTable isn't imlemented in the most optimal way in that sense, only row additions (at the end) are supported to be rendered incrementally. The main reason is that the DOM for table modification is quite divergent on IE6/7 versus compliant browsers.
You should probably consider to manipulate the contents with client-side JS but also to propagate these updates to the server. Wt has two mechanisms for this:
- stateless slots
- custom JavaScript slots + JSignal
Regards,
koen
RE: WTable::deleteRow question about implementation - Added by Jorge Paulo over 12 years ago
Hi,
I'll try a JSlot+JSignal approach.
I'm also experimenting with a WTableView as an alternative.
I started using Firebug.
Thanks,
Jorge