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_TopicIcon
Custom cell editor
06/08/2009
19:24
Avatar
descsuit
Member
Members
Forum Posts: 16
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

I'm looking to make a custom cell editor.  My first inclination was to step in with an afterEditCell callback and overwrite the input element that had been created.  This doesn't work as far as I can tell because the input element is not in the DOM at that point.. anything I write into that cell will get overwritten with the input tag apparently after this callback is through..  I tried to log to the firebug console the contents of the cell and there's no input tag when logged at the beginning of the call back..

Am I right in thinking that is how it happens? and is there a better callback or a different way of approaching this that I'm missing?

If you are curious, I need an HTML editor in there with support for some character based tags (like strong, em, subscript, superscript)..

DescSuit

07/08/2009
00:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You want to overwrite the input element with what?

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

07/08/2009
03:12
Avatar
descsuit
Member
Members
Forum Posts: 16
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

A configurable HTML editor, like TinyMCE or FCKEdit or maybe something simpler as long as I can configure it to have those character tags I need (em, strong, sub/superscript, maybe a few others).

Alan

07/08/2009
03:37
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Maybe (never try) you will need to set edittype:'textarea' and the use dataInit event (see docs) to attach the editor to this field.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

07/08/2009
17:09
Avatar
descsuit
Member
Members
Forum Posts: 16
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

As I see it the dataInit function passes you the element but it isn't in context.. therefore you can edit the element (change attributes of the element, callbacks, etc.. of in this case the textarea) but you can't change what the element is.  If it was a container element I could change what it contained.. or if there was a place to put other content that wasn't overwritten with by the element I could still insert something and hide the text area.. but there isn't.

So I don't see how to solve this short of adding my own edittype.  Which seems a little scary, but might be doable.  It'd be nicer if there was some kind of extension point there.. but as it is I'll have to have a custom version of the grid javascript.

I figure I'll have to add cases to: createEl, saveRow, editCell, saveCell (for some reason editRow doesn't seem to mention textareas at all.. hrmm..

The only alternative I can think of is if there is a callback that occurs after the editing element is put in place.. but I haven't found one.

Alan

10/08/2009
05:36
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

afterEditCell is a event which is called after the element is created and inserted into the grid.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

10/08/2009
13:59
Avatar
descsuit
Member
Members
Forum Posts: 16
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

I know afterCellEdit is supposed to be after the tag is in place, but when I print the html of the cell during the callback it shows no textarea.. just what was there to start.  jQuery wouldn't find the textarea... etc...

When I've tried to write my own content in there during the afterCelEdit, it gets overwritten by the textarea tag.

Is the textarea special?

Alan

13/08/2009
01:41
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

If you print the html using jQuery html you will have in all cases the content and not the element.

You should make difference between the html and the element.

I think that this is possible - just try to attach the editor to the element (not to the html) and you will see the result.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

13/08/2009
12:18
Avatar
descsuit
Member
Members
Forum Posts: 16
Member Since:
27/07/2009
sp_UserOfflineSmall Offline

The problem is the HTML editors wrap the textarea element.. so if I'm given a textarea as the element argument, I can't replace it with the wrapping.  It doesn't add to or modify the element, it replaces it.. (with a div and other such).  I haven't found a htmlarea that doesn't work that way.

Alan

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
85 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