0

I am following this example http://directwebremoting.org-demo/reverseajax/peopleTable.html

Here it is adding the rows to the end of the table.

But my requirements is i have to add at the top. Every new row should be a first row.

please help me, i was struggling since 2days to get it out.But No use.

Thanks in advance.

Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90

1 Answers1

0

It seems that addRows is only adding at the top.

The quickest solution would be to call [in Java] the Util.setValue [after the Util.AddRow] and pass an id of an hidden HTML element. I suggest to use something like current timestamp so it will change byt itselft. This is the method inside Util.Java [have a look at the DWR sources]:

public static void setValue(String elementId, Object value)

Then in javascript you can "watch" for changes in the hidden field and in case push the last row in the first position.

Otherwise if you want to have a cleaner solution without the hidden field, you would have to override the addRows in JS but then one day you want also to add the row ad the end...

But I guess that the solution with the hidden field is fairly simpler

dawez
  • 2,714
  • 2
  • 29
  • 50