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
modal window pops up only once - exception unrecognized expression
20/02/2009
16:56
Avatar
jean
Member
Members
Forum Posts: 10
Member Since:
09/12/2008
sp_UserOfflineSmall Offline

Hi Tony,

I've jquery r1.3.2 and jqgrid 3.4.1 installed and when I edit the data with the modal window it pops up one time - then if I want to edit another row I get the following exception in firefox 3.0.6 (osx):

[Exception... "'Syntax error, unrecognized expression: ]' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "<unknown>"  data: no]

I realised it was due to I used a multiselect in jqgrid and the name of the field was name[] - due to a php backend and this was the source of the error. Below is a "nasty" diff to get rid of the square braktes [] for the id on the input in the modal window without altering the name attribute. It's a cimple regex to remove the square brakets.

==========

--- grid.formedit-old.js        2009-02-20 23:04:17.000000000 +0100
+++ grid.formedit.js    2009-02-20 23:05:14.000000000 +0100
@@ -425,6 +425,8 @@
                                var nm, hc,trdata, tdl, tde, cnt=0,tmp, dc,elc, retpos=[];
                                $('#'+rowid+' td',obj.grid.bDiv).each( function(i) {
                                        nm = obj.p.colModel[i].name;
+                                       nmid = nm.match(/(\\w*)/i);
+                                       nmid = nmid[0];
                                        // hidden fields are included in the form
                                        if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden == true) {
                                                hc = false;
@@ -442,7 +444,7 @@
                                                                tmp = $.htmlDecode($(this).html());
                                                        }
                                                }
-                                               var opt = $.extend(obj.p.colModel[i].editoptions || {} ,{id:nm,name:nm});
+                                               var opt = $.extend(obj.p.colModel[i].editoptions || {} ,{id:nmid,name:nm});
                                                if(!obj.p.colModel[i].edittype) obj.p.colModel[i].edittype = "text";
                                                elc = createEl(obj.p.colModel[i].edittype,opt,tmp);
                                                $(elc).addClass("FormElement");
@@ -469,7 +471,8 @@
                        function fillData(rowid,obj){
                                var nm, hc,cnt=0,tmp;
                                $('#'+rowid+' td',obj.grid.bDiv).each( function(i) {
-                                       nm = obj.p.colModel[i].name;
+                                       nm = obj.p.colModel[i].name.match(/(\\w*)/i);
+                                       nm = nm[0];
                                        // hidden fields are included in the form
                                        if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) {
                                                hc = false;

========

Furthermore I had a scrollbar in the modalwindow and I got rid of it by changing grid.css to:

.modalcontent {
    margin-bottom: 9px;
    margin-left: 5px;
    width: 97%;
}

Take care, jean

24/02/2009
07:17
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for this. Yes this is true, but the same thing should be added in inline  and cell editing modules. The same apply when we have name.someothername - also a good approach is to use common regExp for this purpose. Will see what I can do for this purpose.

Thank you

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.

28/02/2009
08:13
Avatar
jean
Member
Members
Forum Posts: 10
Member Since:
09/12/2008
sp_UserOfflineSmall Offline

Hi Tony,

What's your oppinion on:

nmid = nm.match(/(\\w*)/i);
nmid = nmid.join('');

Cheers

Jean

28/02/2009
13:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks. I will do more for this in the next release not in 3.4.2

Regards

Tony

P.S. I realized that there is a more elegant solution, but it should be tested.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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