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
add / edit records
22/06/2009
15:10
Avatar
andthereitgoes
Member
Members
Forum Posts: 18
Member Since:
19/05/2009
sp_UserOfflineSmall Offline

i am using add and edit options.

when i load the grid first time and click on Add ( to add a new record ) the form appears with empty fields ( as expected )

Then i select a row and click edit. The form appears with appropriate fields populated ( as expected )

But after this, when i click on Add ( to add new record ) the form doesnt get reset and appears with previous values still populated in the form fields.

Any ideas?

23/06/2009
03:16
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Which version. Can you provide a link to the problem?

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.

01/07/2009
17:56
Avatar
andthereitgoes
Member
Members
Forum Posts: 18
Member Since:
19/05/2009
sp_UserOfflineSmall Offline

using 3.5 beta. unfortunately cant post a link; but heres the sample JSON data

{"page":"1","total":275,"records":"137","rows":[{"id":"1283","cell":["1283","2009-10-31 00:00:00","payment","250.98","payment","out","BUCURR"]},{"id":"1123","cell":["1123","2009-03-17 00:00:00","ticket","33.00","ticket","out","BCC"]},{"id":"1119","cell":["1119","2009-03-17 00:00:00","Lunch","4.65","Lunch","out","CASH"]},{"id":"1120","cell":["1120","2009-03-17 00:00:00","food","3.75","food","out","MCC"]},{"id":"1121","cell":["1121","2009-03-17 00:00:00","gas","20.00","gas","out","MCC"]}]}

heres the javascript for the data.

jQuery("#listtrns").jqGrid({
    loadui:'block',
    height:690,
       url:'trn.php?q=1',
       colNames:['Id','Date', 'Trn', 'Amount','Tags','Type', 'Code'],
       colModel:[
           {name:'t.id',index:'t.id', width:50, editable:false, editoptions:{readonly:true,size:10}},
           {name:'t.trnDate',index:'t.trnDate', width:130, formatter:'date', editable:true,
            searchoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});}},
            editoptions:{size:12, dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});}} },
           {name:'t.trn',index:'t.trn', width:190, editable:true,editoptions:{size:30} },
        {name:'t.amount',index:'t.amount', width:80, formatter:'currency', editable:true, editoptions:{size:10}},
        {name:'t.tags',index:'t.tags', width:180, sortable: false, editable:true, edittype:"textarea", editoptions:{rows:"2",cols:"30"}},
        {name:'t.type',index:'t.type', width:80, editable:true, edittype:"select",editoptions:{value:"OUT:OUT;IN:IN"}},
        {name:'b.accountCode',index:'b.accountCode', width:80, searchable:false, editable:false,
         edittype:"select",
         editoptions:{value:{5:"Cash",
                              1:"Current",
                              2:"Saving",
                             3:"CRD",
                             4:"NRO"}}}
       ],
       pager: jQuery('#pagertrns'),
       sortname: 't.trnDate',
    sortorder: "desc",
    editurl:"trn.php?q=2",
    caption: "trns"
});
jQuery("#listtrns").navGrid("#pagertrns",
        {edit: true, add: true, del: true,search:true,refresh:true},
        {height:280,reloadAfterSubmit:false}, // edit options
        {height:280,reloadAfterSubmit:false}, // add options
        {height:280,reloadAfterSubmit:false}, //del options
        {multipleSearch:true});

PS: i am also setting jgrid.defaults hence some of the setting are missing in the code above

02/07/2009
03:54
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks. I see where is the problem - in the definition of the name property.

Actually it is a bug. Permanently you should use non doted name i.e replace

name:'t.id' with name:'id' - do this for all fields

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/07/2009
14:18
Avatar
andthereitgoes
Member
Members
Forum Posts: 18
Member Since:
19/05/2009
sp_UserOfflineSmall Offline

i also have another problem. if you see the code above for trnDate i use dataInit function to initialize a dateficker for the add/edit form.

the problem is now when i open the form the datepicker initializes automatically and opens up ( i think its to do with the field receiving focus )

another problem is, when i load the grid for the first time, the 'add form opens automatically by default without hitting add button in the navigator.

heres what i am doing to add a new row using editorGrid()

jQuery(”#listtrns”).jqGrid({
    loadui:'block',
    height:690,
       url:'trn.php?q=1',
       colNames:['Id','Date', 'Trn', 'Amount','Tags','Type', 'Code'],
       colModel:[
           {name:'t.id',index:'t.id', width:50, editable:false, editoptions:{readonly:true,size:10}},
           {name:'t.trnDate',index:'t.trnDate', width:130, formatter:'date', editable:true,
            searchoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});}},
            editoptions:{size:12, dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});}} },
           {name:'t.trn',index:'t.trn', width:190, editable:true,editoptions:{size:30} },
        {name:'t.amount',index:'t.amount', width:80, formatter:'currency', editable:true, editoptions:{size:10}},
        {name:'t.tags',index:'t.tags', width:180, sortable: false, editable:true, edittype:"textarea", editoptions:{rows:"2",cols:"30"}},
        {name:'t.type',index:'t.type', width:80, editable:true, edittype:"select",editoptions:{value:"OUT:OUT;IN:IN"}},
        {name:'b.accountCode',index:'b.accountCode', width:80, searchable:false, editable:false,
         edittype:"select",
         editoptions:{value:{5:"Cash",
                              1:"Current",
                              2:"Saving",
                             3:"CRD",
                             4:"NRO"}}}
       ],
       pager: jQuery('#pagertrns'),
       sortname: 't.trnDate',
    sortorder: “desc”,
    editurl:”trn.php?q=2″,
    caption: “trns”
});

//think the problem is here.
jQuery(”#listTransactions”).editGridRow(”new”);    jQuery(”#listtrns”).navGrid(”#pagertrns”,
        {edit: true, add: true, del: true,search:true,refresh:true},
        {height:280,reloadAfterSubmit:false}, // edit options
        {height:280,reloadAfterSubmit:false}, // add options
        {height:280,reloadAfterSubmit:false}, //del options
        {multipleSearch:true})

i will try using without the doted notation, but then that would give a problem in a complex query where i join 2 or more tables, isnt it?

08/07/2009
05:25
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Be a sure that the css file is loaded. Also if you use css from css directory you need to load the css for the serchFilter too.

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.

11/07/2009
02:12
Avatar
andthereitgoes
Member
Members
Forum Posts: 18
Member Since:
19/05/2009
sp_UserOfflineSmall Offline

where do i find the css for searchFilter?

i am using ui.jqgrid.css in theme folder with redmond theme

17/09/2009
17:05
Avatar
Pilot
Guest
Guests
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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