Skip to content

Select column input "value" is not always the id value set #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ithielnor opened this issue Aug 19, 2016 · 2 comments
Open

Select column input "value" is not always the id value set #69

ithielnor opened this issue Aug 19, 2016 · 2 comments
Labels

Comments

@ithielnor
Copy link
Collaborator

If you write your settings like:

var grid = new GriddlySettings<Drg.M3.Domain.Events.Registration>();
grid.RowId(x => x.Blah.Id);
grid.SelectColumn(x => x.Id);

The input in the select column will be rendered with x.Blah.Id as the value instead of x.Id. However, if you write

var grid = new GriddlySettings<Drg.M3.Domain.Events.Registration>();
grid.SelectColumn(x => x.Id);
grid.RowId(x => x.Blah.Id);

The input value will be x.Id as expected. It seems to me that the value should always be whatever expression was specified in SelectColumn

@ithielnor ithielnor added the bug label Aug 19, 2016
@programcsharp
Copy link
Owner

programcsharp commented Aug 19, 2016

It looks like this is by design: dc935e9#diff-afcf37e41443e6efc6072140d2dd621fR24

SelectColumn adds one (or more) RowId's to the settings, same as RowId. It then picks the first RowId to use as value but adds all of them as data attributes. Normally this works fine, but if you RowId first then that id will be first in the RowId's dictionary instead.

Maybe we need to rework the RowId design a bit? #26 is still open to allow setting names for buttons easier.

@ithielnor
Copy link
Collaborator Author

I know that's how the render works, but the helper function .SelectColumn should be changed I think.

It seems to me that if you specify an Id in the .SelectColumn it should always win, no matter where you put other RowIds in the configuration.

Why not make .SelectColumn to an Insert(0, func) so value will always be the id specified in the helper column. Though, this does get funky with multiple select columns...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants