⚠ 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

Can not filter data with default url in crud



Nguyễn Hải Nam
  • profile picture
  • Member

Posted 19 August 2013 - 04:49 AM

I have two tables: album and song. Now i want to click on a album to filter these song in this album.

And link to filter these song by album: http://localhost/myproject/index.php/song/index/list/1 (album_id = 1)

But when i edit and click on cancel button. crud will use http://localhost/myproject/index.php/song/index to back to list song. so i can't filter.

Please help to resolve this problem.
Thanks

 


Amit Shah
  • profile picture
  • Member

Posted 19 August 2013 - 09:10 AM

Hi Nguyễn Hải Nam

 

Welcome to the GC Forums. Well here is some mistake you making .. as for the url / sections.

 

What i will suggest you do is. ..

function index($album_id=FALSE) {
      
   ........
   if(is_numeric($album_id) {
       $crud->where('album_id', $album_id);
  }

}

this will form a url - /songs/index - by default list

- /songs/index/1 - filter with album id 1

and when u come back as cancel from editing the song, you will land back to this page only.


Nguyễn Hải Nam
  • profile picture
  • Member

Posted 20 August 2013 - 10:03 AM

Hi Amit Shah,

 

Thank you for supporting. Its working with me.

 

 

Hi Nguyễn Hải Nam

 

Welcome to the GC Forums. Well here is some mistake you making .. as for the url / sections.

 

What i will suggest you do is. ..

function index($album_id=FALSE) {
      
   ........
   if(is_numeric($album_id) {
       $crud->where('album_id', $album_id);
  }

}

this will form a url - /songs/index - by default list

- /songs/index/1 - filter with album id 1

and when u come back as cancel from editing the song, you will land back to this page only.