Upcoming Grails-UI 1.1 New Features: DataTable Inline Cell Editing

One of the most requested features for Grails-UI was inline cell editing for the dataTable component. In order to make this work, you’ll need to have a URL to send the change request. Each row can have its own editor, which can have its own URL for change requests. In this example, I’m using the same url (resolved from a controller and action) for simplicity’s sake.

You can add an editor and/or a formatter to each row. The current valid formatter values are: text, date, number, currency, radio, and dropdown.

Each editor can be provided with a config mapping that will be passed through to the YUI CellEditor object.

Text Editor

Text Editor

Date Editor

Date Editor

If you want to use the inline date editing feature, be sure to include the datePicker in your gui:resources tag!

Checkbox Editor

Checkbox Editor

Dropdown Editor

Dropdown Editor

Radio Editor

Radio Editor

This is the second of several installments on new features that will be a part of Grails-UI 1.1. I’m still working on it, and I’m not sure when the release date will be, but if you’d like to try it out in your application, you can get the source from SVN:

svn checkout http://svn.codehaus.org/grails-plugins/grails-grails-ui/branches/RELEASE_1_1-SNAPSHOT

Then package with grails package-plugin, and install into your project: grails install-plugin /path/to/snapshot/grails-grails-ui-1.1-SNAPSHOT.zip

This entry was posted in grails plugins, tools and tagged , , , . Bookmark the permalink. Comments are closed, but you can leave a trackback: Trackback URL.

7 Comments

  1. Roshan Shrestha
    Posted January 30, 2009 at 10:17 am | Permalink

    Thanks for the effort.

    One enhancement that would make this even more useful would be the ability to do “row editing”, i.e., set the whole row in edit mode, instead of one cell at a time.

  2. seanoc5
    Posted August 16, 2009 at 6:37 pm | Permalink

    Great plugin, and the new snapshot functionality looks quite sharp. I am js-challenged, but have made my way to be able to implement a datatable in either straight YUI, or through your much easier plugin.

    HOW do I properly configure the back-end controller response? I successfully submit the inline cell change AND update the GORM data on the server, but get an error in the datatable. I assume I am just missing what I need to send as a success code… but I don’t see it mentioned here.

    Any help much appreciated, and thanks for your time and effort.

    Sean

  3. Posted September 29, 2009 at 10:48 pm | Permalink

    @seanoc5 Sorry it has taken so long for me to respond. You’ll have better luck by mailing the Grails user list (more info here).

    You will want to install FireBug or something like it to see if there is a client side javascript error happening. The JSON format is a bit tricky to get right, but if you follow the example, you should be pretty close.

  4. Yuanjing
    Posted November 22, 2009 at 8:43 am | Permalink

    How do I change the default sort order to DESC?
    Thanks.

  5. Posted November 22, 2009 at 11:25 am | Permalink

    sortOrder=”DESC”

  6. kai
    Posted January 28, 2010 at 5:42 am | Permalink

    hello i was trying out the grailsui inline edit features from grailsui1.2Snapshot.
    when i put formatter:’text’ and formatter:’number’ everything works fine. But when i try formatter:’date’ the calendar didn’t pop out. Digging in through firebug i get this error when i click on the date on the page.

    K.getMonth is not a function

    am i parsing in the wrong date format?
    i tried MM/dd/yyyy, MM/dd/yy, yyyy-MM-dd and some other weird combination and it still doesn’t work. Help ?

  7. Posted January 28, 2010 at 12:25 pm | Permalink

    @kai In order to send a date from the server to the GUI within the JSON string the data table expects, you have to massage the date string on the server a bit. There is no proper date string format in JSON, so GrailsUI helps out a bit by giving you a service method to translate your Date object into a string for the JSON transfer. See here:

    http://code.google.com/p/guidemo/source/browse/trunk/grails-app/controllers/DemoController.groovy#174

    You want to call the grails ui service like so:

    grailsUITagLibService.dateToJs(myDateObject)

    when you make your json structure.

One Trackback

  1. By ALTERthought Blogs » Grails App in ~40 hrs (part 5) on September 3, 2009 at 12:14 pm

    [...] So now what? Well, working The Google On The Internet Machine revealed that the 1.1-SNAPSHOT has inline cell editing capabilities so I downloaded the 1.1-SNAPSHOT version from the plugin site and installed it from my local drive [...]

Check out the latest GroovyMag to see an interview with me about the 1.1 release of GrailsUI: