Forum
08:50
06/11/2009
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-
09:44
Moderators
30/10/2007
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.
10:27
06/11/2009
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.
22:25
06/11/2009
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:09
Moderators
30/10/2007
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.
21:20
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
22:02
Moderators
30/10/2007
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.
22:38
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
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66