EllisLab text mark
Advanced Search
27 of 28
27
   
Ignited DataTables
Posted: 23 October 2012 02:21 AM   [ Ignore ]   [ # 391 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-06
19 posts

I got this error, why is this?

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 
 
Posted: 23 October 2012 03:17 AM   [ Ignore ]   [ # 392 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

check your database configuration. As said on the error, ‘no tables used’

 
Posted: 23 October 2012 03:26 AM   [ Ignore ]   [ # 393 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-06
19 posts

other tables work fine, problem with this function, I am new to use Datatables library.

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);
   
  

   
 
Posted: 23 October 2012 03:37 AM   [ Ignore ]   [ # 394 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

I will just share you my code

$this->load->library('datatables');
  
$this->datatables
->select("office, position, email, privilege")
->
from("users")
echo 
$this->datatables->generate(); 
 
Posted: 23 October 2012 03:48 AM   [ Ignore ]   [ # 395 ]   [ Rating: 0 ]
Avatar
Joined: 2011-05-06
19 posts

It’s work , thanks…..

 
Posted: 26 October 2012 12:58 PM   [ Ignore ]   [ # 396 ]   [ Rating: 0 ]
Joined: 2011-12-08
7 posts

Greetings, anyone can help me I’m using the csv library and I can not do this query with the methods afforded me by this library

example

Select *
from table1
Union
select 
*
from table2 
 
Posted: 31 October 2012 03:49 AM   [ Ignore ]   [ # 397 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

Hello it’s me again. My ignited datatables are now working and I added a column for delete action.

controller

public function get_transaction_types()
 
{
  $this
->load->library('datatables');
  
$this->datatables
     
->select('name, days'FALSE)
     ->
from('transaction_types')
     ->
add_column("Actions",
      
"<form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'>
      <input type='hidden' value='$1' id='trans_type' name='trans_type' readonly />
      <button class='settings-action-btn' title='Update'>
      <img src='assets/images/icons/edit.png' alt='Update' />
      </button>
      </form>
      <form id='delete_transaction_type_form' method='post' action='settings/delete_transaction_type/$1' method='post' class='right'>
      <input type='hidden' value='$1' id='delete_trans_type' name='delete_trans_type' readonly />
      <button class='settings-action-btn' title='Delete'>
      <img src='assets/images/icons/delete.png' alt='Delete' />
      </button>
      </form>"
,
      
"name");
  echo 
$this->datatables->generate();
 

view

<div id="transaction_type_table_container">
        <
table id="transaction_type_table" class="tight">
         <
thead>
          <
tr>
           <
th class="text-center">Transaction Type</th>
           <
th class="width160 text-center">Number of days</th>
           <
th class="width70 text-center">Action</th>
          </
tr>
         </
thead>
         <
tbody>
          <
tr>
           <
td colspan="7" class="dataTables_empty">Loading data from server</td>
          </
tr>
         </
tbody>
        </
table>
       </
div

My problem is I want to have a popup box (confimation box) when I click the delete button in action column. I try to add jquery on click to the button=‘settings-action-btn’ to alert but nothing happens. Any suggestion?

 
Posted: 12 November 2012 02:49 AM   [ Ignore ]   [ # 398 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

Anybody can help me? Please?

 
Posted: 12 November 2012 09:49 AM   [ Ignore ]   [ # 399 ]   [ Rating: 0 ]
Joined: 2011-10-04
1 posts

DataTables needs to have an actual tutorial video… it’s way to complicated.  Not necessarily your CI Library, but the entire jQuery plugin.  For beginners like me, it’s just impossible to get started.  You can look at all the examples as I have done and still not get a single piece of it.  I still get a 400 error when trying to use the server-side implementation, and believe the problem may lie in my initialization.  I don’t understand what aoColumns are, or what needs to be in there, and what doesn’t.

Is there anything similar to DataTables but easier to use?

 
Posted: 12 November 2012 01:58 PM   [ Ignore ]   [ # 400 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
109 posts

http://vimeo.com/25273887 

i’ve made a video about how to use it some time ago.. but it has no sound. give it a try ^^

 Signature 

Ignited Datatables
Nested Sets

 
Posted: 16 November 2012 12:36 AM   [ Ignore ]   [ # 401 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

Hello. My ignited datatables code get the name and days and $1 is the name.

"<form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'>
      <input type='hidden' value='$1' id='trans_type' name='trans_type' readonly /> 

I want also to store the days on another hidden field. How would that be possible? thanks!

 
Posted: 11 December 2012 10:52 PM   [ Ignore ]   [ # 402 ]   [ Rating: 0 ]
Avatar
Joined: 2010-07-15
90 posts
ninjayan - 31 October 2012 03:49 AM

Hello it’s me again. My ignited datatables are now working and I added a column for delete action.

controller

public function get_transaction_types()
 
{
  $this
->load->library('datatables');
  
$this->datatables
     
->select('name, days'FALSE)
     ->
from('transaction_types')
     ->
add_column("Actions",
      
"<form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'>
      <input type='hidden' value='$1' id='trans_type' name='trans_type' readonly />
      <button class='settings-action-btn' title='Update'>
      <img src='assets/images/icons/edit.png' alt='Update' />
      </button>
      </form>
      <form id='delete_transaction_type_form' method='post' action='settings/delete_transaction_type/$1' method='post' class='right'>
      <input type='hidden' value='$1' id='delete_trans_type' name='delete_trans_type' readonly />
      <button class='settings-action-btn' title='Delete'>
      <img src='assets/images/icons/delete.png' alt='Delete' />
      </button>
      </form>"
,
      
"name");
  echo 
$this->datatables->generate();
 

view

<div id="transaction_type_table_container">
        <
table id="transaction_type_table" class="tight">
         <
thead>
          <
tr>
           <
th class="text-center">Transaction Type</th>
           <
th class="width160 text-center">Number of days</th>
           <
th class="width70 text-center">Action</th>
          </
tr>
         </
thead>
         <
tbody>
          <
tr>
           <
td colspan="7" class="dataTables_empty">Loading data from server</td>
          </
tr>
         </
tbody>
        </
table>
       </
div

My problem is I want to have a popup box (confimation box) when I click the delete button in action column. I try to add jquery on click to the button=‘settings-action-btn’ to alert but nothing happens. Any suggestion?

try attaching an onclick event to your button:

onclick='if(confirm("Are you sure?")) document.forms["delete_transaction_type_form"].submit(); return false;' 
 Signature 

Ignited Datatables

 
Posted: 01 January 2013 03:07 PM   [ Ignore ]   [ # 403 ]   [ Rating: 0 ]
Joined: 2013-01-01
1 posts
function view_user()
 
{
  $status
=1;
  
$this->datatables
    
->select("id,name,email,username,type,date_added")
    ->
from('ap_users'
    ->
unset_column('id')
    ->
edit_column('type''$1''callback_str_replace(1, ,type)')
    ->
edit_column('date_added''$1''callback_datechange(d-m-Y H:i|date_added)')
    ->
add_column('edit''<a href="profiles/edit/$1">edit</a>&nbsp;|&nbsp;<a href="profiles/edit/$1">delete</a>''id');
  echo 
$this->datatables->generate();             
  
 
}
The callback 
function not working it print full function in column.

javascript call

$('table.all').dataTable({
  
"bProcessing"true,
        
"bServerSide"true,
        
"sAjaxSource"config.base_url "main/view_user",
  
'fnServerData': function(sSourceaoDatafnCallback)
            
{
              
$.ajax
              
({
                
'dataType''json',
                
'type'    'POST',
                
'url'     sSource,
                
'data'    aoData,
                
'success' fnCallback
              }
);
            
}
  
    }
); 

Also can anyone help me where to write the callback function

Image Attachments
cidatatable.jpg
 
Posted: 04 January 2013 03:31 AM   [ Ignore ]   [ # 404 ]   [ Rating: 0 ]
Avatar
Joined: 2012-10-02
71 posts

there’s a problem on the code?
please see the attached screenshot..thank you.. smirk

Image Attachments
aa.png
 
Posted: 07 January 2013 06:38 AM   [ Ignore ]   [ # 405 ]   [ Rating: 0 ]
Joined: 2013-01-07
1 posts

Hello,

i have 2 table. “category” and “post”. category has 2 field : categoryId and categoryName. post has 3 field: postId, title, categoryId

now i want to show datatable categoryName and number of post according to this category.

how can i show this.

Regards,
Rejuan

 
27 of 28
27