Problem with Server side rendering

Problem with Server side rendering

necrotosnecrotos Posts: 12Questions: 3Answers: 0
edited May 2011 in General
I have datatable with server side type. My code is

[code]
$(document).ready(function() {
oTable = $('#listforum').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
null,
null,
null,
{"sClass": "center"},
null,
{"bSortable": false, "bSearchable": false, "sClass": "center"}
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo $this->url(array('module' => 'admin', 'controller' => 'forums', 'action' => 'ajax')) ?>"
});
});

$('.button').each(function () {
$(this).button({
icons : {
primary : $(this).attr('data-icon-primary') ? $(this).attr('data-icon-primary') : null,
secondary : $(this).attr('data-icon-primary') ? $(this).attr('data-icon-secondary') : null
},
text : $(this).attr('data-icon-only') === 'true' ? false : true
});
});
[/code]

in my server code

[code]
public function ajaxAction() {
$start = $this->_getParam('iDisplayStart', 0);
$length = $this->_getParam('iDisplayLength', 10);

$page = ceil($start / $length) + 1;
$forums = Forums_Model_Forums::getInstance()->getForums($page, $length);

$output = array(
"sEcho" => intval($this->_getParam('sEcho')),
"iTotalRecords" => $forums->getTotalItemCount(),
"iTotalDisplayRecords" => $forums->getTotalItemCount(),
"aaData" => array()
);

foreach ($forums as $value) {
$output['aaData'][] = array(ucwords(strtolower($value['FORUM_TITLE'])), ucwords(strtolower($value['FORUMCATEGORY_NAME'])), $value['FORUM_SLUG'], $value['FORUM_POSTS'], $value['FORUM_DESCRIPTION'], 'ActiveDeactive');
}

header('Content-Type: application/json');
echo json_encode($output);
}
[/code]

in "'ActiveDeactive" why the tag with class "button" not render correctly.

Replies

  • necrotosnecrotos Posts: 12Questions: 3Answers: 0
    Solved with function "fnDrawCallback"
  • necrotosnecrotos Posts: 12Questions: 3Answers: 0
    my final code is

    [code]

    $(document).ready(function() {
    oTable = $('#listforum').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "aoColumns": [
    null,
    null,
    null,
    {"sClass": "center"},
    null,
    {"bSortable": false, "bSearchable": false, "sClass": "center"}
    ],
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "<?php echo $this->url(array('module' => 'admin', 'controller' => 'forums', 'action' => 'ajax')) ?>",
    "fnDrawCallback": function() {
    $('.button').each(function () {
    $(this).button({
    icons : {
    primary : $(this).attr('data-icon-primary') ? $(this).attr('data-icon-primary') : null,
    secondary : $(this).attr('data-icon-primary') ? $(this).attr('data-icon-secondary') : null
    },
    text : $(this).attr('data-icon-only') === 'true' ? false : true
    });
    });
    }
    });
    });

    [/code]
This discussion has been closed.