Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 7 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Vovan

  • Username: Vovan222
  • Joined: Sun Jan 09, 2011 4:51 am
  • Posts: 40
  • Offline
  • Profile
Tags:
  • datatable
  • event

layout

Post Posted: Sun Apr 10, 2011 10:26 am
+0-
.


Last edited by Vovan222 on Thu Apr 21, 2011 2:06 am, edited 2 times in total.

Alberto Santini

YUI Contributor

  • Offline
  • Profile
Tags:
  • datatable
  • docs
  • widget

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 10:37 am
+0-
Hello Vovan.

See
http://developer.yahoo.com/yui/docs/YAH ... hod_addRow

Regards,
IceBox

Kai Schwarz

  • Username: papakai
  • Joined: Fri Nov 13, 2009 8:26 am
  • Posts: 301
  • Location: Germany
  • Offline
  • Profile

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 10:59 am
+0-
with addRow you can only append rows being in the same format as others before.
Use the yui dom module to append a row with you need specific things like columns going other multiple cells (colspan = x).

But this data gets not written to the RecordSet then!

Regards
- Kai

Vovan

  • Username: Vovan222
  • Joined: Sun Jan 09, 2011 4:51 am
  • Posts: 40
  • Offline
  • Profile
Tags:
  • storage

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 11:15 am
+0-
)


Last edited by Vovan222 on Mon Apr 11, 2011 10:30 am, edited 1 time in total.

Kai Schwarz

  • Username: papakai
  • Joined: Fri Nov 13, 2009 8:26 am
  • Posts: 301
  • Location: Germany
  • Offline
  • Profile
Tags:
  • dom

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 1:51 pm
+0-
subscribe to iniEvent and use getFirstTrEl to get first row.
use a do ... while loop to loop over all current rows:

var row = mytab.getFirstTrEl(), newRow;
do {
newRow = document.createElement('tr');
newRow.innerHTML = "<td>..</td>";
YAHOO.util.Dom.insertAfter(newRow,row);
} while ( (row = mytab.getNextTrEl(row))!==null);

-or-

var recs = mytab.getRecordSet().getRecords(), i=1, a;
for(a=0;a<recs.length;a++){
mytab.addRow({},i);
i+=2;
}

in my eyes senseless appraochs, but this should do what you want.
By implementing something like this you will run into issues if you want use column sorting.

As I already told you, take always a look into api documentation. There you could see that addRow doesnt only append to the table - it also allows you to add a row at given position.

start reading!

Kai

Vovan

  • Username: Vovan222
  • Joined: Sun Jan 09, 2011 4:51 am
  • Posts: 40
  • Offline
  • Profile

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 9:25 pm
+0-
))


Last edited by Vovan222 on Mon Apr 11, 2011 10:29 am, edited 1 time in total.

Kai Schwarz

  • Username: papakai
  • Joined: Fri Nov 13, 2009 8:26 am
  • Posts: 301
  • Location: Germany
  • Offline
  • Profile

Re: Append to each added row

Post Posted: Sun Apr 10, 2011 10:28 pm
+0-
well vovan, why dont you take a look at datatable examples? or also using google to search for "yui2 datatable initevent" would help...

reportDataTable.subscribe("initEvent", myCallback);

regards
- Kai
  [ 7 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum