| Page 1 of 1 | [ 2 posts ] |
|
Hi All,
I am working on DataTable with an ability of adding a new row with textboxes in each field. Only adding row has textboxes, the old rows are editable or non-editable. Do you have any ideas to do that? Thanks |
|
Not sure if this post belongs here or in YUI 2 Forums, but I can provide a suggestion for YUI 2.x.
You can create a DataTable record that includes HTML definitions for INPUT text elements and where your last column includes an HTML BUTTON object, call it id='btnInsertNEW'. After the DataTable is created, use the "addRow" method to add the insert row as the first record (at the top of the table). Code: var myDT = new YAHOO.widget.DataTable( .... your creation options here ... ) // Define the INPUT insert row ... var insert_row = { col1: "<input type='text' id='idTxt1' value='' />", col2: "<input type='text' id='idTxt2' value='' />", col3: "<input type='text' id='idTxt3' value='' />", ... etc and the last column would be colN: "<button id='btnInserNEW'>Insert Record</button>"; }; // Note : the record keynames above 'col1', 'col2' will have to match the field names for the Columns and DataSource. myDT.addRow( insert_row, 0 ); You can then create a YUI Button object and a click handler to handle processing the ID's ('idTxt1', 'idTxt2', etc..) and inserting the values of the INPUT elements into your recordSet at your server and/or in the current DataTable in Javascript. If you need help with inserting the data in the RecordSet you can review the YUI info and/or ask for help. Another thought, if you are using inline Cell editing you could simply insert a row with all data set to "" or null and still insert the BUTTON as the last column. Then use the Cell editing to make changes to each column, and follow the BUTTON reasoning I have above to process and insert the record. Good Luck, Todd |
| Page 1 of 1 | [ 2 posts ] |
| 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 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group