Forum


07:28

08/10/2008

Greetings all. I've got an editable form, and I'm using the "add" button that comes by default in the pager. I know I'm missing something stupid, but I can't figure out how to customize the size of the "add" form when it pops up. The "edit" form is sized correctly from the options I pass in editGridRow. (I'll post all my code below).
Another question: is basic form validation baked into the form editing? for example, I just want to mark some fields as required. I tried using required:true in my colModel, but that appeared to have no effect.
Finally, is there a way to provide default values for form fields when "add row" is clicked and the new form pops up?
thanks!
Marc
$(document).ready(function(){
$("#qGrid").jqGrid(
{
url:'blahblahblah',
datatype:'json',
colNames:['ID', 'Name', 'Set up?','Standard?', 'Dev Root', 'Test Root', 'Prod Compare Root', 'Filter'],
colModel:[
{name:'deploymenttypeid',index:'deploymenttypeid',width:30,hidden:true},
{name:'deploymenttypename',index:'deploymenttypename',editable:true,edittype:'text',width:180},
{name:'isconfigured',index:'isconfigured',editable:false,width:50,formatter:notConfiguredFormatter},
{name:'isstandard',index:'isstandard',editable:false,width:75, formatter:yesNoFormatter},
{name:'devroot',index:'devroot',editable:true,edittype:'text',width:200,formatter:devRootFormatter},
{name:'testroot',index:'testroot',editable:true,edittype:'text',width:200,formatter:testRootFormatter},
{name:'prodcompareroot',index:'prodcompareroot',editable:true,edittype:'text',width:200,formatter:prodCompareRootFormatter},
{name:'excludesfilter',index:'excludesfilter',editable:true,edittype:'text',width:150}
],
ondblClickRow: function(id){
var gr = $("##qGrid").getGridParam('selrow');
if(gr!=null){
$("#qGrid").editGridRow(gr,{height:300,width:600,closeAfterAdd:true,closeAfterEdit:true,recreateForm:true});
}
},
afterInsertRow: function(rowid,rowdata,rowelem){rowComplete(rowid,rowdata,rowelem)},
height:'100%',
pager: $("#pager"),
viewrecords:true,
caption:'Edit Deployments',
imgpath:'#application.webroot#scripts/jquery/plugins/jqGrid/themes/basic/images',
editurl:'blahblah'
}
);
$("##qGrid").navGrid("##pager",{refresh:true,edit:false,add:true,del:true,search:false});
});
14:43

Moderators
30/10/2007

Hello,
1. You shouls set the width and height in both edit and add options instead that they use the same method.
2. This is done in editrules array in colModel - refer to docs.
3. No special option, but you can use beforeShowForm event for this purpose.
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.
02:44

Moderators
30/10/2007

Hello,
...navGrid('#pager', {refresh:true,edit:false,add:true,del:true,search:false}.
{}, // edit options
{height:300,width:600} // add optins
...
);
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.
Most Users Ever Online: 715
Currently Online:
43 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