charlespockert / aurelia-bs-grid

Aurelia and Bootstrap powered datagrid control
MIT License
45 stars 21 forks source link

Auto Generate Columns - not working #78

Open FourieDeWet opened 8 years ago

FourieDeWet commented 8 years ago

Hi Charles

I need to be able to generate the grid's columns from my data source (dynamic properties) but I cannot get the auto-generate-columns to work auto-generate-columns="true.

My simple grid looks like this: `

`

The returned data: getContacts(gridOptions) { return new Promise((resolve, reject) => resolve({ data: [ { "id": 1, "name": "my name", "email": "myemail@m.com" }, { "id": 2, "name": "my second name", "email": "mysecondemail@m.com" }, ], count: 2 }));

If I manually add a column in the grid that row and column loads with data, but how to get the rest of the columns to autogenerate?

Thank you

charlespockert commented 8 years ago

You need to use .bind to pass a true value to a bindable property, otherwise it just gets the string value.

To be honest I should probably just be checking for truthyness but try auto-generate-columns.bind="true" and see if that works for you

FourieDeWet commented 8 years ago

Thanks Charles for the quick response, but that did not do the trick. No errors, it is just not generating the columns and rows for that matter.

I have made a bindable property as well passing in boolean value, no luck.

What else can I check for?

Thanks

On Wed, May 18, 2016 at 5:44 PM, Charles Pockert notifications@github.com wrote:

You need to use .bind to pass a true value to a bindable property, otherwise it just gets the string value.

To be honest I should probably just be checking for truthyness but try auto-generate-columns.bind="true" and see if that works for you

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/charlespockert/aurelia-bs-grid/issues/78#issuecomment-220068701

charlespockert commented 8 years ago

Er, I just checked the source and I never implemented this feature! Oops!

Shouldn't be too hard to add ... just need to inspect the datasource when it is bound provided and generate a column for each property

If you need a more functional alternative to this grid (since it's just mostly a tech demo) there are a couple of other projects that you might want to look at

An improved version of this exists at http://github.com/corneliutusnea/aurelia-grid

FourieDeWet commented 8 years ago

Ahh ok, not a problem. It is a nice feature to have which I do require.

Thanks for the reference to another possible solution, will have to look to see if it meets my requirements.

Looking forward to your update on this issue.

Thanks On 18 May 2016 9:37 PM, "Charles Pockert" notifications@github.com wrote:

Er, I just checked the source and I never implemented this feature! Oops!

Shouldn't be too hard to add ... just need to inspect the datasource when it is bound provided and generate a column for each property

If you need a more functional alternative to this grid (since it's just mostly a tech demo) there are a couple of other projects that you might want to look at

An improved version of this exists at http://github.com/corneliutusnea/aurelia-grid https://github.com/corneliutusnea/aurelia-grid

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/charlespockert/aurelia-bs-grid/issues/78#issuecomment-220134851