jQuery Grid 2.0
August 4th, 2007
I have made a decision to go direct to version 2.0, since this release has a lot of new features and bug fixes. Thanks to all that helped me to make this better. I will begin with a fixed bugs.
- IE and Safari hanging when some values in the xml node are empty – i.e. <row></row>. Now I use a different approach – see the new features.
- IE does not format correct the table row if some data is empty – I analyze the data and add a space if it is empty.
- Sorting problem if we do not set sort property in the column model.
- Pager does not have correct navigation if we use a onSelectRow method and are on the first(last) page and clicking the first(last) or previous (next) page buttons.
- Now the Grid can read a xml file which is not returned from any server side language (thanks to Damian).
- The long awaited support for JSON data. See documentation for more details. In short – if we want to use a JSON there is a new option datatype. Set this option to “json” and enjoy. Default is “xml”. In case of “json” the grid is much more faster.
- Improved is a speed of reading the xml data. The bug in IE (empty node value) force me not to use a firstChild.nodeValue (iteration of the xml tree), but a simple text (IE) and textContent (Mozilla) property. This improved a speed in a big data sets.
- Now we can set a width of the grid (thanks to Luca). This is achieved with a new option width. How it works: If this option is not set, the width of the grid is a sum of the width’s of the columns defined in the column model + 20 pixels. If this option is set the width of each column is scaled according to the defined width. Example: if we define two columns with a width of 80 and 120 pixels, but want the grid to have a 300 pixels – then the columns are recalculated as follow: 1- column = 300(new width)/200(sum of all width)*80(column width) = 120 and 2 column = 300/200*120 = 180. In the next release I will add a method setWidth which will change the width of the grid dynamically.
- Automatic height resizing. This is done with a new option rowheight. This option defines the height of the single row (we must make some experiments here). If is set the height of the grid is changed according to the number of the returned rows from the server and the scroll bar does not appear. Important note here – if we want this to work we should not change the property overflow hidden and white-space nowrap in the CSS .
- In the xml and JSON data formats I add a new tag – records. In this tag we can put the total records from the query. To view the total records from the query in the pager bar we should set the new option viewrecords to true. By default this option is false for backward compatibility. There is another option related to this – recordtext. This displays a text after the viewed records. The default value is in English and is: Record(s).
- I add another option – imgpath. Whit this option we can define the path to the images that are used from the grid. Define this without a “/” at the end.