Forum


22:37

03/12/2010

I'm fighting with unformat and I'm hoping someone can help. I have a column that I have added a custom formatter:
formatter:function(cellvalue, options, rowObject) {
return cellvalue + ' <em>(' + rowObject[2] + ')</em>';
}
I would like to strip off the <em> work that the formatter did prior to editing so I created an unformat function:
unformat:function(cellvalue, options) {
var re = new RegExp("\s*<em>.*?</em>","g");
return cellvalue.replace(re,'');
}
The problem I am running into is that for some reason, simply specifying "unformat" causes tags to be removed from the cell data. Example, the custom formatter receives the following: cellvalue="test", rowObject[2]="09/16/2011", return value = "test <em>(09/16/2011)</em>"
If I do not specify unformat, the edit text = "test <em>(09/16/2011)</em>" -- this is expected.
Ignoring my unformat above (because it is not working do to this strang behaviour) and simply defining unformat as:
unformat:function(cellvalue, options) {
return cellvalue;
}
the edit text = "test (09/16/2011)" -- ARGH! This is the same value that unformat is receiving -- thus why my regular expression stripping is not working.
Am I doing something wrong or have I found a bug?
Most Users Ever Online: 715
Currently Online:
54 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66