×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Is there a way to display a field in admin form but not in site form?
Bizhan Rahim
New Member
Posts: 1
1 год 6 мес. назад #10110
от Bizhan Rahim
Bizhan Rahim создал тему: Is there a way to display a field in admin form but not in site form?
Is there a way to display a field in admin form but not in site form? Same for listing. Some columns should be visible in admin that should not be in front end for the same view/table.
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Ryan Minnig
New Member
Posts: 10
1 год 6 мес. назад #10128
от Ryan Minnig
Ryan Minnig ответил в теме Is there a way to display a field in admin form but not in site form?
Yes, you will edit the resulting com_xxx\src\tmpl\{table name here}\default.php file for the list view and com_xxx\src\tmpl\{table name here}\edit.php for the form view. In that you will find the code that generates the HTML for your component similar to:
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post"
name="adminForm" id="adminForm">
<?php if(!empty($this->filterForm)) { echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); } ?>
<div class="table-responsive">
<table class="table table-striped" id="xxList">
<thead>
<tr>
<th class=''>
<?php echo HTMLHelper::_('grid.sort', 'COM_XX_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
.......more columns here.........
</tr>
</thead>
Simple remove the headers for the columns you wish to hide makign sure to do this in the head and body part of the table.
A similar method is used for both the admin part and the site part.
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post"
name="adminForm" id="adminForm">
<?php if(!empty($this->filterForm)) { echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); } ?>
<div class="table-responsive">
<table class="table table-striped" id="xxList">
<thead>
<tr>
<th class=''>
<?php echo HTMLHelper::_('grid.sort', 'COM_XX_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
.......more columns here.........
</tr>
</thead>
Simple remove the headers for the columns you wish to hide makign sure to do this in the head and body part of the table.
A similar method is used for both the admin part and the site part.
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Charlotte Garner
New Member
Posts: 1
1 год 6 мес. назад - 1 год 6 мес. назад #10130
от Charlotte Garner
Charlotte Garner ответил в теме Is there a way to display a field in admin form but not in site form?
Hello,
Yes, you can use the Django admin ModelAdmin class to define fields to be displayed in the admin form and list view, separate from the fields displayed in the site form. Use the list_display attribute to define columns for the list view, and fields attribute for the admin form.
Connect.McKesson.com
Best regard,
Charlotte Garner
Yes, you can use the Django admin ModelAdmin class to define fields to be displayed in the admin form and list view, separate from the fields displayed in the site form. Use the list_display attribute to define columns for the list view, and fields attribute for the admin form.
Connect.McKesson.com
Best regard,
Charlotte Garner
Последнее редактирование: 1 год 6 мес. назад пользователем Charlotte Garner.
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Время создания страницы: 0.069 секунд