问题
I am using OctoberCMS and using one of its awesome plugins called as builder and so far so good.
But, I am stuck at one stage and confused how to achieve this. This is my scenario below.
I have created one new field called as "status" in my one of the plugins in which I have key values like (0=>Inactive, 1=>Active)
.. this works fine as i am able to insert or update values based on my status selection..
But the thing is, when i go to listing page, i have selected a "status" field but its showing me values 0 or 1 instead of Active or Inactive.
How can i show Active or Inactive instead of 0 and 1 using builder plugin or any other way.. I need to be able to search and sort as well ..
Can anyone guide me for the same ?
Thanks
回答1:
Yes, you can define a custom SQL select statement to use for the value.
In your case,
mistake_status:
label: Status
searchable: true
select: CASE WHEN (status = '1' ) THEN 'Active' ELSE 'In Active' END // you can pass any custom SQL statement.
It will also helpful in search functionality of grid.
来源:https://stackoverflow.com/questions/40799476/show-dropdown-value-in-listing-search-instead-of-dropdown-key-using-builder-plug