Skip to content
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

Should formatter keep a reference to the raw column data? #18

Open
ThaDafinser opened this issue Aug 28, 2017 · 0 comments
Open

Should formatter keep a reference to the raw column data? #18

ThaDafinser opened this issue Aug 28, 2017 · 0 comments

Comments

@ThaDafinser
Copy link
Contributor

From @rumeau on August 25, 2014 17:53

Hello, I've been using the datagrid for a couple of months and i have deal with custom formatters and conditional actions.

Currently if i need to format a status column (integer), i use a custom formatter called LabelFormatter which displays the status column to a human readable status ie:

1 => '<label class="open">OPEN</label>'
2 => '<label class="closed">CLOSED</label>'

I order to add conditional values to my actions i add the status column twice, i hide the original and add a second one and add the formatter to it, then i add my showOnValue to the hidden original.

Here is my question, giving that the Formatter has a purely presentation purpose (it might not in some cases), shouldn't the showOnValue value be compared with the raw value and not with the formatted one?

This is because i shouldn't need to add the status column twice, but just once, so if i am comparing with '1', then:

1 === '<label class="open">OPEN</label>' // works only if compare is '==' as a boolean
// having 1 =  the state i want to compare with
// '<label class="open">OPEN</label>' = the formatted value of column 'status'

should be:

1 === 1
// 1 = the state i want to compare with
// 1 = the raw value of column 'status'

Is this the expected behaviour or did i missed something?

Thanks.

Copied from original issue: ThaDafinser/ZfcDatagrid#136

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

No branches or pull requests

1 participant