Show Dropdown value in listing search instead of dropdown key using builder plugin

南楼画角 提交于 2021-01-27 17:38:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!