Welcome Guest, Not a member yet? Register   Sign In
Ignited DataTables

[eluser]ninjayan[/eluser]
Thank you. I will try it.

[eluser]ninjayan[/eluser]
Can I directly echo the username in the add_column? I want to put the username inside anchor tag
Code:
$this->load->library('datatables');
  $this->datatables
    ->select("username")
    ->select("CONCAT(salutation, '. ', first_name, ' ', middle_initial, '. ', last_name) as full_name", FALSE)
    ->select("office, position, email, privilege")
    ->select("DATE_FORMAT(datetime_registered, '%b %d, %Y - %h-%i %p') as datetime_registered", FALSE)
    ->where("username !=", $this->session->userdata('username'))
    ->from("users")
    ->add_column("view", "<a>A</a>"); //HERE
  echo $this->datatables->generate();

The first link is the same from what I'm looking for but I'm using ignited datatables.
Sorry.

[eluser]ninjayan[/eluser]
[quote author="cryogenix" date="1299569982"][quote author="Pegasus275" date="1299088827"]How to use it with action column for example edit/delete etc.

<tr>
<td> id from db</td>
<td> name from db </td>
<td> <a href="edit....">Edit</a>
</tr>[/quote]

you can use petroz's client side solution to create additional columns:

[quote author="petroz" date="1299116938"]I use a callback on the Datatables.net configuration to generate the table on the fly. Add `fnDrawCallback` to attach any javascript function/method to the generation process.

Here is one for adding columns.

Datatables.prototype.addDataColumn = function()
{
$("#datatable tr:gt(0)").append("<td><a href=''>View</a>&nbsp;<a href=''>Edit</a>&nbsp;<a href=''>Delete</a></td>");
}[/quote]

or you can also modify the library where I commented:
Code:
/*
  add additional columns here
  like adding a Delete Row control for example:

  $aaData[$row_key][] = '<a href="#">Delete Button</a>';
*/
[/quote]
Can't find this commented lines.

[eluser]ninjayan[/eluser]
Okay. so I guess this will be my last question for this.
Code:
->add_column("Action",
        "&lt;form id='modify_form' action='modify_user/$1'&gt;
        <button class='modify-btn' title='Modify'>
        <img src='../assets/images/edit.png'/>
        </button>
        &lt;/form&gt;",
        "username");
Form submit goes to 'modify_user' function. Now I want to store the username to a variable and I will do compare. How will I do that?

[eluser]ninjayan[/eluser]
Okay so I just answered my question. Smile
Thanks again to those who gave inputs.

[eluser]harshitha[/eluser]
I got this error, why is this?


Code:
A Database Error Occurred

Error Number: 1096

No tables used

SELECT * LIMIT 100

Filename: C:\server\www\bigpmc\system\database\DB_driver.php

Line Number: 330

[eluser]ninjayan[/eluser]
check your database configuration. As said on the error, 'no tables used'

[eluser]harshitha[/eluser]
other tables work fine, problem with this function, I am new to use Datatables library.

Code:
function getBrand(){
  
  
   $table = "actor";
   $columns = array("actor_id", "fullname", "last_update");
   $index = "actor_id";
   $this->load->library("Datatables");
   echo $this->datatables->generate($table, $columns, $index);
  
  

   }

[eluser]ninjayan[/eluser]
I will just share you my code
Code:
$this->load->library('datatables');
  $this->datatables
->select("office, position, email, privilege")
->from("users")
echo $this->datatables->generate();

[eluser]harshitha[/eluser]
It's work , thanks.....




Theme © iAndrew 2016 - Forum software by © MyBB