Hello,
I'm working with your igniteui-angular project and am having trouble with the angular controller style igGrid. Mainly is that the call to getData() function in my factory is asynchronous and so the grid is trying to initialize before the dataSource exists.
Here's what the getData() function looks like in my factory
schedulingApp.factory('shiftsFactory', function ($http, $q) {
var baseUrl = 'odata/ShopShifts'; var shiftsFactory = {};
shiftsFactory.getShifts = function (fabLocID) { var url = baseUrl + '?$filter=LocID eq \'' + fabLocID + '\''; return $http.get(url); }
...
return shiftsFactory;
});
I've found a crappy solution around this, but it comes back to haunt me when trying to add/update the dataSource. Is there maybe an example that exists of the proper way to do the angular controller style igGrid initialization when using an angular factory to get data?
Thanks,
Julie
Hello Sundeep,
The igHierarchicalGrid AngularJS directive doesn't support one or two-way data binding as you can see here: https://github.com/IgniteUI/igniteui-angular
What you can try to do as a workaround is to call igHierarchicalGrid.dataBind anytime you update the underlying data source. Please note that re-binding the igHierarchicalGrid will not save the expanded/collapsed state of the grid.
You can also log an issue on IgniteUI Angular GitHub page about this scenario.
Hope this helps,Martin PavlovInfragistics, Inc.
Is there any resolution for this? i'm using the same ig-hierarchical-grid directive with a promise but the data doesn't update.
The Master/Detail sample works when using an ig-grid directive, but not when using an ig-hierarchial-grid directive.
I need to use an ig-hierarchial-grid, is there any word on whether this is a bug or not?
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
Hello Julie,
Because the $http get returns a promise the easiest way to bind the grid is to use scope property and assign the result of the success callback from the request like in the Master-Detail sample. We might also look into the viability of handling promises though the directives automatically. Please provide your solution if possible. Thank you in advance!