ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Update gridOptions

Open klemenoslaj opened this issue 12 years ago • 6 comments

Is it possible to update gridOptions object in real time? For an example, I change enable Sorting from true to false and nothing happens.

klemenoslaj avatar Jun 06 '14 12:06 klemenoslaj

You probably need to reassign the entire gridOptions object reference and not just an inner property.

On Fri, Jun 6, 2014 at 7:44 AM, klemenoslaj [email protected] wrote:

Is it possible to update gridOptions object in real time? For an example, I change enable Sorting from true to false and nothing happens.

— Reply to this email directly or view it on GitHub https://github.com/angular-ui/ng-grid/issues/1228.

c0bra avatar Jun 06 '14 13:06 c0bra

I tried this way also: http://plnkr.co/edit/FfnbLhgllUgysN8ZUJZP?p=preview

klemenoslaj avatar Jun 09 '14 10:06 klemenoslaj

You can set column options like this.

var cols = $scope.gridOptions.$gridScope.columns;
var col = cols[0];
col.sortable = true;
col.sortDirection = 'desc';
col.sort(); // if you want to sort this columns programatically
console.dir(col); // for more details...

junkoro avatar Jun 12 '14 05:06 junkoro

Thanks. For columns this solution is correct. But what about grouping and sorting functionality? For an example, when grid is displayed, there is no sorting and grouping enabled, but after some action user can enable it both. So how to achieve this?

klemenoslaj avatar Jun 12 '14 06:06 klemenoslaj

@klemenoslaj : there is an undocumented grid.refresh() that might permit this, but in general you wouldn't change the grid options after initial render. Is there a reason you can't just leave sorting and grouping enabled from the start?

PaulL1 avatar Sep 05 '14 12:09 PaulL1

More information requested on a relatively old issue, and no further comment for 2 weeks, assuming that issued is resolved.

PaulL1 avatar Sep 20 '14 23:09 PaulL1