Jump to content


Filter without display in coloumn

filter

  • Please log in to reply
2 replies to this topic

#1 Hasan Busro

Hasan Busro

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 24 April 2013 - 01:11 AM

Hii all.

Can I create a filter without displaying fields in columns?
In other words, I want the value of a field can be searched, but the field is not displayed in the column.
How to do it?



#2 jjwdesign

jjwdesign

    Member

  • Members
  • PipPip
  • 12 posts

Posted 27 April 2013 - 04:51 PM

Yes, there is a way of doing it. Use the callback_column() method to revise the column details. For example, my title column was changed to add some additional search keywords (ie display: none) to make the JavaScript search functionality of datatables search better.

 

http://www.grocerycr...callback_column

 

Add the call back for the existing title column.

 

$crud->callback_column('title', array($this, '_rev_title'));

 

Use the callback to add the keywords into the column with style display none.

 

    function _rev_title($value, $row) {
        
        return htmlspecialchars($value) . 
            '<span style="display:none;"> ' . 
            htmlspecialchars(str_replace(',',' ', $row->search_keywords)) . 
            ' </span>';
    }

 

I used a Keyword Generating library to create the keywords. You don't have to use the keywords. You can use whatever fields you wish to add into the hidden span.

 

https://github.com/p...yword-generator

 

To generate the keywords on edit/add save. You'll need to look at several more callbacks. Something like...

 

$crud->callback_after_insert(array($this, '_callback_after_insert'));

$crud->callback_after_update(array($this, '_callback_after_update'));

 

But, I'll leave that up to you.



#3 Hasan Busro

Hasan Busro

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 02 May 2013 - 04:06 AM

Hi jjwdesign, thanks for your reply. But I still can not use the class "keyword-multibyte-generator" (https://github.com/p...yword-generator). I've tried to implement it by using it as a helper, but to no avail. If you have time, share it with me to tell it. Or maybe you have a code that I can in this instance.

Thank you very much







Also tagged with one or more of these keywords: filter

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users