Monday, May 2, 2011

jQuery Plugins

I've been trying out a few jQuery plugins lately: templates and globalization
Although the documentation for them is somewhat lacking
I made a few examples using them and I was impressed with the results

I originally started looking at the templates plugin as an alternative to the datatables plugin
Not to replace datatables, but just as a simpler solution for filling in tables rows without needs like paging and sorting
I originally found the jQote plugin and then the templates plugin. Very different syntax between the two, and I chose the later.
It was as simple as creating a template for a row (in script tag, mixing html and javascript) and passing in a JSON array of data.
Works well with REST services passing json data back.
Also with JSON mappings for descriptions, like supporting multiple languages (re-render template with new JSON data).
One thing I didn't use from any of the template plugin examples was the use of appendTo(), instead just setting the html() value.

For globalization, I just wanted to be able to format dates, format numbers, and parse dates.
But also have the flexibility to easily change this formatting (like month name in the date or currency) based on the locale.

These two plugins are in a beta version, and I look forward to them being released and official jQuery plugins (as mentioned in news stores from last year).

1 comment:

  1. I think jQuery templates non-standard-ness is coming back to bite it

    Atleast when being used with any JavaScript/HTML tools
    Since HTML tools can't help with HTML in a script tag
    And JavaScript tools also don't like HTML in a script tag

    ReplyDelete