New Page in jqgrid

0

Good morning, it's a pleasure to say hello, I'm using Jqgrid to simulate an Access grid, I load it via ajax and everything right for now, my problem arises is when I need to implement the new page button that is in access I show it in the Next image, I mean I currently have the navigation buttons that the Jqgrid has,  and it moves between records via ajax, but I have no idea how to implement the new registration button.

Thanks in advance for your help

    
asked by Roberto Fernandez 18.10.2017 в 17:52
source

1 answer

0

As something similar to that in jqgrid I can not find it add a button, when clicking I generate a new record and I request the last page and in the response of the ajax I make a trigger towards the last generated new page.

example:

 jQuery("#jqgrid").jqGrid('navButtonAdd',"#pjqgrid",
                { caption:"", 
                buttonicon:"ui-icon-newwin", 
                onClickButton:new_presupuesto, 
                position: "last", 
                title:"Nuevo Presupuesto", 
                cursor: "pointer"});
    $('.navtable .ui-pg-button').tooltip({
        container : 'body'
    });


function new_presupuesto(){

    $.post("tu url aqui",{
        op:14
    },function(data){
        var resp = eval(data);
        if(resp){
            var s_presupuesto=  parseInt($("#sp_1_pjqgrid").text())+1;
            var grid = $("#jqgrid");
            grid.setGridParam({
                page: s_presupuesto
            });
            grid.trigger("reloadGrid");
        }
        else{
            console.log("respuesta "+data);
        }
    });

}
    
answered by 10.12.2017 в 01:01