devginie / angular-jqgrid

Directive module for free-jqgrid 4.13.0
MIT License
5 stars 5 forks source link

Not displaying grid at all #1

Open soyiatgit opened 7 years ago

soyiatgit commented 7 years ago

I downloaded the directive and tried using it as it is. To my surprise, it didn't render grid at all. I debugged and found that, there was some issue with the onDataSetChanged method. The grid initially renders but is destroyed within this method. It seems like the dataset passed from html is set to empty array here. I have not worked with jqGrid earlier, hence I do not have much knowledge of various events.

However, I would like author to revisit the code and see what the exact issue is.

sax1johno commented 6 years ago

The issue appears to be in the code that handles the tree grid - it's calling "clearGridData" to clear the table, but since a reference to the data is being passed around, it's actually clearing out the scope variable as well.

I've attached a pull request that fixes this issue mostly by removing that section of code (and improves the dataset watcher by using $scope.$watchCollection) - if it doesn't get accepted, check out the working version in my fork of this repo.