[ 7 posts ]

Vovan

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

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

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:

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:

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 ]
Display posts from previous:  Sort by  
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