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

Adding a row in Markup based data table Not Working

Expand Messages
  • Jayaprakash
    Hi all, I have a data table which is based on the existing markup inside a div block of my page (the contents comes from a Ajax function call from some XML
    Message 1 of 5 , May 3, 2007
      Hi all,

      I have a data table which is based on the existing markup inside a
      div block of my page (the contents comes from a Ajax function call
      from some XML file).

      What I am trying to do is to add a new record in the existing data
      table but it shows error in datatable-beta-debug.js file on line 4593.

      The source code is as follows:

      ----------------------------------------------------------------------
      --
      markup.htm
      ----------------------------------------------------------------------
      --
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
      4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html;
      charset=iso-8859-1" />
      <title>Markup Datatable</title>

      <script type="text/javascript"
      src="yahoo.js"></script>
      <script type="text/javascript" src="dom.js"></script>
      <script type="text/javascript"
      src="event.js"></script>

      <script type="text/javascript" src="datasource-beta-
      debug.js"></script>
      <script type="text/javascript" src="datatable-beta-
      debug.js"></script>
      </head>
      <body>
      <div id="table1">
      <table cellpadding="0" cellspacing="0" width="300" border="1">
      <thead>
      <tr>
      <th>Column1</th>
      <th>Column2</th>
      <th>Column3</th>
      </tr>
      </thead>
      <tbody>
      <tr>
      <td width="100">Anil</td>
      <td width="100">Binu</td>
      <td width="100">Abhi</td>
      </tr>
      <tr>
      <td width="100">Santhosh</td>
      <td width="100">Denis</td>
      <td width="100">Dijo</td>
      </tr>
      </tbody>
      </table>
      </div>
      <script type="text/javascript">
      function createDataTable(id){
      var columnHeaders = [
      {key:"c1",text:"Column One",sortable:true},
      {key:"c2",text:"Column Two",sortable:true},
      {key:"c3",text:"Column Three",sortable:true}
      ];

      var columnSet = new YAHOO.widget.ColumnSet
      (columnHeaders);

      var markup = YAHOO.util.Dom.get(id);

      var dataTable = new YAHOO.widget.DataTable
      (markup,columnSet,null);

      return dataTable;
      }

      var DataTable = createDataTable("table1"); //Make the table
      data table function call.

      function addARecord() {
      var oRec = {c1:"Thomas",c2:"Sunish",c3:"Jayaprakash"};
      var oRecord = new YAHOO.widget.Record(oRec);

      DataTable.addRow(oRecord);

      }

      addARecord(); //Invoke function to insert the record in data
      table
      </script>
      </body>
      </html>
      ----------------------------------------------------------------------

      Kindly help me to solve this problem.

      Regards

      Jayaprakash
    • nlivengoodwaite
      I was having problems with tis as well. I found this from another post. var oRec = {c1: Thomas ,c2: Sunish ,c3: Jayaprakash }; var oRecord =
      Message 2 of 5 , May 3, 2007
        I was having problems with tis as well. I found this from another post.

        var oRec = {c1:"Thomas",c2:"Sunish",c3:"Jayaprakash"};
        var oRecord = DataTable.getRecordsSet().addRecords([oRec]);
        DataTable.appendRows.(oRecord);

        This worked great for me. What you are doing in the second line is
        adding one record to the data element and then redrawing the UI with
        the third line. Something they said they plan to enhance later.




        --- In ydn-javascript@yahoogroups.com, "Jayaprakash" <jpvalappil@...>
        wrote:
        >
        > Hi all,
        >
        > I have a data table which is based on the existing markup inside a
        > div block of my page (the contents comes from a Ajax function call
        > from some XML file).
        >
        > What I am trying to do is to add a new record in the existing data
        > table but it shows error in datatable-beta-debug.js file on line 4593.
        >
        > The source code is as follows:
        >
        > ----------------------------------------------------------------------
        > --
        > markup.htm
        > ----------------------------------------------------------------------
        > --
        > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
        > 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        > <html>
        > <head>
        > <meta http-equiv="Content-Type" content="text/html;
        > charset=iso-8859-1" />
        > <title>Markup Datatable</title>
        >
        > <script type="text/javascript"
        > src="yahoo.js"></script>
        > <script type="text/javascript" src="dom.js"></script>
        > <script type="text/javascript"
        > src="event.js"></script>
        >
        > <script type="text/javascript" src="datasource-beta-
        > debug.js"></script>
        > <script type="text/javascript" src="datatable-beta-
        > debug.js"></script>
        > </head>
        > <body>
        > <div id="table1">
        > <table cellpadding="0" cellspacing="0" width="300" border="1">
        > <thead>
        > <tr>
        > <th>Column1</th>
        > <th>Column2</th>
        > <th>Column3</th>
        > </tr>
        > </thead>
        > <tbody>
        > <tr>
        > <td width="100">Anil</td>
        > <td width="100">Binu</td>
        > <td width="100">Abhi</td>
        > </tr>
        > <tr>
        > <td width="100">Santhosh</td>
        > <td width="100">Denis</td>
        > <td width="100">Dijo</td>
        > </tr>
        > </tbody>
        > </table>
        > </div>
        > <script type="text/javascript">
        > function createDataTable(id){
        > var columnHeaders = [
        > {key:"c1",text:"Column One",sortable:true},
        > {key:"c2",text:"Column Two",sortable:true},
        > {key:"c3",text:"Column Three",sortable:true}
        > ];
        >
        > var columnSet = new YAHOO.widget.ColumnSet
        > (columnHeaders);
        >
        > var markup = YAHOO.util.Dom.get(id);
        >
        > var dataTable = new YAHOO.widget.DataTable
        > (markup,columnSet,null);
        >
        > return dataTable;
        > }
        >
        > var DataTable = createDataTable("table1"); //Make the table
        > data table function call.
        >
        > function addARecord() {
        > var oRec = {c1:"Thomas",c2:"Sunish",c3:"Jayaprakash"};
        > var oRecord = new YAHOO.widget.Record(oRec);
        >
        > DataTable.addRow(oRecord);
        >
        > }
        >
        > addARecord(); //Invoke function to insert the record in data
        > table
        > </script>
        > </body>
        > </html>
        > ----------------------------------------------------------------------
        >
        > Kindly help me to solve this problem.
        >
        > Regards
        >
        > Jayaprakash
        >
      • Celi
        Hi all, I have a data table based on a Txt. I have no problem updating and deleting records, but when I want to add an error ocurrs: expecting identifier in
        Message 3 of 5 , May 8, 2007
          Hi all,
           
          I have a data table based on a Txt. I have no problem updating and deleting records, but when I want to add an error ocurrs: "expecting identifier" in this line
           
          myDataTable.appendRows.(oRecord);
           
          The source code is as follows:
           
          Data in the txt:
           
          -------
          01001 500.00| 500.00| 535.00| 289.47| 198.60| 153.24| 126.08| 108.03| 95.19| 85.59| 78.16| 72.24| 67.43| 63.45| 60.10| 57.25| 54.80| 52.68| 50.82| 49.19| 47.74| 46.45| 45.29| 44.26| 43.32| 42.48| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
          01001 600.00| 600.00| 642.00| 347.36| 238.31| 183.88| 151.30| 129.64| 114.22| 102.71| 93.79| 86.69| 80.92| 76.14| 72.12| 68.70| 65.77| 63.22| 60.99| 59.02| 57.29| 55.74| 54.35| 53.11| 51.99| 50.97| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
          01001 700.00| 700.00| 749.00| 405.26| 278.03| 214.53| 176.52| 151.25| 133.26| 119.82| 109.42| 101.14| 94.41| 88.83| 84.14| 80.15| 76.73| 73.75| 71.15| 68.86| 66.83| 65.03| 63.41| 61.96| 60.65| 59.47| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
          01001 800.00| 800.00| 856.00| 463.15| 317.75| 245.18| 201.73| 172.86| 152.30| 136.94| 125.05| 115.59| 107.89| 101.52| 96.16| 91.61| 87.69| 84.29| 81.31| 78.70| 76.38| 74.32| 72.47| 70.81| 69.32| 67.96| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
          -------
           
          /* custom css*/
          #gridtable {margin:1em;margin-bottom:3em;}
          #gridtable table {border-collapse:collapse;}
          #gridtable th, #gridtable td , #paginated td {border:1px solid #000;width:10em;}
          #gridtable th {background-color:#666666;color:#fff;}/* gray*/
          #gridtable th .yui-dt-headtext {margin-right:5px;padding-right:15px;} /*room for arrow*/
          #gridtable th a {color:#fff;} /* white */
          #gridtable .yui-dt-sortedbyasc, #complex .yui-dt-sortedbydesc {background-color:#3F3F3F;}/*dark gray*/
          #gridtable .yui-dt-sortedbyasc .yui-dt-headtext {background-image: url('images/arrow_up.gif'); background-repeat:no-repeat; background-position:right;}/*arrow up*/
          #gridtable .yui-dt-sortedbydesc .yui-dt-headtext {background-image: url('images/arrow_dn.gif'); background-repeat:no-repeat; background-position:right;}/*arrow down*/
          #gridtable .yui-dt-odd {background-color:#eee;} /*light gray*/
          #gridtable .yui-dt-selected {background-color:#97C0A5;} /*green*/
          #gridtable .yui-dt-editable.yui-dt-highlight {background-color:#BEDAFF;} /*light blue*/ 
           
          .importestyle {text-align:right;padding-left:1em;width:50em}
          ------
          This is the script
           
          <!-- Required CSS -->
          <link rel="stylesheet" type="text/css" href="yui/fonts/fonts.css">
          <link type="text/css" rel="stylesheet" href="css/datatable.css">
          <link type="text/css" rel="stylesheet" href="yui/menu/assets/menu.css">
           
          <!-- Dependencies --> 
          <script type="text/javascript" src="yui/yahoo/yahoo.js"></script>
          <script type="text/javascript" src="yui/event/event.js"></script>
          <script type="text/javascript" src="yui/dom/dom.js"></script>
          <script type="text/javascript" src="yui/element/element-beta.js"></script>
          <script type="text/javascript" src="yui/connection/connection.js"></script>
          <script type="text/javascript" src="yui/yahoo-dom-event/yahoo-dom-event.js"></script>
          <script type="text/javascript" src="yui/datasource/datasource-beta.js"></script>
          <script type="text/javascript" src="yui/datatable/datatable-beta.js"></script>
           
          <!-- Need to also include files to enable ContextMenu -->
          <script type="text/javascript" src="yui/container/container_core.js"></script> 
          <script type="text/javascript" src="yui/menu/menu.js"></script>
           
          <script type="text/javascript">
          var myColumnHeaders = [
            {key:"Conid", text:"ID", type:"string", resizeable:true, hideable:true},
            {key:"MontoCobra", abbr:"MontoCobra", text:"Monto&nbsp;Cobra", className:"importestyle",type:"currency", sortable:true,editor:"textbox"},
            {key:"MontoFirma", text:"Monto&nbsp;Firma", className:"importestyle",type:"currency", sortable:true,editor:"textbox"},
            {key:"Cuotas02", text:"2&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas03", text:"3&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas04", text:"4&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas05", text:"5&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas06", text:"6&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas07", text:"7&nbsp;Cuotas",className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas08", text:"8&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas09", text:"9&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas10", text:"10&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas11", text:"11&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas12", text:"12&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas13", text:"13&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas14", text:"14&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas15", text:"15&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas16", text:"16&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas17", text:"17&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas18", text:"18&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas19", text:"19&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas20", text:"20&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas21", text:"21&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas22", text:"22&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas23", text:"23&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas24", text:"24&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas25", text:"25&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas26", text:"26&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas27", text:"27&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas28", text:"28&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas29", text:"29&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas30", text:"30&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas31", text:"31&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas32", text:"32&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas33", text:"33&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas34", text:"34&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas35", text:"35&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas36", text:"36&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas37", text:"37&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas38", text:"38&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas39", text:"39&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"},
            {key:"Cuotas40", text:"40&nbsp;Cuotas", className:"importestyle",type:"currency",editor:"textbox"}
           
           ];
           var myColumnSet = new YAHOO.widget.ColumnSet(myColumnHeaders);
          var myConfigs = {  
             sortedBy:{colKey:"MontoCobra",dir:"asc"},
             rowSingleSelect:true,
             MSG_LOADING:"Leyendo datos",
             MSG_ERROR:"Error leyendo datos",
             MSG_EMPTY:"No se encontraron datos",  
             paginator:true,  
             paginatorOptions: {  
              rowsPerPage: 25,  
              dropdownOptions: [10,25,50,100],  
              pageLinks: 5  
             }  
              }   
           
           
           var myDataSource = new YAHOO.util.DataSource("AmepaGeneroTXT.asp");
           myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
           myDataSource.responseSchema = {
            recordDelim: "\n",
            fieldDelim: "|",
            fields: [{key:"Conid"},
              {key:"MontoCobra",converter:YAHOO.util.DataSource.convertNumber},
              {key:"MontoFirma",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas02",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas03",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas04",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas05",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas06",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas07",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas08",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas09",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas10",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas11",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas12",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas13",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas14",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas15",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas16",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas17",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas18",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas19",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas20",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas21",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas22",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas23",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas24",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas25",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas26",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas27",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas28",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas29",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas30",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas31",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas32",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas33",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas34",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas35",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas36",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas37",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas38",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas39",converter:YAHOO.util.DataSource.convertNumber},
              {key:"Cuotas40",converter:YAHOO.util.DataSource.convertNumber}]
           };
           
           var myDataTable = new YAHOO.widget.DataTable("gridtable", myColumnSet, myDataSource, myConfigs);
           myDataTable.subscribe("cellClickEvent",myDataTable.onEventEditCell);
           myDataTable.subscribe("cellMouseoverEvent",myDataTable.onEventHighlightCell);   
          myDataTable.subscribe("cellMouseoutEvent",myDataTable.onEventUnhighlightCell); 
           
          var onRowDelete = function(oArgs) {
            };
           myDataTable.subscribe("rowDeleteEvent", onRowDelete);
           
           // menu de contexto - context menu
           var onContextMenuClick = function(p_sType, p_aArgs, p_oMenu) {
            var task = p_aArgs[1];
            if(task) {
             // Extract which row was context-clicked
             var row = this.contextEventTarget;
             while(row.tagName.toLowerCase() != "tr") {
              row = row.parentNode;
              if(row.tagName.toLowerCase == "body") {
               row = null;
               break;
              }
             }
           
             if(row) {
              switch(task.index) {
               case 0:     // Borrar - Delete Record
               if (window.confirm('Está seguro de Borrar este Registo?')){
                   
                myDataTable.deleteRow(row);
                window.alert("Registro Borrado!");
               }
               break;
               
               case 1:     // Agregar - Add record
               var oRec={Conid:"000000000000000",
                   MontoCobra:"0.00",
                   MontoFirma:"0.00",
                   Cuotas02:"0.00",
                   Cuotas03:"0.00",
                   Cuotas04:"0.00",
                   Cuotas05:"0.00",
                   Cuotas06:"0.00",
                   Cuotas07:"0.00",
                   Cuotas08:"0.00",
                   Cuotas09:"0.00",
                   Cuotas10:"0.00",
                   Cuotas11:"0.00",
                   Cuotas12:"0.00",
                   Cuotas13:"0.00",
                   Cuotas14:"0.00",
                   Cuotas15:"0.00",
                   Cuotas16:"0.00",
                   Cuotas17:"0.00",
                   Cuotas18:"0.00",
                   Cuotas19:"0.00",
                   Cuotas20:"0.00",
                   Cuotas21:"0.00",
                   Cuotas22:"0.00",
                   Cuotas23:"0.00",
                   Cuotas24:"0.00",
                   Cuotas25:"0.00",
                   Cuotas26:"0.00",
                   Cuotas27:"0.00",
                   Cuotas28:"0.00",
                   Cuotas29:"0.00",
                   Cuotas30:"0.00",
                   Cuotas31:"0.00",
                   Cuotas32:"0.00",
                   Cuotas33:"0.00",
                   Cuotas34:"0.00",
                   Cuotas35:"0.00",
                   Cuotas36:"0.00",
                   Cuotas37:"0.00",
                   Cuotas38:"0.00",
                   Cuotas39:"0.00",
                   Cuotas40:"0.00"
              };
               var oRecord = myDataTable.getRecordSet().addRecords([oRec]);
               myDataTable.appendRows.(oRecord);
               break;
              }
             }
            }
           };
           
           var myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu", { trigger: myDataTable.getBody() } );
           myContextMenu.addItem("Borrar Registro"); // Borrar - Delete Record
           myContextMenu.addItem("Agregar Registro"); // Agregar - Add record
           myContextMenu.render(document.body);
           myContextMenu.clickEvent.subscribe(onContextMenuClick);
           
           
          // editar celda - update cell
           var onCellEdit = function(oArgs) {
            var oldData = oArgs.oldData || "";
            var newData = oArgs.newData || "";
            var id=oArgs.target.id
            
            if (newData==""){
             newData=0;
             oArgs.newData=0;
             }
            else if (parseFloat(newData)< 0) {
             newData=0;
             oArgs.newData=0;
             }
             myDataTable.showPage(1);
             window.alert("Dato Actualizado!");
            
            }
           myDataTable.subscribe("cellEditEvent",onCellEdit);
           
           
          </script>
           
          Thanks!
          Celina
        • Jason Stell
          looks like you ve got an extra . in there, after the appendRows try: myDataTable. appendRows (oRecord) ; ... From: Celi To:
          Message 4 of 5 , May 8, 2007
            looks like you've got an extra '.' in there, after the "appendRows"
            try:
            myDataTable. appendRows (oRecord) ;

            ----- Original Message ----
            From: Celi <celina.ortelli@...>
            To: ydn-javascript@yahoogroups.com
            Sent: Tuesday, May 8, 2007 1:09:34 PM
            Subject: [ydn-javascript] Problem with Adding a row in a data table

            Hi all,
             
            I have a data table based on a Txt. I have no problem updating and deleting records, but when I want to add an error ocurrs: "expecting identifier" in this line
             
            myDataTable. appendRows. (oRecord) ;
             
            The source code is as follows:
             
            Data in the txt:
             
            -------
            01001 500.00| 500.00| 535.00| 289.47| 198.60| 153.24| 126.08| 108.03| 95.19| 85.59| 78.16| 72.24| 67.43| 63.45| 60.10| 57.25| 54.80| 52.68| 50.82| 49.19| 47.74| 46.45| 45.29| 44.26| 43.32| 42.48| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
            01001 600.00| 600.00| 642.00| 347.36| 238.31| 183.88| 151.30| 129.64| 114.22| 102.71| 93.79| 86.69| 80.92| 76.14| 72.12| 68.70| 65.77| 63.22| 60.99| 59.02| 57.29| 55.74| 54.35| 53.11| 51.99| 50.97| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
            01001 700.00| 700.00| 749.00| 405.26| 278.03| 214.53| 176.52| 151.25| 133.26| 119.82| 109.42| 101.14| 94.41| 88.83| 84.14| 80.15| 76.73| 73.75| 71.15| 68.86| 66.83| 65.03| 63.41| 61.96| 60.65| 59.47| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
            01001 800.00| 800.00| 856.00| 463.15| 317.75| 245.18| 201.73| 172.86| 152.30| 136.94| 125.05| 115.59| 107.89| 101.52| 96.16| 91.61| 87.69| 84.29| 81.31| 78.70| 76.38| 74.32| 72.47| 70.81| 69.32| 67.96| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
            -------
             
            /* custom css*/
            #gridtable {margin:1em; margin-bottom: 3em;}
            #gridtable table {border-collapse: collapse; }
            #gridtable th, #gridtable td , #paginated td {border:1px solid #000;width:10em; }
            #gridtable th {background- color:#666666; color:#fff; }/* gray*/
            #gridtable th .yui-dt-headtext {margin-right: 5px;padding- right:15px; } /*room for arrow*/
            #gridtable th a {color:#fff; } /* white */
            #gridtable .yui-dt-sortedbyasc , #complex .yui-dt-sortedbydes c {background- color:#3F3F3F; }/*dark gray*/
            #gridtable .yui-dt-sortedbyasc .yui-dt-headtext {background- image: url('images/ arrow_up. gif'); background-repeat: no-repeat; background-position :right;}/ *arrow up*/
            #gridtable .yui-dt-sortedbydes c .yui-dt-headtext {background- image: url('images/ arrow_dn. gif'); background-repeat: no-repeat; background-position :right;}/ *arrow down*/
            #gridtable .yui-dt-odd {background- color:#eee; } /*light gray*/
            #gridtable .yui-dt-selected {background- color:#97C0A5; } /*green*/
            #gridtable .yui-dt-editable. yui-dt-highlight {background- color:#BEDAFF; } /*light blue*/ 
             
            .importestyle {text-align: right;padding- left:1em; width:50em}
            ------
            This is the script
             
            <!-- Required CSS -->
            <link rel="stylesheet" type="text/css" href="yui/fonts/ fonts.css">
            <link type="text/css" rel="stylesheet" href="css/datatable .css">
            <link type="text/css" rel="stylesheet" href="yui/menu/ assets/menu. css">
             
            <!-- Dependencies --> 
            <script type="text/javascri pt" src="yui/yahoo/ yahoo.js"></script>
            <script type="text/javascri pt" src="yui/event/ event.js"></script>
            <script type="text/javascri pt" src="yui/dom/ dom.js"></script>
            <script type="text/javascri pt" src="yui/element/ element-beta. js"></script>
            <script type="text/javascri pt" src="yui/connection /connection. js"></script>
            <script type="text/javascri pt" src="yui/yahoo- dom-event/ yahoo-dom- event.js"></script>
            <script type="text/javascri pt" src="yui/datasource /datasource- beta.js"></script>
            <script type="text/javascri pt" src="yui/datatable/ datatable- beta.js"></script>
             
            <!-- Need to also include files to enable ContextMenu -->
            <script type="text/javascri pt" src="yui/container/ container_ core.js"></script> 
            <script type="text/javascri pt" src="yui/menu/ menu.js"></script>
             
            <script type="text/javascri pt">
            var myColumnHeaders = [
              {key:"Conid" , text:"ID", type:"string" , resizeable:true, hideable:true} ,
              {key:"MontoCobra" , abbr:"MontoCobra" , text:"Monto&nbsp;Cobra", className:"importes tyle",type: "currency" , sortable:true, editor:"textbox" },
              {key:"MontoFirma" , text:"Monto&nbsp;Firma", className:"importes tyle",type: "currency" , sortable:true, editor:"textbox" },
              {key:"Cuotas02" , text:"2&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas03" , text:"3&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas04" , text:"4&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas05" , text:"5&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas06" , text:"6&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas07" , text:"7&nbsp;Cuotas" ,className: "importestyle" ,type:"currency" ,editor:" textbox"} ,
              {key:"Cuotas08" , text:"8&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas09" , text:"9&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas10" , text:"10&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas11" , text:"11&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas12" , text:"12&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas13" , text:"13&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas14" , text:"14&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas15" , text:"15&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas16" , text:"16&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas17" , text:"17&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas18" , text:"18&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas19" , text:"19&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas20" , text:"20&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas21" , text:"21&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas22" , text:"22&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas23" , text:"23&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas24" , text:"24&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas25" , text:"25&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas26" , text:"26&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas27" , text:"27&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas28" , text:"28&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas29" , text:"29&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas30" , text:"30&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas31" , text:"31&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas32" , text:"32&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas33" , text:"33&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas34" , text:"34&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas35" , text:"35&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas36" , text:"36&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas37" , text:"37&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas38" , text:"38&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas39" , text:"39&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
              {key:"Cuotas40" , text:"40&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"}
             
             ];
             var myColumnSet = new YAHOO.widget. ColumnSet( myColumnHeaders) ;
            var myConfigs = {  
               sortedBy:{colKey: "MontoCobra" ,dir:"asc" },
               rowSingleSelect: true,
               MSG_LOADING: "Leyendo datos",
               MSG_ERROR:"Error leyendo datos",
               MSG_EMPTY:"No se encontraron datos",  
               paginator:true,  
               paginatorOptions: {  
                rowsPerPage: 25,  
                dropdownOptions: [10,25,50,100] ,  
                pageLinks: 5  
               }  
                }   
             
             
             var myDataSource = new YAHOO.util.DataSour ce("AmepaGeneroT XT.asp");
             myDataSource. responseType = YAHOO.util.DataSour ce.TYPE_TEXT;
             myDataSource. responseSchema = {
              recordDelim: "\n",
              fieldDelim: "|",
              fields: [{key:"Conid" },
                {key:"MontoCobra" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"MontoFirma" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas02" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas03" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas04" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas05" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas06" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas07" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas08" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas09" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas10" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas11" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas12" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas13" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas14" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas15" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas16" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas17" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas18" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas19" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas20" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas21" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas22" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas23" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas24" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas25" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas26" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas27" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas28" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas29" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas30" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas31" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas32" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas33" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas34" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas35" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas36" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas37" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas38" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas39" ,converter: YAHOO.util. DataSource. convertNumber} ,
                {key:"Cuotas40" ,converter: YAHOO.util. DataSource. convertNumber} ]
             };
             
             var myDataTable = new YAHOO.widget. DataTable( "gridtable" , myColumnSet, myDataSource, myConfigs);
             myDataTable. subscribe( "cellClickEvent" ,myDataTable. onEventEditCell) ;
             myDataTable. subscribe( "cellMouseoverEv ent",myDataTable .onEventHighligh tCell);   
            myDataTable. subscribe( "cellMouseoutEve nt",myDataTable. onEventUnhighlig htCell); 
             
            var onRowDelete = function(oArgs) {
              };
             myDataTable. subscribe( "rowDeleteEvent" , onRowDelete) ;
             
             // menu de contexto - context menu
             var onContextMenuClick = function(p_sType, p_aArgs, p_oMenu) {
              var task = p_aArgs[1];
              if(task) {
               // Extract which row was context-clicked
               var row = this.contextEventTa rget;
               while(row.tagName. toLowerCase( ) != "tr") {
                row = row.parentNode;
                if(row.tagName. toLowerCase == "body") {
                 row = null;
                 break;
                }
               }
             
               if(row) {
                switch(task. index) {
                 case 0:     // Borrar - Delete Record
                 if (window.confirm( 'Está seguro de Borrar este Registo?')){
                     
                  myDataTable. deleteRow( row);
                  window.alert( "Registro Borrado!");
                 }
                 break;
                 
                 case 1:     // Agregar - Add record
                 var oRec={Conid: "000000000000000 ",
                     MontoCobra:" 0.00",
                     MontoFirma:" 0.00",
                     Cuotas02:"0. 00",
                     Cuotas03:"0. 00",
                     Cuotas04:"0. 00",
                     Cuotas05:"0. 00",
                     Cuotas06:"0. 00",
                     Cuotas07:"0. 00",
                     Cuotas08:"0. 00",
                     Cuotas09:"0. 00",
                     Cuotas10:"0. 00",
                     Cuotas11:"0. 00",
                     Cuotas12:"0. 00",
                     Cuotas13:"0. 00",
                     Cuotas14:"0. 00",
                     Cuotas15:"0. 00",
                     Cuotas16:"0. 00",
                     Cuotas17:"0. 00",
                     Cuotas18:"0. 00",
                     Cuotas19:"0. 00",
                     Cuotas20:"0. 00",
                     Cuotas21:"0. 00",
                     Cuotas22:"0. 00",
                     Cuotas23:"0. 00",
                     Cuotas24:"0. 00",
                     Cuotas25:"0. 00",
                     Cuotas26:"0. 00",
                     Cuotas27:"0. 00",
                     Cuotas28:"0. 00",
                     Cuotas29:"0. 00",
                     Cuotas30:"0. 00",
                     Cuotas31:"0. 00",
                     Cuotas32:"0. 00",
                     Cuotas33:"0. 00",
                     Cuotas34:"0. 00",
                     Cuotas35:"0. 00",
                     Cuotas36:"0. 00",
                     Cuotas37:"0. 00",
                     Cuotas38:"0. 00",
                     Cuotas39:"0. 00",
                     Cuotas40:"0. 00"
                };
                 var oRecord = myDataTable. getRecordSet( ).addRecords( [oRec]);
                 myDataTable. appendRows. (oRecord) ;
                 break;
                }
               }
              }
             };
             
             var myContextMenu = new YAHOO.widget. ContextMenu( "mycontextmenu" , { trigger: myDataTable. getBody() } );
             myContextMenu. addItem(" Borrar Registro"); // Borrar - Delete Record
             myContextMenu. addItem(" Agregar Registro"); // Agregar - Add record
             myContextMenu. render(document. body);
             myContextMenu. clickEvent. subscribe( onContextMenuCli ck);
             
             
            // editar celda - update cell
             var onCellEdit = function(oArgs) {
              var oldData = oArgs.oldData || "";
              var newData = oArgs.newData || "";
              var id=oArgs.target. id
              
              if (newData=="" ){
               newData=0;
               oArgs.newData= 0;
               }
              else if (parseFloat( newData)< 0) {
               newData=0;
               oArgs.newData= 0;
               }
               myDataTable. showPage( 1);
               window.alert( "Dato Actualizado! ");
              
              }
             myDataTable. subscribe( "cellEditEvent" ,onCellEdit) ;
             
             
            </script>
             
            Thanks!
            Celina

          • Celi
            It was easy!!!! really thanks! Celi _____ De: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] En nombre de Jason Stell Enviado el:
            Message 5 of 5 , May 9, 2007
              It was easy!!!!
              really thanks!
               
              Celi
               


              De: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] En nombre de Jason Stell
              Enviado el: Martes, 08 de Mayo de 2007 06:22 p.m.
              Para: ydn-javascript@yahoogroups.com
              Asunto: Re: [ydn-javascript] Problem with Adding a row in a data table

              looks like you've got an extra '.' in there, after the "appendRows"
              try:
              myDataTable. appendRows (oRecord) ;

              ----- Original Message ----
              From: Celi <celina.ortelli@ gmail.com>
              To: ydn-javascript@ yahoogroups. com
              Sent: Tuesday, May 8, 2007 1:09:34 PM
              Subject: [ydn-javascript] Problem with Adding a row in a data table

              Hi all,
               
              I have a data table based on a Txt. I have no problem updating and deleting records, but when I want to add an error ocurrs: "expecting identifier" in this line
               
              myDataTable. appendRows. (oRecord) ;
               
              The source code is as follows:
               
              Data in the txt:
               
              -------
              01001 500.00| 500.00| 535.00| 289.47| 198.60| 153.24| 126.08| 108.03| 95.19| 85.59| 78.16| 72.24| 67.43| 63.45| 60.10| 57.25| 54.80| 52.68| 50.82| 49.19| 47.74| 46.45| 45.29| 44.26| 43.32| 42.48| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
              01001 600.00| 600.00| 642.00| 347.36| 238.31| 183.88| 151.30| 129.64| 114.22| 102.71| 93.79| 86.69| 80.92| 76.14| 72.12| 68.70| 65.77| 63.22| 60.99| 59.02| 57.29| 55.74| 54.35| 53.11| 51.99| 50.97| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
              01001 700.00| 700.00| 749.00| 405.26| 278.03| 214.53| 176.52| 151.25| 133.26| 119.82| 109.42| 101.14| 94.41| 88.83| 84.14| 80.15| 76.73| 73.75| 71.15| 68.86| 66.83| 65.03| 63.41| 61.96| 60.65| 59.47| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
              01001 800.00| 800.00| 856.00| 463.15| 317.75| 245.18| 201.73| 172.86| 152.30| 136.94| 125.05| 115.59| 107.89| 101.52| 96.16| 91.61| 87.69| 84.29| 81.31| 78.70| 76.38| 74.32| 72.47| 70.81| 69.32| 67.96| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|\n
              -------
               
              /* custom css*/
              #gridtable {margin:1em; margin-bottom: 3em;}
              #gridtable table {border-collapse: collapse; }
              #gridtable th, #gridtable td , #paginated td {border:1px solid #000;width:10em; }
              #gridtable th {background- color:#666666; color:#fff; }/* gray*/
              #gridtable th .yui-dt-headtext {margin-right: 5px;padding- right:15px; } /*room for arrow*/
              #gridtable th a {color:#fff; } /* white */
              #gridtable .yui-dt-sortedbyasc , #complex .yui-dt-sortedbydes c {background- color:#3F3F3F; }/*dark gray*/
              #gridtable .yui-dt-sortedbyasc .yui-dt-headtext {background- image: url('images/ arrow_up. gif'); background-repeat: no-repeat; background-position :right;}/ *arrow up*/
              #gridtable .yui-dt-sortedbydes c .yui-dt-headtext {background- image: url('images/ arrow_dn. gif'); background-repeat: no-repeat; background-position :right;}/ *arrow down*/
              #gridtable .yui-dt-odd {background- color:#eee; } /*light gray*/
              #gridtable .yui-dt-selected {background- color:#97C0A5; } /*green*/
              #gridtable .yui-dt-editable. yui-dt-highlight {background- color:#BEDAFF; } /*light blue*/ 
               
              .importestyle {text-align: right;padding- left:1em; width:50em}
              ------
              This is the script
               
              <!-- Required CSS -->
              <link rel="stylesheet" type="text/css" href="yui/fonts/ fonts.css">
              <link type="text/css" rel="stylesheet" href="css/datatable .css">
              <link type="text/css" rel="stylesheet" href="yui/menu/ assets/menu. css">
               
              <!-- Dependencies --> 
              <script type="text/javascri pt" src="yui/yahoo/ yahoo.js"></script>
              <script type="text/javascri pt" src="yui/event/ event.js"></script>
              <script type="text/javascri pt" src="yui/dom/ dom.js"></script>
              <script type="text/javascri pt" src="yui/element/ element-beta. js"></script>
              <script type="text/javascri pt" src="yui/connection /connection. js"></script>
              <script type="text/javascri pt" src="yui/yahoo- dom-event/ yahoo-dom- event.js"></script>
              <script type="text/javascri pt" src="yui/datasource /datasource- beta.js"></script>
              <script type="text/javascri pt" src="yui/datatable/ datatable- beta.js"></script>
               
              <!-- Need to also include files to enable ContextMenu -->
              <script type="text/javascri pt" src="yui/container/ container_ core.js"></script> 
              <script type="text/javascri pt" src="yui/menu/ menu.js"></script>
               
              <script type="text/javascri pt">
              var myColumnHeaders = [
                {key:"Conid" , text:"ID", type:"string" , resizeable:true, hideable:true} ,
                {key:"MontoCobra" , abbr:"MontoCobra" , text:"Monto&nbsp;Cobra", className:"importes tyle",type: "currency" , sortable:true, editor:"textbox" },
                {key:"MontoFirma" , text:"Monto&nbsp;Firma", className:"importes tyle",type: "currency" , sortable:true, editor:"textbox" },
                {key:"Cuotas02" , text:"2&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas03" , text:"3&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas04" , text:"4&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas05" , text:"5&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas06" , text:"6&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas07" , text:"7&nbsp;Cuotas" ,className: "importestyle" ,type:"currency" ,editor:" textbox"} ,
                {key:"Cuotas08" , text:"8&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas09" , text:"9&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas10" , text:"10&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas11" , text:"11&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas12" , text:"12&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas13" , text:"13&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas14" , text:"14&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas15" , text:"15&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas16" , text:"16&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas17" , text:"17&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas18" , text:"18&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas19" , text:"19&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas20" , text:"20&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas21" , text:"21&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas22" , text:"22&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas23" , text:"23&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas24" , text:"24&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas25" , text:"25&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas26" , text:"26&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas27" , text:"27&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas28" , text:"28&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas29" , text:"29&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas30" , text:"30&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas31" , text:"31&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas32" , text:"32&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas33" , text:"33&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas34" , text:"34&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas35" , text:"35&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas36" , text:"36&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas37" , text:"37&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas38" , text:"38&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas39" , text:"39&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"} ,
                {key:"Cuotas40" , text:"40&nbsp;Cuotas" , className:"importes tyle",type: "currency" ,editor:" textbox"}
               
               ];
               var myColumnSet = new YAHOO.widget. ColumnSet( myColumnHeaders) ;
              var myConfigs = {  
                 sortedBy:{colKey: "MontoCobra" ,dir:"asc" },
                 rowSingleSelect: true,
                 MSG_LOADING: "Leyendo datos",
                 MSG_ERROR:"Error leyendo datos",
                 MSG_EMPTY:"No se encontraron datos",  
                 paginator:true,  
                 paginatorOptions: {  
                  rowsPerPage: 25,  
                  dropdownOptions: [10,25,50,100] ,  
                  pageLinks: 5  
                 }  
                  }   
               

               var myDataSource = new YAHOO.util.DataSour ce("AmepaGeneroT XT.asp");
               myDataSource. responseType = YAHOO.util.DataSour ce.TYPE_TEXT;
               myDataSource. responseSchema = {
                recordDelim: "\n",
                fieldDelim: "|",
                fields: [{key:"Conid" },
                  {key:"MontoCobra" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"MontoFirma" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas02" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas03" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas04" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas05" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas06" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas07" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas08" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas09" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas10" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas11" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas12" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas13" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas14" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas15" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas16" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas17" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas18" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas19" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas20" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas21" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas22" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas23" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas24" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas25" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas26" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas27" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas28" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas29" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas30" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas31" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas32" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas33" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas34" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas35" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas36" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas37" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas38" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas39" ,converter: YAHOO.util. DataSource. convertNumber} ,
                  {key:"Cuotas40" ,converter: YAHOO.util. DataSource. convertNumber} ]
               };
               
               var myDataTable = new YAHOO.widget. DataTable( "gridtable" , myColumnSet, myDataSource, myConfigs);
               myDataTable. subscribe( "cellClickEvent" ,myDataTable. onEventEditCell) ;
               myDataTable. subscribe( "cellMouseoverEv ent",myDataTable .onEventHighligh tCell);   
              myDataTable. subscribe( "cellMouseoutEve nt",myDataTable. onEventUnhighlig htCell); 
               
              var onRowDelete = function(oArgs) {
                };
               myDataTable. subscribe( "rowDeleteEvent" , onRowDelete) ;
               
               // menu de contexto - context menu
               var onContextMenuClick = function(p_sType, p_aArgs, p_oMenu) {
                var task = p_aArgs[1];
                if(task) {
                 // Extract which row was context-clicked
                 var row = this.contextEventTa rget;
                 while(row.tagName. toLowerCase( ) != "tr") {
                  row = row.parentNode;
                  if(row.tagName. toLowerCase == "body") {
                   row = null;
                   break;
                  }
                 }
               
                 if(row) {
                  switch(task. index) {
                   case 0:     // Borrar - Delete Record
                   if (window.confirm( 'Está seguro de Borrar este Registo?')){
                       
                    myDataTable. deleteRow( row);
                    window.alert( "Registro Borrado!");
                   }
                   break;
                   
                   case 1:     // Agregar - Add record
                   var oRec={Conid: "000000000000000 ",
                       MontoCobra:" 0.00",
                       MontoFirma:" 0.00",
                       Cuotas02:"0. 00",
                       Cuotas03:"0. 00",
                       Cuotas04:"0. 00",
                       Cuotas05:"0. 00",
                       Cuotas06:"0. 00",
                       Cuotas07:"0. 00",
                       Cuotas08:"0. 00",
                       Cuotas09:"0. 00",
                       Cuotas10:"0. 00",
                       Cuotas11:"0. 00",
                       Cuotas12:"0. 00",
                       Cuotas13:"0. 00",
                       Cuotas14:"0. 00",
                       Cuotas15:"0. 00",
                       Cuotas16:"0. 00",
                       Cuotas17:"0. 00",
                       Cuotas18:"0. 00",
                       Cuotas19:"0. 00",
                       Cuotas20:"0. 00",
                       Cuotas21:"0. 00",
                       Cuotas22:"0. 00",
                       Cuotas23:"0. 00",
                       Cuotas24:"0. 00",
                       Cuotas25:"0. 00",
                       Cuotas26:"0. 00",
                       Cuotas27:"0. 00",
                       Cuotas28:"0. 00",
                       Cuotas29:"0. 00",
                       Cuotas30:"0. 00",
                       Cuotas31:"0. 00",
                       Cuotas32:"0. 00",
                       Cuotas33:"0. 00",
                       Cuotas34:"0. 00",
                       Cuotas35:"0. 00",
                       Cuotas36:"0. 00",
                       Cuotas37:"0. 00",
                       Cuotas38:"0. 00",
                       Cuotas39:"0. 00",
                       Cuotas40:"0. 00"
                  };
                   var oRecord = myDataTable. getRecordSet( ).addRecords( [oRec]);
                   myDataTable. appendRows. (oRecord) ;
                   break;
                  }
                 }
                }
               };
               
               var myContextMenu = new YAHOO.widget. ContextMenu( "mycontextmenu" , { trigger: myDataTable. getBody() } );
               myContextMenu. addItem(" Borrar Registro"); // Borrar - Delete Record
               myContextMenu. addItem(" Agregar Registro"); // Agregar - Add record
               myContextMenu. render(document. body);
               myContextMenu. clickEvent. subscribe( onContextMenuCli ck);
               
               
              // editar celda - update cell
               var onCellEdit = function(oArgs) {
                var oldData = oArgs.oldData || "";
                var newData = oArgs.newData || "";
                var id=oArgs.target. id
                
                if (newData=="" ){
                 newData=0;
                 oArgs.newData= 0;
                 }
                else if (parseFloat( newData)< 0) {
                 newData=0;
                 oArgs.newData= 0;
                 }
                 myDataTable. showPage( 1);
                 window.alert( "Dato Actualizado! ");
                
                }
               myDataTable. subscribe( "cellEditEvent" ,onCellEdit) ;
               
               
              </script>
               
              Thanks!
              Celina

            Your message has been successfully submitted and would be delivered to recipients shortly.