×
This forum has been locked. Please submit new Feature Requests on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Subform \ repeating rows from other tables
Neil
New Member
Posts: 6
10 år 5 måneder dager siden #99
av Neil
Subform \ repeating rows from other tables opprettet av Neil
It would be a nice feature to be able to use subforms in your main form from other tables when entering \ veiwing data as in the attached image.
As a simple example lets say you have a main table of authors and another table of books. From the Authors form you would add as many books as necessary as additional rows.
As a simple example lets say you have a main table of authors and another table of books. From the Authors form you would add as many books as necessary as additional rows.
Følgende bruker(e) sa Takk: RIP Graphics
Vennligst Logg inn eller Registrer konto for å bli med i samtalen.
RIP Graphics
New Member
Posts: 16
10 år 3 måneder dager siden #201
av RIP Graphics
Besvart av RIP Graphics i emne Subform \ repeating rows from other tables
Yes adding this feature would make this product even more helpful... Please give this a second thought
Thank you
Thank you
Vennligst Logg inn eller Registrer konto for å bli med i samtalen.
Adam Clark
New Member
Posts: 9
10 år 3 måneder dager siden #222
av Adam Clark
Besvart av Adam Clark i emne Subform \ repeating rows from other tables
Would be a great feature... most things have 1 to many relationship... I think that there is massive scope for 2 things that this triggers...
1) a drag and drop View Creator.
2) a configuration option so that all ADMIN and all SITE functions/classes are completely separate and not using some Admin function in the Site...
1) a drag and drop View Creator.
2) a configuration option so that all ADMIN and all SITE functions/classes are completely separate and not using some Admin function in the Site...
Vennligst Logg inn eller Registrer konto for å bli med i samtalen.
Nick Gardei
New Member
Posts: 10
10 år 1 uke dager siden #464
av Nick Gardei
Besvart av Nick Gardei i emne Subform \ repeating rows from other tables
Being a developer, I understand why this request would be difficult to fulfill. There just isn't a 'boilerplate' that works for all of these situations, and a working knowledge of how your data is interconnected is a must.
However, I think a bit of information goes a long way. The basic way this works is that the data is grabbed from the database in the MODEL and stored in an ARRAY. The VIEW then displays the data using a 'FOR EACH' loop to move through the ARRAY. So to get 'sub-data' for an item the easiest way is to write the data to a 'sub-array' using another 'FOR EACH' loop.
Here's some of my code from a model that lists Board Meeting 'Committees', and the Members that are assigned to them. Board Members, Committee, and Committee Assignments each have their own table;
MODEL;
VIEW;
However, I think a bit of information goes a long way. The basic way this works is that the data is grabbed from the database in the MODEL and stored in an ARRAY. The VIEW then displays the data using a 'FOR EACH' loop to move through the ARRAY. So to get 'sub-data' for an item the easiest way is to write the data to a 'sub-array' using another 'FOR EACH' loop.
Here's some of my code from a model that lists Board Meeting 'Committees', and the Members that are assigned to them. Board Members, Committee, and Committee Assignments each have their own table;
MODEL;
public function getItems()
{
$items = parent::getItems();
//Retrieve the committee member assignments, assign to array.
foreach ($items as $item){
$db2 = $this->getDbo();
$query2 = $db2->getQuery(true);
$query2->select($db2->quoteName(array('a.member_id', 'a.title', 'b.fname', 'b.lname', 'b.image')));
$query2->from($db2->quoteName('#__boardmgmt_commassign', 'a'));
$query2->join('INNER', $db2->quoteName('#__boardmgmt_members', 'b') . ' ON (' . $db2->quoteName('a.member_id') . ' = ' . $db2->quoteName('b.id') . ')');
$query2->where($db2->quoteName('a.comm_id').' = '.$item->id. ' AND '. $db2->quoteName('a.state').' = 1'. ' AND '. $db2->quoteName('b.state').' = 1');
$query2->order($db2->quoteName('a.ordering') . ' ASC');
$db2->setQuery($query2);
$item->members = $db2->loadObjectList();
}
return $items;
}
// no direct access
defined('_JEXEC') or die;
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base(). "components/com_boardmgmt/assets/css/views.css");
?>
<?php foreach ($this->items as $item) : ?>
<div class="comm_box">
<h2 class="comm_title"><?php echo $this->escape($item->title_en); ?></h2>
<?php echo $item->desc_en; ?>
<div>
<?php foreach ($item->members as $member) : ?>
<div class="comm_member">
<?php if ($member->image != ''): ?>
<img src="<?php echo JRoute::_(JUri::base() . 'administrator' . DIRECTORY_SEPARATOR .'components' . DIRECTORY_SEPARATOR . 'com_boardmgmt' . DIRECTORY_SEPARATOR . 'bmimages' .DIRECTORY_SEPARATOR . $member->image, false);?>">
<?php endif; ?>
<a href="<?php echo JRoute::_('index.php?option=com_boardmgmt&view=detail&id='.(int) $member->member_id); ?>"> <?php echo $member->fname . ' ' . $member->lname; ?></a><br />
<?php echo $member->title; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
Følgende bruker(e) sa Takk: Neil, Andres Maeso
Vennligst Logg inn eller Registrer konto for å bli med i samtalen.
Tid til å lage siden: 0.052 sekunder