Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MK

Pages: [1]
1
Help for ParamQuery Grid (free version) / Re: Use JSON to define colModel
« on: October 22, 2014, 09:17:02 pm »
Thanks for looking into this.
I checked the dpendency files and they seem all ok.
Also  found "$.ajax ({ " is somehow not working ok. I replaced this with Jquery  "$.getJSON('ttlookupcol.json'," and then it draws the grid(need this in a popup) and also populates ok.
$(function () {

    /*Display gridObjectInPopup when lookup button clicked*/
    $("#showlookup").click(function (evt) {
        $.getJSON('ttlookupcol.json',

        function (gridJSON) {
            gridObject = {
                width: 640,
                height: 400,
                selectionModel: { type: 'cell'},
                colModel: gridJSON.columns,
                dataModel: {
                    data: gridJSON.data
                }
            };
            gridObject.cellSelect = function (evt, obj) {
                var dataCell = obj.data[obj.rowIndx][obj.dataIndx];
            $("#clientcode").attr('value', dataCell);
                $("#pq-grid-in-popup-dialog").dialog('close');
            };

            //$("#pq-grid-in-popup-dialog").dialog('destroy');
            $("#pq-grid-in-popup-dialog").dialog({
                height: 300,
                width: 500,
                create: function (evt, ui) {
                    //$(this).detach().appendTo($("#pq-dialog-cont"));
                },
                open: function (evt, ui) {
                    var $grid = $("#grid_in_popup_grid");
                    var ht = $grid.parent().height() - 2;
                    var wd = $grid.parent().width() - 2;
                    //alert("ht=" + ht + ", wd=" + wd);
                    if ($grid.hasClass('pq-grid')) {
                        $grid.pqGrid("option", {
                            height: ht,
                            width: wd
                        });
                    } else {
                        gridObject.width = wd;
                        gridObject.height = ht;
                        $grid.pqGrid(gridObject);
                    }
                    //refresh the selections made before closing grid if any.
                    //$grid.pqGrid("selection", { type: 'cell', method: 'refresh' });
                },
                close: function () {
                    var $grid = $("#grid_in_popup_grid");
                    $grid.pqGrid('destroy');
                },
                resizeStop: function (evt, ui) {
                    var $grid = $("#grid_in_popup_grid");
                    var ht = $grid.parent().height();
                    var wd = $grid.parent().width();
                    $grid.pqGrid("option", {
                        height: ht - 2,
                        width: wd - 2
                    });
                },
                show: {
                    effect: "blind",
                    duration: 500
                },
                hide: {
                    effect: "explode",
                    duration: 500
                }
            }); /*$("#pq-grid-in-popup-dialog").dialog({*/
        });
        /********************/

    });
});


However I am now facing another problem.
I need this functionality to support Remote data(json) plus remote sorting plus rempote paging. I tried the remote sorting demo example; and function geturl does'nt bring anything back. I am fetching same json file as I have fetched with "$.getJSON('ttlookupcol.json',";  and thus assume that location is ok. Or otherwise, how do I enable remote sorting by using the same code as above?

Could somebody please help me this;

2
Help for ParamQuery Grid (free version) / Re: Use JSON to define colModel
« on: October 21, 2014, 10:12:31 pm »
Hello Team,
Its really helpful tool.

I also need something similar i.e fetching json from remote and using this to build grid and use this to populate data.
I tried the same code as suggested here in this thread; however its not working for me. Is there anything I am missing or doing terribly wrong? Neither it draws the grid, nor does it populate.

$(function() {
    var gridObject = {};
    var buildGrid = function(gridJSON) {
    /*alert("buildGrid");
    alert(JSON.stringify(gridJSON));
    alert(gridJSON.columns);
    */
        gridObject = {
            width: 640,
            height: 400,
            colModel: gridJSON.columns,
            dataModel: {data: gridJSON.data}
        };
        //alert(JSON.stringify(gridObject));         
   };
    $.ajax ({
        url: 'ttlookupcol.json',
      datatype: 'json',
      success: buildGrid
    });   

    $("#grid-json").pqGrid(gridObject);
});


my json file i am using is:
{
    "columns": [
        {"title": "CODE", "width": 100, "dataType":"string", "dataIndx":"CODE", editable: false},
        {"title": "DESCRIPTION", "width": 50, "dataType":"string", "dataIndx":"DESCRIPTION", editable: false}       
    ],
    "data": [
        {CODE: "GROSC", DESCRIPTION: "Client Chain (UK) Ltd"},
   {CODE: "GROST000", DESCRIPTION: "GROSProperties (UK)"},
   {CODE: "GROST001", DESCRIPTION: "GROS Property Two UK Ltd"},
   {CODE: "GROST002", DESCRIPTION: "GROS Properties Ltd 2"},
        {CODE: "GROST003", DESCRIPTION: "GROS Stow Limited"}
        ]
}

Please help me with this.

Pages: [1]