⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Bootstrap search



gianni

gianni
  • profile picture
  • Member

Posted 09 May 2017 - 14:22 PM

Hello,

 

I have table a:

 

NAME  - ATTRIBUTE

John    -  1,3,5

 

table ATTRIBUTE

1    - TALL

3    - TINY

5    - CLEVER

 

This is a typical multi-select usage

 

Bootstrap theme show me the field with value 1,3,5

 

How can I show correctly the value, instead of 1,3,5   show TALL,TINY,CLEVER and allow the search on this field.

 

Thanks


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 10 May 2017 - 05:51 AM

well..a multi-select is designed to reside in separate table. The same is never expected to be around in same table with coma separated values. What you are trying to do is customization with the system. The same needs to be done with the column display. 

How to achieve for listing purpose ... as u desire..

have a callback on the column

 

in the callback function:

break up the values in an array (split)

for each id in the array - select the value from attributes table

and combine the attributes (implode)

join the same and return it back.

 

It should work for u

 

Happy GCing :)


gianni

gianni
  • profile picture
  • Member

Posted 10 May 2017 - 07:39 AM

Hi Amit, thanks for reply.
 
I did it but even in this way the search won't works as expected...
 
The search works only if I type the id value in the search field even if I see the corresponding values....
 
In the case above I see TALL, TINY, CLEVER but if I search for TALL in that field it returns nothing. If I type 1 it returns all records with TALL.

Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 10 May 2017 - 11:41 AM

Well ... that is 1 thing that is a bit tricky. ..

You have to take care for the search ... manually. In the state where it is search, check the search fields that are being searched by user - there if the user is using this id field .. set an extra where clause for the id field where u are searching for ids in the attributes table.

 

This is sheer issue with the custom callbacks. I have had given a solution / workaround on search callback. ... need to check.. if i find the same, will share u the link ..

But yes, it follows the same logic.