⚠ 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

CRUD dropdown filtering



Nico
  • profile picture
  • Member

Posted 01 June 2013 - 00: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.


davidoster
  • profile picture
  • Member

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.


Nico
  • profile picture
  • Member

Posted 04 June 2013 - 21: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 :)


davidoster
  • profile picture
  • Member

Posted 04 June 2013 - 22:35 PM

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


JpunkLy
  • profile picture
  • Member

Posted 24 June 2013 - 09:33 AM

/topic/72-categories-and-subcategories/

 

Read This....!!!


Vishnu Dutt
  • profile picture
  • Member

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


Amit Shah
  • profile picture
  • Member

Posted 26 June 2013 - 18:51 PM

Well here is a simple solution to your problem,

 

/topic/1087-updated-24112012-dependent-dropdown-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.


Robert
  • profile picture
  • Member

Posted 27 June 2013 - 06:21 AM

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


Reslinator
  • profile picture
  • Member

Posted 20 September 2013 - 15: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>

davidoster
  • profile picture
  • Member

Posted 20 September 2013 - 20:28 PM

Hello and welcome to the forums [member=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.