Joomla 3.9.10.
I have custom component. In admin panel I show items list from one DB table with JModelList.
models/mycom.php
:
class MyComModelMyCom extends JModelList {
public function getItems() {
...
return $items;
}
}
views/mycom/tmpl/default.php
:
<form action="index.php?option=com_mycom&view=mycom" method="post" id="adminForm" name="adminForm">
<table class="table table-striped">
<thead>
<tr>
<th><?= JHtml::_('grid.checkall') ?></th>
<th><?= JText::_('COM_MYCOM_TITLE') ?></th>
<th><?= JText::_('COM_MYCOM_MYBOOLEAN') ?></th>
</tr>
</thead>
<tbody>
<?php if (!empty($this->items)) : ?>
<?php foreach ($this->items as $i => $item) : ?>
<tr>
<td><?= JHtml::_('grid.id', $i, $item->id) ?></td>
<td><?= $item->title ?></td>
<td><?= $item->myboolean ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value=""/>
<?= JHtml::_('form.token'); ?>
</form>
There is one field with type 'boolean'. I want to change value from list table like standard field 'published'.
How can I do it? Is there any magic class in JHtml? Or what should I look for?
$item->myboolean
topublished
orunpublished
based on the true|false boolean value?