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
Disabled dynamic combo doesn't work for first time edit mode.
06/11/2009
08:50
Avatar
jamie
Member
Members
Forum Posts: 5
Member Since:
06/11/2009
sp_UserOfflineSmall Offline

Dear All,

I create dynamic combo in modal editform using the editOptions:dataUrl, I want this combo is disabled (can't be changed) in edit mode.

But I found a problem, the disabled doesn't work for first edit but it works for second edit, or after we klik add.

Here's the script : 

// script for create object

{name:'id',index:'id', width:150, editable:true,formoptions:{ rowpos:1, elmprefix:"(*)"},edittype:"select",editoptions:{dataUrl:'?c=webredirection&m=getPackageID'}},

//script for add button

$("#addWRbtn").click(function(){

jQuery("#webRedr").editGridRow("new",{height:350,width:400,reloadAfterSubmit:false,closeOnEscape:true,bottominfo:" Fields marked with (*) are required", closeAfterAdd: true,

beforeShowForm : function(formid) {

  jQuery("#id",formid).removeAttr("disabled");

} });

});

//script for edit button

$("#editWRbtn").click(function(){

var gr = jQuery("#webRedr").getGridParam('selrow');

if( gr != null ) jQuery("#webRedr").editGridRow(gr,{height:350,width:400,reloadAfterSubmit:false,closeOnEscape:true,bottominfo:"Fields marked with (*) are required", closeAfterAdd: true,

   beforeShowForm : function(formid) {

     jQuery("#id",formid).attr('disabled','disabled');

  }

});

I tried to use the readonly attribute instead disabled, but it seems the readonly can't use for select (drop down) object.

Please help me.

Thanks.

-Jamie-

06/11/2009
09:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I think this is not a bug, bu rather it caused from the ajax response – it is delayed and so it is quite possible that one it is enabled, but in other cases not. I recommend you to use the setTimeout function applied to the

jQuery(”#id”,formid).attr('disabled','disabled');

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.

06/11/2009
10:27
Avatar
jamie
Member
Members
Forum Posts: 5
Member Since:
06/11/2009
sp_UserOfflineSmall Offline

Hello Tony,

Thanks for your suggestion, but it still doesn't work.

Here's  what I do :

 beforeShowForm : function(formid) {

         setTimeout( jQuery(”#id”,formid).attr('disabled','disabled'),'2000');

  }

The weird thing is, when you click edit button for the first time, the disabled doesn't work, but when you click edit for the second time and so forth it's works.

So I think isn't related to ajax response, because the problem should occur every time I click edit if it is caused by ajax response because every click do the same ajax process.

Please help me solve this problem.

Thanks a lot Tony.

06/11/2009
22:25
Avatar
jamie
Member
Members
Forum Posts: 5
Member Since:
06/11/2009
sp_UserOfflineSmall Offline

Hi Tony,

I have found a tricky way to solve this problem, hope this can helps if others face the same problem.

Here's the Idea, click edit or add button when the document ready using jquery and close the modalForm, so we don't allowed user click for the 1st time, since it has been done by script. Below is the scripts :

$(document).ready(function(){

    $('#addWRbtn').click();

    $('.ui-jqdialog-titlebar-close').click();

});

Hope This helps.

09/11/2009
09:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Could you please try with 3.6 version of jqGrid

Thanks

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.

18/01/2010
21:20
Avatar
Brian
Guest
Guests

Is dataUrl called after beforeShowForm? If so, can you please reverse the order?

The same problem occurs with 3.6.2. The first edit form appears enabled for edittype select.

              $(”#symbols_list”).navGrid('#symbols_pager',{refresh: true, edit: true, add: true, del: true, search: false},
                { // edit options
                  beforeShowForm: function(formid) {
                    $('#source',formid).attr('disabled',true);
                  }
                },
                { // add options
                  beforeShowForm: function(formid) { 
                    $('#source',formid).removeAttr('disabled');
                  }
                } 
              );

Thanks,

Brian

18/01/2010
22:02
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The second parameter of setTimeout is integer and not a string. For me the code work like this:

beforeShowForm : function(formid) {

setTimeout( jQuery(”#id”,formid).attr('disabled','disabled'), 200);

}

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.

18/01/2010
22:38
Avatar
Brian
Guest
Guests

Hi Tony,

Your answer to [Image Can Not Be Found] Forums [Image Can Not Be Found] Help [Image Can Not Be Found] formatter:’select’  is also a good here. Just call the php to obtain the value and then create the grid.

Thanks,

Brian

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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