Jump to content


CRUD dropdown filtering

filter dropdown crud

  • Please log in to reply
9 replies to this topic

#1 Nico

Nico

    Member

  • Members
  • PipPip
  • 11 posts
  • LocationQuebec, Canada

Posted 01 June 2013 - 12:31 AM

Hi,

 

I'm trying to create a page which has dropdown lists from which the user selects options and press a button to display a crud filtered according to the dropdowns.

That basic process works pretty well, since it involves basic CRUD creation!

 

The problem appears when the user clicks on a column header to filter by that column. At this moment, CRUD doesn't care about the dropdowns, which is normal since CRUD core isn't built to work this way, I know.

 

I'm just wondering how I could make this work...

Any ideas?

 

Thanks in advance.


-- Nico --

#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 01 June 2013 - 08:33 AM

Every CRUD saves cookies for the state of operation it is in, e.g. filtering, paging etc.

In order to make your dropdown selection persistent you need to understand the way GC stores this information.

I believe this is the only way if you want to maintain the information from the dropdown menus.

 

Such an implementation I believe it will need hacking on the core of the library so keep this in mind.

Maybe when the next version becomes available where multigrids are enabled this is going to be easier to implement without changing the core at all.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 Nico

Nico

    Member

  • Members
  • PipPip
  • 11 posts
  • LocationQuebec, Canada

Posted 04 June 2013 - 09:33 PM

Thanks, I've found my way through the theme's code and managed to make it work!!

It'll have saved me from hacking through the core :)


-- Nico --

#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 04 June 2013 - 10:35 PM

Well done! You can always share your code/solution with the others if you want to!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#5 JpunkLy

JpunkLy

    Member

  • Members
  • PipPip
  • 15 posts

Posted 24 June 2013 - 09:33 AM

http://www.grocerycr...-subcategories/

 

Read This....!!!


Visit My Page -> http://nugashare.me.pn |  @DianNugraha702


#6 Vishnu Dutt

Vishnu Dutt

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 24 June 2013 - 12:53 PM

Hi ,

 

I am useing dropdown customization. The work I want to do is : I have three dropdown 1, 2 ,3 and I want to empty 2 and 3 dropdown on selecting 1 and vice versa. I have done it useing custome jQuery but It is not empting is value from the post. 

 

Please reply



#7 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 26 June 2013 - 06:51 PM

Well here is a simple solution to your problem,

 

http://www.grocerycr...opdown-library/

 

the link specifies the correct type of example that you need to implement with a 4 level of drop down.. and how to manage it. It is a well designed extension and i am using it for all of my projects wherever it is required. It never failed me yet.



#8 Robert

Robert

    Advanced Member

  • Members
  • PipPipPip
  • 220 posts

Posted 27 June 2013 - 06:21 AM

Nice function Nico i was looking for something like that .. any chance to share the code ?



#9 Reslinator

Reslinator

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 20 September 2013 - 03:16 PM

hi there.

 

I have been working with crud for just some minutes...
but i already find GC pretty much mind blowing.. keep rocking!

 

Could this be a possible fix for the filtering from a dropdown?

Get thevalues which you which to be the filtercritera from your database (i. E. a relation which is displayed in a certain row).

 

Place this code snippet within your view...

Probably not very academic, but why should i round trip or ajax to the server if codeignitor and jquery can do it from design. :)

<?php  
            $query = $this->db->query('SELECT id, Bezeichnung FROM gruppe');
            echo"<select id='filtercriteria'>";
            foreach ($query->result() as $row)
            {
                 echo "<option value='" . $row->id . "'>" . $row->Bezeichnung . "</option>";
            }
            echo"</select>";
 ?>
    
<script type="text/javascript">
             $(document).ready(function() {
                       $("#search_field").attr('selectedIndex', 1);  
             });           
             
             $( "#filtercriteria" ).change(function() {
                    $( "#search_text" ).attr('value',$( "#filtercriteria option:selected" ).text());
                    $('#crud_search').trigger('click');
             });                
                
                        
</script>


#10 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 20 September 2013 - 08:28 PM

Hello and welcome to the forums Reslinator.

You can surely do this. It is perfectly acceptable, if you want to have some static views. But what happens if you want the aforementioned code changed somehow?

If your project doesn't require it then yes, do it by all means!

It all depends on your implementation.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr






Also tagged with one or more of these keywords: filter, dropdown, crud

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users