javascript - How to update ZK Grid values from jQuery -
i have 3 tabs , in each tab, have grid.
the data each grid coming database, using rowrenderer populate grids. following code common 3 grids:
<grid id="mygrid1" width="950px" sizedbycontent="true" rowrenderer="com.example.renderer.myrowrenderer"> the rows constructed doublebox objects. data populated successfully.
the problem:
i need handle multiple-cell editing on client side. editing done via mouse-clicking on particular cell , entering value.
as example let's user edits first cell on first row , value should propagated other cells on same row , in 3 grids (so 2 grids user not see, because in tabpanes). using jquery value propagation , works ok.
i passing jquery follows:
doublebox.setwidgetlistener(events.on_changing, jqueryselectors); doublebox.setwidgetlistener(events.on_change, jqueryselectors); this makes possible change value in 1 cell , change instantly (visually) seen in other cells filtered jquery selectors.
the problem value visually distributed cells, when try save grid data database, background values old ones. assuming zk-grid component not aware jquery changed cell values. nevertheless if manually click on cell has new value (enter/leave/change focus) when save grid new value correct in particular cell. maybe that's hint how can resolve this.
code of how extract grid values:
grid tgrid = (grid) event.gettarget().getfellow("mygrid1"); listmodel model = tgrid.getmodel(); mycustomrow trow = (mycustomrow)model.getelementat(i); the model grid list of mycustomrow:
mygrid1.setmodel(new listmodellist(list<mycustomrow> populatedlist)); i have couple of assumptions, whatever have tried, hasn't worked. have in mind jquery events , zk-events different , isolated in different contexts. (although have tried fire events jquery , on..)
do have suggestions? whole approach correct or there's way this? time in advance!
your problem expecting.
zk has it's own event system , not care jq,
cos it's jq , zk don't observ dom.
the ways solve problem.
use "zk-way":
listen @ server-side , chage things there.
not sure if not selectedtabs
updateable, sure updategrid
components on select event oftab.fire zk-event self:
need know, written in zk doc.
basically, collect data @ client side, send
eventserver viazau.send()extract the
data json object @ serverside , updategrids
i prefer first one, cos it's less work , there should not be
notable difference in traffic.
Comments
Post a Comment