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
Question about "add row" with form edit and form validation
26/02/2009
07:28
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

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});
});

28/02/2009
14:43
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

06/03/2009
16:10
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

Hi Tony,

  Thanks for replying. I don't understand your first answer (Sorry!). Could you elaborate with a code sample or show me where in the docs this is specified?

thanks a lot.

marc

11/03/2009
02:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information