Den-dp / ui-grid-auto-fit-columns

The plugin ensures that the column width will be wide enough for showing the longest data of that column (or column name).
MIT License
12 stars 8 forks source link

Doesn't seem to work when the columns are dynamically generated. #43

Closed emanresuwenaretne closed 4 months ago

emanresuwenaretne commented 2 years ago

I seem to have an issue when the the columns are dynamically generated. How do I make it work when the grid columns are generated dynamically. Using the following code -

var s = data.Data_From_Datatbase[0]; var keys = []; for (var k in s) { $scope.My_UI_Grid.columnDefs.push({ field: k}); }

Den-dp commented 2 years ago

Check addColumn method and button in this demo https://jsbin.com/ralituxeku/1/edit?js,output

emanresuwenaretne commented 2 years ago

I am able to add the columns correctly. There is no issue with that.

But for grid with such columns, ui-grid-auto-fit-columns doesn't seem to work correctly. Can you please take a look?

Den-dp commented 2 years ago

@emanresuwenaretne please provide a minimal jsbin reproduction of the situation where this plugin doesn't seem to work correctly

emanresuwenaretne commented 2 years ago

1)Issue with the columns is fixed now. 2)But when I try to scroll to the right the header formatting seems to be lost. 3)What could be the reason for this distortion?

Den-dp commented 2 years ago

@emanresuwenaretne unfortunately I'm unable to reproduce your issue. Would you mind providing some jsbin example to look into? Thanks