tags:

views:

93

answers:

1

Am having some behaviour I cannot understand why in my jqgrid.My Add , Edit and Delete buttons seem to have interchanged there respective urls.

$("#list").navGrid("#pager",                
    {add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Delete'},               
    {top:50,left:"100",width:500,url:'<?php echo $this->baseUrl() ?>/artist/add',closeAfterAdd:'true'},                                                       
    {top:50,left:"100",width:500,url:'<?php echo $this->baseUrl() ?>/artist/edit',closeAfterEdit:'true'},
    {url:'<?php echo $this->baseUrl() ?>/artist/delete',closeAfterAdd:'true'}
);

When I try Add from the interface firebug console shows that am actually Editing. When I try Edit from the interface firebug console shows that am actually Adding. Delete seems to be fine.

Are there defaults or something that am missing in my jqgrid?

+1  A: 

According to the jqGrid Documentation, the order of parameters is:

jQuery("#grid_id").jqGrid('navGrid','#gridpager',{parameters},
                           prmEdit, prmAdd, prmDel, prmSearch, prmView);

The problem with your code is that you are passing the Add and Edit parameters in the wrong order. You need to re-order them:


$("#list").navGrid("#pager",                
    {add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Delete'},
    {top:50,left:"100",width:500,url:'baseUrl() ?>/artist/edit',closeAfterEdit:'true'}, 
    {top:50,left:"100",width:500,url:'baseUrl() ?>/artist/add',closeAfterAdd:'true'},
    {url:'baseUrl() ?>/artist/delete',closeAfterAdd:'true'}
);

Justin Ethier