Updates to jQuery Field & Calculations Plug-ins

Posted by Dan on Feb 25, 2008 @ 8:16 AM

Over the weekend I made a few changes to my Field & Calculations plug-ins. One big change is I moved the plug-ins to the jQuery SVN repository. This should help people to find the plug-ins and will provide an easy way to stay on top of the changes.

The biggest overall change to the Field Plug-in is the addition of callbacks to the a few of the methods, especially the createCheckboxRange. This allows you to do something like change the background color of the checkbox's row. I also added a default setting (checkboxRangeKeyBinding) which allows you to configure which keyboard event triggers the range selection. This still defaults to the [SHIFT] key, but I can see where you might want to change this binding in certain situations.

The changes I made to the Calculation Plug-in should make it even easier to implement. I altered the sum() and avg() methods so that you can now create bindings to easily update the page. Previously, the methods only performed the calculations, so you had to write your own binding calls. Now if you want to update the element #totalSum whenever the user changes a value in a field beginning with the keyword "sum", you can do: $("input[@name^=sum]").sum("keyup", "#totalSum");

Here's a list of the changes that I've made in the past few days:

Field Plug-in

  • Moved source code to jQuery SVN repository: http://jqueryjs.googlecode.com/svn/trunk/plugins/field/
  • Changed the limitSelection() function to use an options argument, instead of all the individual arguments
  • Optimized the createCheckboxRange to reduced complexity and code size. Functionality has not changed.
  • createCheckboxRange() no longer breaks the chain
  • Added callback to autoAdvance() method
  • Added callback to createCheckboxRange() method
  • Added configurable setting for the [SHIFT] key bind to the createCheckboxRange()
  • Added the $.Field.setProperty() and getProperty() methods
  • Fixed "bug in checkbox range" (http://plugins.jquery.com/node/1642)
  • Fixed "Bug when setting value on a select element and the select is empty" (http://plugins.jquery.com/node/1281)

Calculation Plug-in

  • Moved source code to jQuery SVN repository: http://jqueryjs.googlecode.com/svn/trunk/plugins/calculation/
  • Fixed bug in sMethod in calc() (was using getValue, should have been setValue)
  • Added arguments for sum() to allow auto-binding with callbacks
  • Added arguments for avg() to allow auto-binding with callbacks
Categories: jQuery

Comments for this entry have been disabled.