IgnitedDatatables / Ignited-Datatables

Ignited Datatables is a wrapper class/library based on the native Datatables server-side implementation by Allan Jardine found at http://datatables.net/examples/data_sources/server_side.html for CodeIgniter
285 stars 335 forks source link

Callbak URL Serialize Encrypt add_column or edit_column #131

Closed jafarsidik closed 3 years ago

jafarsidik commented 6 years ago

Hallo,

How to create code this Output URL : http://localhost/cms/content/form/JDE=

This Existing Code, doesn't Not works serialize in loop data. Controller :

  public function load()
{
    $this->datatables->select('c.id as id, c.code as code');

    $this->datatables->from('cms_content c');

    $this->datatables->add_column('edit', $this->callback_url('$1'), 'id');

    echo  $this->datatables->generate();
}

function callback_url($params) {

    return site_url('cms/content/form/').base64_encode($params);

}
wrabit commented 6 years ago

I would do it like this:

public function load()
{
    $this->datatables->select('c.id as id, c.code as code');
    $this->datatables->from('cms_content c');

    function callback_url($id) {
        return site_url('cms/content/form/').base64_encode($id);
    }
    $this->datatables->add_column('edit', '$1', "callback_url(id)");

    echo  $this->datatables->generate();
}
jafarsidik commented 6 years ago

hallo Sir @digitaloutback ,

Thx Before, Your Code Is Working. 👍 👍 👍