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

Column id renaming for dropdown after deleting one row

Expand Messages
  • yesjii
    Hi I am new to yui... and I am using yui2.7 and created a datatable A for which there are 2 columns add and delete. my columns are tableA[0].id ,tableA[0].name
    Message 1 of 2 , Dec 14, 2009
    • 0 Attachment
      Hi
      I am new to yui... and I am using yui2.7 and created a datatable A for which there are 2 columns add and delete. my columns are tableA[0].id ,tableA[0].name
      When i add a new row, table[1].id and table[1].name is created.
      But if i try to delete the row1, and then submit, so values are table[1]... , which throws me error.. as 0 is not there..
      So i have added the following code
      <tag>
      if (column.key == 'Delete') {
      if(this.getRecordSet().getLength()>1){
      this.deleteRow(record);
      allRecords=this.getRecordSet();
      for(var i=0;i<allRecords.getLength();i++){
      this.updateCell(this.getRecord(i),this.getColumn('id'),""+(i+1));
      this.updateCell(this.getRecord(i),this.getColumn('name'),""+(i+1));
      }
      else{
      alert("This row can not be deleted");
      }
      }

      </tag>
      It works fine for textbox id.. but for dropdown name, it doesn change the name to tableA[0]...

      Please somebody help......
    • Satyam
      I don t understand the issue, what the problem was before you added the code or where that code goes (I assume is in the listener for a clickEvent) or what was
      Message 2 of 2 , Dec 15, 2009
      • 0 Attachment
        I don't understand the issue, what the problem was before you added the
        code or where that code goes (I assume is in the listener for a
        clickEvent) or what was supposed to fix in the first place. Perhaps if
        you could put in a public place a working version we could see?

        Satyam

        yesjii escribió:
        > Hi
        > I am new to yui... and I am using yui2.7 and created a datatable A for which there are 2 columns add and delete. my columns are tableA[0].id ,tableA[0].name
        > When i add a new row, table[1].id and table[1].name is created.
        > But if i try to delete the row1, and then submit, so values are table[1]... , which throws me error.. as 0 is not there..
        > So i have added the following code
        > <tag>
        > if (column.key == 'Delete') {
        > if(this.getRecordSet().getLength()>1){
        > this.deleteRow(record);
        > allRecords=this.getRecordSet();
        > for(var i=0;i<allRecords.getLength();i++){
        > this.updateCell(this.getRecord(i),this.getColumn('id'),""+(i+1));
        > this.updateCell(this.getRecord(i),this.getColumn('name'),""+(i+1));
        > }
        > else{
        > alert("This row can not be deleted");
        > }
        > }
        >
        > </tag>
        > It works fine for textbox id.. but for dropdown name, it doesn change the name to tableA[0]...
        >
        > Please somebody help......
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 9.0.716 / Virus Database: 270.14.107/2564 - Release Date: 12/14/09 08:37:00
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.