Skip to main content
ajdove
Known Participant
August 16, 2010
Question

How to add new row to datagrid using button

  • August 16, 2010
  • 1 reply
  • 725 views

I am interested in creating a datagrid with the ability to add new rows by clicking a "+" button. The datagrid grows vertically with new rows added to the bottom to allow new entries. If a user wants to delete a row they have already entered they can click a "-" button next to the row.

Alex

    This topic has been closed for replies.

    1 reply

    September 3, 2010

    Here's how i like to do this...

    Create a form that inserts records into a database table (i like to use an Insert query in a cfquery), and add a grid that shows the records from the table.  You'll want the form to post to itself by using <cfform name="form1" action="#cgi.script_name#" method="post">.  As far as deleting records is concerned you can output a hyperlink that includes a parameter that identifies the action and record, e.g. ?act=del&id=1234123.  Keep in mind there may be a security issue here if there's a potential for url hacking.  You can also use session varialbles to accomplish the same thing.