Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Custom formatter sometimes receives HTMLTableRowElement rather than rowData object
Tags: formatter
25/11/2011
15:47
Avatar
tluck01
New York, NY
New Member
Members
Forum Posts: 1
Member Since:
25/11/2011
sp_UserOfflineSmall Offline

Hi,

I am using v4.2.0 and have discovered an issue with the column custom formatter function.  It appears that it can be called with two different parameter types for the rowObject param under different circumstances.  Here is the documentation link for the function: http://www.trirand.com/jqgridw....._formatter

The function is defined to conform to the following:

function myformatter ( cellvalue, options, rowObject )
{
// format the cellvalue to new format
return new_formated_cellvalue;
}

rowObject is supposed to be the data for the row, and when initally called always is. However, I am making the cell editable using using the select type in the colmodel definition like this:

                   { name: 'state',  

                    index: 'state', 

                    editable: true,  

                    edittype: 'select',  

                        editoptions : 

                        {

                        value : getSelectString()

                        },

                        formatter: function ( cellvalue, options, rowObject )

            {

return "new value";

            },

                    }, 

The problem happens if I do the following:

  1. Start to edit the cell which creates a select object in the cell.
  2. Hit "esc" to cancel the edit, making the select disappear.
  3. At this point the formatter is called with a HTMLTableRowElement  rather than a standard rowObject with the col values in it.  

The offending caller is in the "setCell" method at line 3117 in the jquery.jqGrid.src.js.  Specifically, these lines seem to be at fault:

var ind = $t.rows.namedItem(rowid);
if (ind){
var tcell = $("td:eq("+pos+")",ind);
if(nData !== "" || forceupd === true) {
v = $t.formatter(rowid, nData, pos,ind,'edit');

The "ind" variable is initialized as a HTMLTableRowElement (the result of the namedItem() call ), and will be sent as a param that be propagated through a few other methods and then passed to my formatter, which ultimately receives this HTMLTableRowElement rather than the proper rowData object.

The assumed proper behavior is what happens in "addCell" on line 977, where the formatter is called with the correct rowData object.

Thanks for any help.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
48 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information