⚠ 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

Don't want to show table (in the view)



Abdul Wahid
  • profile picture
  • Member

Posted 23 March 2014 - 15:36 PM

Hi everyone,

 

I am having a problem. I want to to add data to my database through awsome grocery crud but I don't want to show the table which is shown by default by grocery crud. below are some images if you want to pictures what I mean.

 

this is what my page looks like when it first loads

[attachment=788:Screen Shot 2014-03-23 at 8.33.08 PM.png]

 

 

But this is how I want it to look when it first loads and when the form is field  I want to redirect the users to different page.

[attachment=789:Screen Shot 2014-03-23 at 8.34.11 PM.png]

 

Thanks in advance.


victor
  • profile picture
  • Member

Posted 23 March 2014 - 22:37 PM

My first thought is "Don't use GC where it is not necessary". It is a wrong way to use a big hammer where you can use a small hammer. You have only a few fields, try to develop that withot GC.


Amit Shah
  • profile picture
  • Member

Posted 24 March 2014 - 04:22 AM

Hi Abdul Wahid

 

Correct me if i am wrong, what i understand is that if you taking user to an action where it is having a GC list and if there are no records in the same, you want to redirect the user to the add page instead of showing him the list page. If that is the case, here is the solution

if($crud->getstate() == 'list') {
	$count = //run a count query OR model method on the table to get the total rows in the table
	if($count <= 0) {
		redirect('controller/action/add) --- just add the add method in the last to the same url
	}
}

Think that should do it...