|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
AddRow dynamically with id HELPHi,
I'm trying to create a row in a table with a row id which I specified. I will use this row id to update from the server later on. I'm using dwr 2.0 Here's my adding row function. But, it won't add any row. Also, how can I check if the row succesfully add an id?? public void update(ServerContext wctx) { System.out.println("update"); List messages = new ArrayList(); Data data = new Data(); data.setValue("testing" + count); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, count); SimpleDateFormat formatter = new SimpleDateFormat("yy.MM.dd"); data.setDate(formatter.format(calendar.getTime())); messages.add(data); Collection sessions = wctx.getScriptSessionsByPage("/ReverseAjaxTest/index.html"); Util utilAll = new Util(sessions); //utilAll.addOptions("updates", messages, "value","date"); String options = "{" + " rowCreator:function(options) {" + " var row = document.createElement(\"tr\");" + " row.setAttribute('id','" + data.getValue() + "'); " + " return row;" + " }," + " cellCreator:function(options) {" + " var td = document.createElement(\"td\");" + " return td;" + " }," + " escapeHtml:true\"}"; utilAll.addRows("message", new String[][]{{data.getDate(),data.getValue()}},options); String id = String.valueOf(count); count++; } Can someone please point me what did I do wrong? Thanks in advance for all your help. I hope I explain my problem clearly. |
|
|
RE: AddRow dynamically with id HELPBefore looking closely at this, could you please show us
what is being sent to the browser in the Reverse Ajax update? (Use Firefox with FireBug, open up the Net tab, trigger your update() call, and then expand the Response tab of the last request.) Best regards Mike Wilson geek.shrek wrote: > Hi, > > I'm trying to create a row in a table with a row id which I specified. > I will use this row id to update from the server later on. > > I'm using dwr 2.0 > > Here's my adding row function. But, it won't add any row. > Also, how can I check if the row succesfully add an id?? > > public void update(ServerContext wctx) > { > System.out.println("update"); > List messages = new ArrayList(); > Data data = new Data(); > data.setValue("testing" + count); > > Calendar calendar = Calendar.getInstance(); > calendar.add(Calendar.DATE, count); > SimpleDateFormat formatter = new > SimpleDateFormat("yy.MM.dd"); > data.setDate(formatter.format(calendar.getTime())); > > messages.add(data); > Collection sessions = > wctx.getScriptSessionsByPage("/ReverseAjaxTest/index.html"); > Util utilAll = new Util(sessions); > //utilAll.addOptions("updates", messages, > "value","date"); > > String options = "{" + > " rowCreator:function(options) {" + > " var row = document.createElement(\"tr\");" + > " row.setAttribute('id','" + data.getValue() + "'); " + > " return row;" + > " }," + > " cellCreator:function(options) {" + > " var td = document.createElement(\"td\");" + > " return td;" + > " }," + > " escapeHtml:true\"}"; > > > utilAll.addRows("message", new > String[][]{{data.getDate(),data.getValue()}},options); > String id = String.valueOf(count); > > count++; > } > > Can someone please point me what did I do wrong? > > Thanks in advance for all your help. I hope I explain my > problem clearly. > > -- > View this message in context: > http://www.nabble.com/AddRow--dynamically-with-id-HELP-tp26002 > 848p26002848.html > Sent from the DWR - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: AddRow dynamically with id HELPThanks all for your help.
The problem was I had the wrong table id ![]()
|
| Free embeddable forum powered by Nabble | Forum Help |