Author Topic: Why grid not dispay data when I try to set data by dataModel.data, please help.  (Read 4370 times)

Iris

  • Newbie
  • *
  • Posts: 4
    • View Profile
Use Demos-Basics-Json data.

1.Remove data: data from  obj.dataModel
2. Add this to the end of code: $grid.pqGrid("option", "dataModel.data", data);

It didn't work, just shows 'No rows to display', please advise me, thanks in advance.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
The grid needs to be refreshed after setting data.

http://paramquery.com/pro/tutorial#topic-refreshView

Iris

  • Newbie
  • *
  • Posts: 4
    • View Profile
Many thanks! I'll have a try.

The grid needs to be refreshed after setting data.

http://paramquery.com/pro/tutorial#topic-refreshView

Iris

  • Newbie
  • *
  • Posts: 4
    • View Profile
Thank you very much :), I add below code to the end, and it worked, so happy, thanks for helping.
$grid.pqGrid( "refreshDataAndView" );

arup_2016

  • Newbie
  • *
  • Posts: 4
    • View Profile
Showing message No Rows to Display when grid is hide then populate gird
« Reply #4 on: August 18, 2016, 05:01:13 pm »
Hi
      I am using angularjs PQ grid for displaying data. PQ grid is hide initially by ng-show as follow.. after some ajax request it show the div
   but grid showing no record. if i click sorting or maximize then it show all record. pls help anybody

   <div id="divStep2" ng-show="vm.GridDisplay">                                                 
                   <pq-grid  options="vm.gridOptions" style="margin:auto;"></pq-grid>                 
                                                         
                    </div>


  $http.post(varURL + 'Service.svc/reQList', TracesLogin).success(function (data) {

   if (data.RequestDownloadListResult.Response == "0") {               
             
                vm.LoginDisplay = false;
                vm.GridDisplay = true;
                vm.Cookies = data.RequestDownloadListResult.Cookies;
                var jsonData = JSON.parse(data.RequestDownloadListResult.ResponseData);
               
                vm.myData = jsonData.rows;
               
               
            } else {
                vm.RefreshCaptcha();
                vm.CaptchaCode = '';
                alert(data.RequestDownloadListResult.Message);

            }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Please try this:

vm.myData = jsonData.rows;

//add this
$timeout(function(){
  vm.gridOptions.grid.refresh();
});
« Last Edit: August 18, 2016, 06:09:46 pm by paramquery »

arup_2016

  • Newbie
  • *
  • Posts: 4
    • View Profile
thanks very much it works