| Page 1 of 1 | [ 2 posts ] |
|
how to attach onchange events to each and every cell in datatable and identify each cell by some id.Can any one give me an simple example.The idea is to refresh the particular cell which is changed dynamically from the database.
|
|
You do this by using event delegation. You set the listener on the container of the whole datatable and then, when something bubbles up there, you figure out which element it came from and from it the cell. Setting individual listeners on each cell is expensive and, since DataTable redraws the cells in several cases, you would need to reattach those listeners over and over again, which is also very expensive. The DataTable never redraws the container of the table, so a listener set there is safe and locating the cell once the event happened, is very easy. DataTable does this with all the cell events it reports. You might want to check the code for cellClickEvent and you must read about Event Delegation in the users guide for Event.
|
| Page 1 of 1 | [ 2 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group