AddRow dynamically with id HELP

View: New views
3 Messages — Rating Filter:   Alert me  

AddRow dynamically with id HELP

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

RE: AddRow dynamically with id HELP

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Before 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 HELP

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks all for your help.

The problem was I had the wrong table id


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.