How to update table row?

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

How to update table row?

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a table that I would like to get updated whenever the data on the server side changed.

each row have an ID.
I would like to update each cell whenever the data on the server change for id "ABC"

here's my row
<tr id="ABC" style="color: rgb(0, 0, 0);">
<td style="font-weight: bold;">First Coloumn</td>
<td style="font-weight: bold;">Second Column</td>
<td style="font-weight: bold;">Third Coloumn</td>
<td style="font-weight: bold;">Fourth Column</td>
</tr>

I'm using dwr 2.0

How can I achieve this?

RE: How to update table row?

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You have a similar discussion thread open titled "AddRow
dynamically with id HELP" that I replied to a couple of
days ago. It seems this question is a duplicate?

Mike Wilson

geek.shrek wrote:

> Hi,
>
> I have a table that I would like to get updated whenever the
> data on the
> server side changed.
>
> each row have an ID.
> I would like to update each cell whenever the data on the
> server change for
> id "ABC"
>
> here's my row
> <tr id="ABC" style="color: rgb(0, 0, 0);">
> <td style="font-weight: bold;">First Coloumn</td>
> <td style="font-weight: bold;">Second Column</td>
> <td style="font-weight: bold;">Third Coloumn</td>
> <td style="font-weight: bold;">Fourth Column</td>
> </tr>
>
> I'm using dwr 2.0
>
> How can I achieve this?
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
> 9778.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: How to update table row?

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe I'm confused, seems like a different question for me because I don't know if it's related or not.
Sorry if it's a duplicate question.

I'm able to add rows wiith the id, but now the problem is I don't know how can I update the row when the data on the server side changed.



mikewse wrote:
You have a similar discussion thread open titled "AddRow
dynamically with id HELP" that I replied to a couple of
days ago. It seems this question is a duplicate?

Mike Wilson

geek.shrek wrote:
> Hi,
>
> I have a table that I would like to get updated whenever the
> data on the
> server side changed.
>
> each row have an ID.
> I would like to update each cell whenever the data on the
> server change for
> id "ABC"
>
> here's my row
> <tr id="ABC" style="color: rgb(0, 0, 0);">
> <td style="font-weight: bold;">First Coloumn</td>
> <td style="font-weight: bold;">Second Column</td>
> <td style="font-weight: bold;">Third Coloumn</td>
> <td style="font-weight: bold;">Fourth Column</td>
> </tr>
>
> I'm using dwr 2.0
>
> How can I achieve this?
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
> 9778.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

Re: How to update table row?

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This comes down to Javascript/DHTML knowledge and is not specific to DWR.  The utilities provided by DWR for client side manipulation aren't meant to cover everything and I am not sure they cover this (you can remove all rows and then re-add them but that doesn't sound like what you want).  You can either read up on manipulating the DOM via Javascript or look at other libraries that focus on this (jQuery, etc.).

On Mon, Oct 26, 2009 at 8:10 AM, geek.shrek <miss_cool_666@...> wrote:

Maybe I'm confused, seems like a different question for me because I don't
know if it's related or not.
Sorry if it's a duplicate question.

I'm able to add rows wiith the id, but now the problem is I don't know how
can I update the row when the data on the server side changed.




mikewse wrote:
>
> You have a similar discussion thread open titled "AddRow
> dynamically with id HELP" that I replied to a couple of
> days ago. It seems this question is a duplicate?
>
> Mike Wilson
>
> geek.shrek wrote:
>> Hi,
>>
>> I have a table that I would like to get updated whenever the
>> data on the
>> server side changed.
>>
>> each row have an ID.
>> I would like to update each cell whenever the data on the
>> server change for
>> id "ABC"
>>
>> here's my row
>> <tr id="ABC" style="color: rgb(0, 0, 0);">
>> <td style="font-weight: bold;">First Coloumn</td>
>> <td style="font-weight: bold;">Second Column</td>
>> <td style="font-weight: bold;">Third Coloumn</td>
>> <td style="font-weight: bold;">Fourth Column</td>
>> </tr>
>>
>> I'm using dwr 2.0
>>
>> How can I achieve this?
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
>> 9778.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@...
>
>
>

--
View this message in context: http://www.nabble.com/How-to-update-table-row--tp26059778p26060545.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@...



RE: How to update table row?

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If we change your example a little (note the nested ids on
every sub-element with data):

<tr id="ABC">
  <td id="ABC.first">First Coloumn</td>
  <td id="ABC.second">Second Column</td>
  <td id="ABC.third">Third Coloumn</td>
  <td id="ABC.fourth">Fourth Column</td>
</tr>

we can then update existing data with DWR's setValues
function:

dwr.util.setValues(
  {
    ABC: {
      first: "...",
      second: "...",
      third: "...",
      fourth: "..."
    }
  }
);

-or-

dwr.util.setValues(
  {
    first: "...",
    second: "...",
    third: "...",
    fourth: "..."
  },
  { idPrefix: "ABC" }
);

You can play with the setValues function a little at
http://directwebremoting.org/dwr/browser/util/setValues.html
but the example doesn't use any nested data. (David: this
might be a good idea to add to the doc page?)

Best regards
Mike

geek.shrek wrote:

> Maybe I'm confused, seems like a different question for me
> because I don't
> know if it's related or not.
> Sorry if it's a duplicate question.
>
> I'm able to add rows wiith the id, but now the problem is I
> don't know how
> can I update the row when the data on the server side changed.
>
>
>
>
> mikewse wrote:
> >
> > You have a similar discussion thread open titled "AddRow
> > dynamically with id HELP" that I replied to a couple of
> > days ago. It seems this question is a duplicate?
> >
> > Mike Wilson
> >
> > geek.shrek wrote:
> >> Hi,
> >>
> >> I have a table that I would like to get updated whenever the
> >> data on the
> >> server side changed.
> >>
> >> each row have an ID.
> >> I would like to update each cell whenever the data on the
> >> server change for
> >> id "ABC"
> >>
> >> here's my row
> >> <tr id="ABC" style="color: rgb(0, 0, 0);">
> >> <td style="font-weight: bold;">First Coloumn</td>
> >> <td style="font-weight: bold;">Second Column</td>
> >> <td style="font-weight: bold;">Third Coloumn</td>
> >> <td style="font-weight: bold;">Fourth Column</td>
> >> </tr>
> >>
> >> I'm using dwr 2.0
> >>
> >> How can I achieve this?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
> >> 9778.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@...
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2606
> 0545.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: How to update table row?

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the example Mike.  I will add it to the docs.

On Tue, Oct 27, 2009 at 8:13 AM, Mike Wilson <mikewse@...> wrote:
If we change your example a little (note the nested ids on
every sub-element with data):

<tr id="ABC">
 <td id="ABC.first">First Coloumn</td>
 <td id="ABC.second">Second Column</td>
 <td id="ABC.third">Third Coloumn</td>
 <td id="ABC.fourth">Fourth Column</td>
</tr>

we can then update existing data with DWR's setValues
function:

dwr.util.setValues(
 {
   ABC: {
     first: "...",
     second: "...",
     third: "...",
     fourth: "..."
   }
 }
);

-or-

dwr.util.setValues(
 {
   first: "...",
   second: "...",
   third: "...",
   fourth: "..."
 },
 { idPrefix: "ABC" }
);

You can play with the setValues function a little at
http://directwebremoting.org/dwr/browser/util/setValues.html
but the example doesn't use any nested data. (David: this
might be a good idea to add to the doc page?)

Best regards
Mike

geek.shrek wrote:
> Maybe I'm confused, seems like a different question for me
> because I don't
> know if it's related or not.
> Sorry if it's a duplicate question.
>
> I'm able to add rows wiith the id, but now the problem is I
> don't know how
> can I update the row when the data on the server side changed.
>
>
>
>
> mikewse wrote:
> >
> > You have a similar discussion thread open titled "AddRow
> > dynamically with id HELP" that I replied to a couple of
> > days ago. It seems this question is a duplicate?
> >
> > Mike Wilson
> >
> > geek.shrek wrote:
> >> Hi,
> >>
> >> I have a table that I would like to get updated whenever the
> >> data on the
> >> server side changed.
> >>
> >> each row have an ID.
> >> I would like to update each cell whenever the data on the
> >> server change for
> >> id "ABC"
> >>
> >> here's my row
> >> <tr id="ABC" style="color: rgb(0, 0, 0);">
> >> <td style="font-weight: bold;">First Coloumn</td>
> >> <td style="font-weight: bold;">Second Column</td>
> >> <td style="font-weight: bold;">Third Coloumn</td>
> >> <td style="font-weight: bold;">Fourth Column</td>
> >> </tr>
> >>
> >> I'm using dwr 2.0
> >>
> >> How can I achieve this?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
> >> 9778.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@...
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2606
> 0545.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: How to update table row?

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great David,
 
For the given markup this is also a valid call:
  dwr.util.setValues(
    {
      "ABC.first": "...",
      "ABC.second": "...",
      "ABC.third": "...",
      "ABC.fourth": "..."
    }
  );
which might be suitable to put first, followed by the two other variants.
 
Best regards
Mike


From: dmarginian@... [mailto:dmarginian@...] On Behalf Of David Marginian
Sent: den 27 oktober 2009 15:22
To: users@...
Subject: Re: [dwr-user] How to update table row?

Thanks for the example Mike.  I will add it to the docs.

On Tue, Oct 27, 2009 at 8:13 AM, Mike Wilson <mikewse@...> wrote:
If we change your example a little (note the nested ids on
every sub-element with data):

<tr id="ABC">
 <td id="ABC.first">First Coloumn</td>
 <td id="ABC.second">Second Column</td>
 <td id="ABC.third">Third Coloumn</td>
 <td id="ABC.fourth">Fourth Column</td>
</tr>

we can then update existing data with DWR's setValues
function:

dwr.util.setValues(
 {
   ABC: {
     first: "...",
     second: "...",
     third: "...",
     fourth: "..."
   }
 }
);

-or-

dwr.util.setValues(
 {
   first: "...",
   second: "...",
   third: "...",
   fourth: "..."
 },
 { idPrefix: "ABC" }
);

You can play with the setValues function a little at
http://directwebremoting.org/dwr/browser/util/setValues.html
but the example doesn't use any nested data. (David: this
might be a good idea to add to the doc page?)

Best regards
Mike

geek.shrek wrote:

> Maybe I'm confused, seems like a different question for me
> because I don't
> know if it's related or not.
> Sorry if it's a duplicate question.
>
> I'm able to add rows wiith the id, but now the problem is I
> don't know how
> can I update the row when the data on the server side changed.
>
>
>
>
> mikewse wrote:
> >
> > You have a similar discussion thread open titled "AddRow
> > dynamically with id HELP" that I replied to a couple of
> > days ago. It seems this question is a duplicate?
> >
> > Mike Wilson
> >
> > geek.shrek wrote:
> >> Hi,
> >>
> >> I have a table that I would like to get updated whenever the
> >> data on the
> >> server side changed.
> >>
> >> each row have an ID.
> >> I would like to update each cell whenever the data on the
> >> server change for
> >> id "ABC"
> >>
> >> here's my row
> >> <tr id="ABC" style="color: rgb(0, 0, 0);">
> >> <td style="font-weight: bold;">First Coloumn</td>
> >> <td style="font-weight: bold;">Second Column</td>
> >> <td style="font-weight: bold;">Third Coloumn</td>
> >> <td style="font-weight: bold;">Fourth Column</td>
> >> </tr>
> >>
> >> I'm using dwr 2.0
> >>
> >> How can I achieve this?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-update-table-row--tp26059778p2605
> >> 9778.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@...
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2606
> 0545.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: How to update table row?

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks All for your help

1 more question, I'm not sure if it's related, if not I will post another thread.

How can I pass back the row data back to the server?

for example, I would like to get the data with row id ="ABC"

RE: How to update table row?

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://directwebremoting.org/dwr/browser/util/getValues.html

ie, in your case:

<tr id="ABC">
  <td id="ABC.first">First Coloumn</td>
  <td id="ABC.second">Second Column</td>
  <td id="ABC.third">Third Coloumn</td>
  <td id="ABC.fourth">Fourth Column</td>
</tr>

var data = {
  first: null,
  second: null,
  third: null,
  fourth: null
};
dwr.util.getValues(data, {idPrefix: "ABC"});
// -> data.first == "First Column", etc

Best regards
Mike

geek.shrek wrote:

> Thanks All for your help :-D
>
> 1 more question, I'm not sure if it's related, if not I will
> post another
> thread.
>
> How can I pass back the row data back to the server?
>
> for example, I would like to get the data with row id ="ABC"
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2610
> 5477.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: How to update table row?

by geek.shrek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you all for your help

Will it be possible to update the cell style as well??

if I have my old cell value as below
  <td id="ABC.first" style="color:#00000">First Coloumn</td>

var cellValue = "<div style='visibility:hidden;'>MYHIDDENVALUE</div>First Column new value";

dwr.util.setValues({first: cellValue},{ idPrefix: ABC},{color: #FF800});

I'm hoping to have the new cell like
   <td id="ABC.first style="color:#FF800"><div style='visibility:hidden;'>MYHIDDENVALUE</div>First Column new value</td>

But the div is not hidden, somehow it display as a real text and the color won't change.

Any idea what did I do wrong?

Thank you so much.


mikewse wrote:
http://directwebremoting.org/dwr/browser/util/getValues.html

ie, in your case:

<tr id="ABC">
  <td id="ABC.first">First Coloumn</td>
  <td id="ABC.second">Second Column</td>
  <td id="ABC.third">Third Coloumn</td>
  <td id="ABC.fourth">Fourth Column</td>
</tr>

var data = {
  first: null,
  second: null,
  third: null,
  fourth: null
};
dwr.util.getValues(data, {idPrefix: "ABC"});
// -> data.first == "First Column", etc

Best regards
Mike

geek.shrek wrote:
> Thanks All for your help :-D
>
> 1 more question, I'm not sure if it's related, if not I will
> post another
> thread.
>
> How can I pass back the row data back to the server?
>
> for example, I would like to get the data with row id ="ABC"
> --
> View this message in context:
> http://www.nabble.com/How-to-update-table-row--tp26059778p2610
> 5477.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
For additional commands, e-mail: users-help@dwr.dev.java.net

RE: How to update table row?

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unfortunately, setValues and getValues only deal with the value
of inputs or text of elements, not attributes, so it will not
help you access style in the way you suggest.

Your DIV is displaying literally because HTML is escaped to
protect you from XSS attacks. Read about it here:
http://directwebremoting.org/dwr/browser/util/escapeHtml.html
To disable escaping, your call should look like:

dwr.util.setValues(
  {first: ...},
  {idPrefix:..., escapeHtml:false});

Finally, for your styling desired I would recommend not adding
explicit style to your elements but rather use classes, that
you then switch on and off through DOM calls, or a library.

Best regards
Mike

geek.shrek wrote:

> Thank you all for your help :-D
>
> Will it be possible to update the cell style as well??
>
> if I have my old cell value as below
>   <td id="ABC.first" style="color:#00000">First Coloumn</td>
>
> var cellValue = "<div
> style='visibility:hidden;'>MYHIDDENVALUE</div>First
> Column new value";
>
> dwr.util.setValues({first: cellValue},{ idPrefix:
> ABC},{color: #FF800});
>
> I'm hoping to have the new cell like
>    <td id="ABC.first style="color:#FF800"><div
> style='visibility:hidden;'>MYHIDDENVALUE</div>First Column
> new value</td>
>
> But the div is not hidden, somehow it display as a real text
> and the color
> won't change.
>
> Any idea what did I do wrong?
>
> Thank you so much.
>
>
>
> mikewse wrote:
> >
> > http://directwebremoting.org/dwr/browser/util/getValues.html
> >
> > ie, in your case:
> >
> > <tr id="ABC">
> >   <td id="ABC.first">First Coloumn</td>
> >   <td id="ABC.second">Second Column</td>
> >   <td id="ABC.third">Third Coloumn</td>
> >   <td id="ABC.fourth">Fourth Column</td>
> > </tr>
> >
> > var data = {
> >   first: null,
> >   second: null,
> >   third: null,
> >   fourth: null
> > };
> > dwr.util.getValues(data, {idPrefix: "ABC"});
> > // -> data.first == "First Column", etc
> >
> > Best regards
> > Mike
> >
> > geek.shrek wrote:
> >> Thanks All for your help :-D
> >>
> >> 1 more question, I'm not sure if it's related, if not I will
> >> post another
> >> thread.
> >>
> >> How can I pass back the row data back to the server?
> >>
> >> for example, I would like to get the data with row id ="ABC"
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-update-table-row--tp26059778p2610
> >> 5477.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@...
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-to-update-table-row--tp26059778p2620
8562.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@...