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

Re: select, insert, update, delete on datatable.

Expand Messages
  • Ted Husted
    The YUI context menu example demonstrates deleting * http://developer.yahoo.com/yui/examples/datatable/contextmenu.html You could do inserting the same way.
    Message 1 of 4 , Jun 1, 2007
    View Source
    • 0 Attachment
      The YUI context menu example demonstrates deleting

      * http://developer.yahoo.com/yui/examples/datatable/contextmenu.html

      You could do inserting the same way. When client right-clicks and
      chooses insert, create a blank record and insert it into the table.
      Then they can edit the blank fields normally. (Assuming that your
      database will accept blank records!) The trick with inserting is that
      you have to do it twice, once for the recordset and again for the
      datatable.

      Though, the problem with doing all this editing inline is that it's
      easy to get out of synch with the database, and there's little room to
      do validation and other niceties. The inline click can be nice for
      quick edits, but for anything substantial, a full-sized form seems better.

      As an alternative, we created a "DataForm" widget that can share a
      recordset with a companion DataTable. For editing, we flip to the
      horizontal DataForm. On submit, we can send the asynch request to the
      database, and on the call back, we can switch back to the DataList. If
      the database update fails, the form is still open.

      There's an example that uses static data here

      * http://yazaar.org/examples/dataform/tutorial-tabview.html

      It also uses select and checkbox controls, as well as unobtrusive
      validation. (Dates are next!)

      Now that its feature-complete, we're now starting to use it in our
      intranet application that uses a database. The code has hooks for
      methods that we can override to do the insert, update, and deletes.

      HTH, Ted.


      --- In ydn-javascript@yahoogroups.com, "John Haig" <jhaig@...> wrote:
      >
      >
      > Sure,
      >
      > here's my html. You should be able to find the yui stuff and plop it
      > on your server. The data Im' showing coming from just a plain text
      > file, but in my situation, I'm using hibernate and json classes to
      > generate that same string from a database. One thing I seem to have
      > learned is make sure that string is all you send. No whitespace, no
      > headers, nada.
      >
      > But back to my thread, how would I alter this code to allow for adding
      > and deleting rows from this table. Then extra points if you can help
      > me send the changed data in json format back up to the server.
      >
      > Thanks.
    Your message has been successfully submitted and would be delivered to recipients shortly.