Loading ...
Sorry, an error occurred while loading the content.

31855Re: Issue with addRow() and pagination

Expand Messages
  • y_lsmith
    May 30, 2008
    • 0 Attachment
      Wow, typo. My apologies. rowAddEvent, not addRowEvent.

      Here's an example page:
      http://yuiblog.com/sandbox/yui/v252/examples/datatable/addrow_pag.html

      Luke

      --- In ydn-javascript@yahoogroups.com, "Rashmi Y. Prasad"
      <RPrasad2@...> wrote:
      >
      > Luke,
      >
      > This is what I exactly tried, but "addRowEvent" never gets
      > triggered....not sure if I am amking any mistake....please point out...
      >
      >
      >
      > YAHOO.util.Event.addListener("addrow","click",function() {
      >
      > var recoor = {"id":"","attribute1"};
      >
      > myDataTable.addRow(recoor);
      >
      > },this,true);
      >
      >
      >
      > myDataTable.subscribe('addRowEvent',function () {alert("addRowEvent");
      >
      > myPaginator.setPage(myPaginator.getTotalPages(), false);
      >
      > }, myPaginator, true);
      >
      >
      >
      > Also, row sometimes comes up, sometimes its not shown, somehow it
      > doesnot seem to be consistent:-(
      >
      >
      >
      > ________________________________
      >
      > From: ydn-javascript@yahoogroups.com
      > [mailto:ydn-javascript@yahoogroups.com] On Behalf Of y_lsmith
      > Sent: Friday, May 30, 2008 9:04 PM
      > To: ydn-javascript@yahoogroups.com
      > Subject: [ydn-javascript] Re: Issue with addRow() and pagination
      >
      >
      >
      > If you're trying to jump to the last page when you add a row, the
      > following should be sufficient:
      >
      > myDataTable.subscribe('addRowEvent',function () {
      > this.setPage(this.getTotalPages());
      > }, myPaginator, true);
      >
      > YAHOO.util.Event.on('addrow','click',function () {
      > var data = {};
      > /* collect values for new row */
      > myDataTable.addRow(data);
      > });
      >
      > Hope this helps,
      > Luke
      >
      > --- In ydn-javascript@yahoogroups.com
      > <mailto:ydn-javascript%40yahoogroups.com> , "rashmeep2000"
      > <RPrasad2@>
      > wrote:
      > >
      > > hi all,
      > > my addRow method looks like this...
      > > YAHOO.util.Event.addListener("addrow","click",function() {
      > > //var data=.....
      > > totalRecordsMy = myPaginator.getTotalRecords()
      > >
      > > var toAdd = myPaginator.getTotalRecords()+1;
      > >
      > > totalRecordsMy = totalRecordsMy+1;//alert(totalRecordsMy);
      > > myPaginator.setTotalRecords(totalRecordsMy, false);
      > >
      > > var toPage = totalRecordsMy/rowsPerPageMy;alert("toPage--"+toPage);
      > >
      > > myDataTable.addRow(recoor);
      > > if(toPage > myPaginator.getTotalPages()){
      > > myPaginator.setPage(myPaginator.getTotalPages()+1, false);
      > > }else { myPaginator.setPage(myPaginator.getTotalPages(), false);
      > > }
      > >
      > > },this,true);
      > >
      > > When i cleick on addor for first time, it doesnot add row, but goes
      > > to next page, on second click it adds row, also i ahve 5 rowsperpage,
      > > after adding 5 rows, i keep clicking on addrow, it adds rows, but
      > > doesnot paginate to the page in which it has added new row, i forced
      > > my setting page, that is also not working.please help..thanks.
      > >
      >
    • Show all 13 messages in this topic