Addinn Options Field
Addinn Options Field
Hi, im using Zend and Datatables. I have a table like that:
[code]
<?php $this->trans('ID') ?>
<?php $this->trans('Name') ?>
<?php $this->trans('Comment') ?>
<?php $this->trans('Options') ?>
<?php $this->trans('ID') ?>
<?php $this->trans('Name') ?>
<?php $this->trans('Comment') ?>
<?php $this->trans('Options') ?>
[/code]
im creating my array like that
[code]
public function jsonAction() {
$this->_helper->layout->disableLayout();
$albums = new Application_Model_DbTable_Customers();
$albums = $albums->fetchAll()->toArray();
foreach($albums as $entry) {
$x[] = array($entry['id'], $entry['name'], $entry['comment'], '');
}
$this->view->json = json_encode(array("aaData" => $x));
}
[/code]
as you see, im creating an array which i encode to json afterwards. For the Options field, i just added ''.
In the Options field, i want some edit icons etc. How can i get to that easily?
Im looking for a way, to delete the last empty ('') field in the array and do something like addColumn(someHtmlToPutThere);
Adding the HTML into my jsonAction is not a good idea. I would like to keep it clean and just put all HTML into JS or my Views.
Thanks
[code]
<?php $this->trans('ID') ?>
<?php $this->trans('Name') ?>
<?php $this->trans('Comment') ?>
<?php $this->trans('Options') ?>
<?php $this->trans('ID') ?>
<?php $this->trans('Name') ?>
<?php $this->trans('Comment') ?>
<?php $this->trans('Options') ?>
[/code]
im creating my array like that
[code]
public function jsonAction() {
$this->_helper->layout->disableLayout();
$albums = new Application_Model_DbTable_Customers();
$albums = $albums->fetchAll()->toArray();
foreach($albums as $entry) {
$x[] = array($entry['id'], $entry['name'], $entry['comment'], '');
}
$this->view->json = json_encode(array("aaData" => $x));
}
[/code]
as you see, im creating an array which i encode to json afterwards. For the Options field, i just added ''.
In the Options field, i want some edit icons etc. How can i get to that easily?
Im looking for a way, to delete the last empty ('') field in the array and do something like addColumn(someHtmlToPutThere);
Adding the HTML into my jsonAction is not a good idea. I would like to keep it clean and just put all HTML into JS or my Views.
Thanks
This discussion has been closed.
Replies
[code]
$x[] = array($entry['id'], $entry['name'], $entry['comment'], '');
[/code]
The alternative is to use fnRender to add the image after you've got the data back from the server.
Allan