Author Topic: Grid title display issue  (Read 3158 times)

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
Grid title display issue
« on: March 22, 2014, 08:19:24 pm »
Hi I'm using pro 2.0.4

I have an issue with grid - definition

 var colModel = [
                            { title: "ID", dataType: "string", width: "75", dataIndx: 0 },
                            { title: "Adults", dataType: "integer", width: "75", dataIndx: 1 },
                            { title: "Child", dataType: "integer", width: "75", dataIndx: 2 },
                            { title: "Infants", dataType: "integer", width: "75", dataIndx: 3 }
                            ];

                            var dataModel = {
                                cache: true,
                                location: "remote",
                                sortDir: "up",
                                sortIndx: 1,
                                sorting: "local",
                                dataType: "xml",
                                method: "POST",
                                getUrl: function () {
                                    return {
                                        url: "@Url.ModuleUrl().Action("AccessContractData")",
                                        data: { 'ContractCode': contractcode, 'id': "2" }
                                    };
                                },
                                getData: function (dataDoc) {
                                    //debugger;
                                    var obj = { itemParent: "Occupancy", itemNames: ["id", "adultsCount", "childrenCount", "infantCount"] };
                                    return { data: $.paramquery.xmlToArray(dataDoc, obj) };
                                }
                            };
                            var obj = {
                                width: 350, height: 0,
                                dataModel: dataModel,
                                colModel: colModel,
                                pageModel: { rPP: 10, type: "local", rPPOptions: [1, 2, 5, 10, 20, 100] },
                                title: "<b>Occupancy Set</b>",
                                flexHeight: true,
                                paging: true,
                                draggable: true,
                                editable: false,
                                //resizable:true,           
                                scrollModel: { horizontal: false },
                                showToolbar: false,
                                collapsible: true,
                                freezeCols: 0,

                            };

When grid is first displayed after a tab selection the titles do not display - see image attached, (files too large to send second image showing titles) after a collapse of the grid and un-collapse titles show correctly

Any ideas on how to fix

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Grid title display issue
« Reply #1 on: March 24, 2014, 07:37:27 am »
you have to call refresh on the grid whenever corresponding tab is displayed ( activate event of jQuerUI tab ).

http://api.jqueryui.com/1.9/tabs/#event-activate

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Grid title display issue
« Reply #2 on: March 25, 2014, 01:24:54 pm »
Thanks but I already do call refresh as below

                            //Fill Occupancy Grid
                            var $grido;

                            try {
                                $grido = $("#OccupancyGrid").pqGrid("destroy");
                            }
                            catch (err) {
                            }


                            var colModel = [
                            { title: "ID", dataType: "string", width: "75", dataIndx: 0 },
                            { title: "Adults", dataType: "integer", width: "75", dataIndx: 1 },
                            { title: "Child", dataType: "integer", width: "75", dataIndx: 2 },
                            { title: "Infants", dataType: "integer", width: "75", dataIndx: 3 }
                            ];

                            var dataModel = {
                                cache: true,
                                location: "remote",
                                sortDir: "up",
                                sortIndx: 1,
                                sorting: "local",
                                dataType: "xml",
                                method: "POST",
                                getUrl: function () {
                                    return {
                                        url: "@Url.ModuleUrl().Action("AccessContractData")",
                                        data: { 'ContractCode': contractcode, 'id': "2" }
                                    };
                                },
                                getData: function (dataDoc) {
                                    //debugger;
                                    var obj = { itemParent: "Occupancy", itemNames: ["id", "adultsCount", "childrenCount", "infantCount"] };
                                    return { data: $.paramquery.xmlToArray(dataDoc, obj) };
                                }
                            };
                            var obj = {
                                width: 350, height: 0,
                                dataModel: dataModel,
                                colModel: colModel,
                                pageModel: { rPP: 10, type: "local", rPPOptions: [1, 2, 5, 10, 20, 100] },
                                title: "<b>Occupancy Set</b>",
                                flexHeight: true,
                                paging: true,
                                draggable: true,
                                editable: false,
                                //resizable:true,           
                                scrollModel: { horizontal: false },
                                showToolbar: false,
                                collapsible: true,
                                freezeCols: 0,

                            };


                            $grido = $("#OccupancyGrid").pqGrid(obj);
                            $grido = $("#OccupancyGrid").pqGrid("refresh");

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Grid title display issue
« Reply #3 on: March 25, 2014, 01:28:33 pm »
Sorry - now fixed I was calling refresh before tab display not after