Addinn Options Field

Addinn Options Field

handbuchhandbuch Posts: 55Questions: 0Answers: 0
edited December 2011 in General
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

Replies

  • handbuchhandbuch Posts: 55Questions: 0Answers: 0
    No one? :(
  • handbuchhandbuch Posts: 55Questions: 0Answers: 0
    Please. Give me a godo way to solve that.
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    How about just putting the HTML into the array?

    [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
This discussion has been closed.