Wednesday, November 30, 2011

A Bug in jQuery Grid Plugin

I want to call this a bug because, as the name implies, editoptions is optional. (That being said, this is a small bug in an excellent jQuery plugin.)

But without editoptions, a column with edittype="select" will be created in a formedit dialog without an id attribute, which results a data element missing when the form is submitted. Of course, this is only a problem when one wants to customize the form initialization — Most people probably do not use jqgrid that way.

The bug should be in the area between line number 548 and 564 in grid.formedit.js as of jQuery Grid plugin version 4.2.0. But I haven't had much time to understand exactly how that code section works.

A workaround seems to be always have an editoptions parameter for a select type column, as the example below shows:

     array('name' => "actid", 'index' => "actid", 'width' => 50, 'align' => "center",
           'editable' => true, 'edittype' => "select", 'editoptions' => array('value' => ";"))


That is data for a column in PHP from the drupal-nm project, with the workaround colored in red.

No comments:

Post a Comment