⚠ 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

Calling another list view on click of a list



techTD

techTD
  • profile picture
  • Member

Posted 14 July 2017 - 16:16 PM

Hi All,

 

Is it possible to invoke another list when user click on "View" in a list.

 

For example vendor products are stored in a table, there are multiple vendors and multiple products for each vendor.

 

I would like to display only Vendors in a list from vendor master table. Once user clicks on vendor "View" button, it should display list of products only for that vendor with ADD/EDIT button.

 

How can we do this?

 

Regards

TD


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 15 July 2017 - 18:47 PM

Well - you surely can do the same.

 

unset the default view.

Add a new action - view..

link the same with the another view ... simple - you got the solution for it.

 

Happy GCing :)


techTD

techTD
  • profile picture
  • Member

Posted 15 July 2017 - 20:20 PM

Well - you surely can do the same.

 

unset the default view.

Add a new action - view..

link the same with the another view ... simple - you got the solution for it.

 

Happy GCing :)

Well I am sure easy for GC expert like you Amit :) 

 

However, someone coming from data warehouse and data modeling background takes a bit of like to understand the flow and app programming.

 

Any example will be great Amit

 

Thanks a ton for your reply...

 

Cheers

TD


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 16 July 2017 - 06:12 AM

Well my friend,

 

I gave you the steps.. u just have to encode it.. 

its all there with you and documentation. 

 

https://www.grocerycrud.com/documentation/options_functions/unset_read

https://www.grocerycrud.com/documentation/options_functions/add_action

 

 

Happy GCing :)


techTD

techTD
  • profile picture
  • Member

Posted 16 July 2017 - 10:25 AM

Well my friend,

 

I gave you the steps.. u just have to encode it.. 

its all there with you and documentation. 

 

https://www.grocerycrud.com/documentation/options_functions/unset_read

https://www.grocerycrud.com/documentation/options_functions/add_action

 

 

Happy GCing :)

 

Got it Amit, 

 

Tried the method and it works.... thanks a ton for help :)


techTD

techTD
  • profile picture
  • Member

Posted 17 July 2017 - 10:01 AM

Hi Amit,

 

I am struggling to make it work, basically I am trying to set a text box with vendor name when a user clicks on ADD, the vendor name will be read only and user can fill all other fields as the ADD form is coming from a select list as described above in my first post.

 

I am using a call back here and trying to run another query in callback to fetch vendor name but the text field is always coming blank.

//User selects Vendor here
$crud->add_action('View Menu Items', '', 'admin/menu_items','ui-icon-plus');

//when user clicks ADD
$crud->callback_add_field('vendor_menu_items.vendor_id',array($this,'add_field_callback_1'));



function add_field_callback_1(){

                $this->db->where('vendor_id',1)
                $row = $this->db->get('vendor')->row();
                 //echo $vendor->vendor_short_name;
                  return '+30 <input type="text" maxlength="50" value="'. $result->vendor_short_name. '" name="vendor_id2" style="width:462px">';
                  //echo $vendor_id;
                  //echo $row;
}

techTD

techTD
  • profile picture
  • Member

Posted 17 July 2017 - 10:52 AM

Basically, how do I capture the vendor ID in callback which is passed by the list view when user clicks on a particular row in the list view.

 

I then need to query vendor table based on vendor_id so that I can get vendor name.