1

I am working in ajax i want to achieve two Json object data into one single JqxGrid.I can display two function data in separate grid,Can any body help how to achieve this in single grid?Is there any way to achieve this? My function is like this

function functionname1(x, y) {
    $.ajax({
        type: "POST",
        url: "test.asmx/functionname1",
        data: "{'xx':'" + x + "','yy':" + y + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnSuccess

    });

    function OnSuccess(data, status) {
        var pointfeatures = [];
        var obj = JSON.parse(data.d);

        var source = {
            datatype: "json",
            datafields: [
                { name: 'field1' },
                { name: 'field2' }
            ],
            localdata: obj
        };
        var dataAdapter = new $.jqx.dataAdapter(source);
        $("#jqgrid").jqxGrid(
            {
                pagesize: 10,
                source: dataAdapter,
                width: 600,
                autoheight: true,
                columnsresize: true,
                columns: [

                              { text: '<b style="color:black;font-size:15px">fieldname</b>', datafield: 'field1', width: 'auto' },
                              { text: '<b style="color:black;font-size:15px">fieldname2</b>', datafield: 'field2', width: 'auto' }




                ]
            });

        var themesetting = { theme: 'darkblue' };
        $("#jqgrid").jqxGrid(themesetting);



}

one more function is

function functionname2(x, y) {
    $.ajax({
        type: "POST",
        url: "test.asmx/functionname2",
        data: "{'xx':'" + x + "','yy':" + y + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnSuccess

    });

    function OnSuccess(data, status) {
        var pointfeatures = [];
        var obj = JSON.parse(data.d);

        var source = {
            datatype: "json",
            datafields: [
                { name: 'field1' },
                { name: 'field2' }
            ],
            localdata: obj
        };
        var dataAdapter = new $.jqx.dataAdapter(source);
        $("#jqgrid").jqxGrid(
            {
                pagesize: 10,
                source: dataAdapter,
                width: 600,
                autoheight: true,
                columnsresize: true,
                columns: [

                              { text: '<b style="color:black;font-size:15px">fieldname</b>', datafield: 'field1', width: 'auto' },
                              { text: '<b style="color:black;font-size:15px">fieldname2</b>', datafield: 'field2', width: 'auto' }




                ]
            });

        var themesetting = { theme: 'darkblue' };
        $("#jqgrid").jqxGrid(themesetting);



}
indu
  • 43
  • 11

0 Answers0