EllisLab text mark
Advanced Search
19 of 28
19
   
Ignited DataTables
Posted: 19 November 2011 01:47 PM   [ Ignore ]   [ # 281 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
109 posts
vazmer - 19 November 2011 01:12 PM

I have a problem with OR within WHERE clause. It works when the table is initialized (the results are correct), but when trying to filter table data nothing happens.

For example, this won’t work:

->where("(departure LIKE '%SOME_VALUE%') OR (arrival LIKE '%SOME_VALUE%') "); 

This will work, but I need OR, not AND.

->where("(departure LIKE '%SOME_VALUE%') AND (arrival LIKE '%SOME_VALUE%') "); 


Try

->where("((departure LIKE '%SOME_VALUE%') OR (arrival LIKE '%SOME_VALUE%') )"); 

 

 Signature 

Ignited Datatables
Nested Sets

 
Posted: 19 November 2011 01:50 PM   [ Ignore ]   [ # 282 ]   [ Rating: 0 ]
Joined: 2011-11-19
2 posts

It works! Thank you very much! smile

 
Posted: 22 November 2011 04:53 PM   [ Ignore ]   [ # 283 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
28 posts

I am manually changing the “iDisplayLength” to a value greater than 10 but the table will only show 10 records at a time.  Also the datatable generate function only pulls 10 records from the database.  The only way to retrieve more than 10 records from the database I had to change the iLenght value in the get_paging() function.

Is there a way to change that value to get this to work.

$('#wtable').dataTable({
            
"bPaginate"true,
            
"bFilter"true,
            
"bSort"true,
            
"bAutoWidth"false,
            
"sDom"'<"top"f>t<"bottom"lip>',  
            
"sAjaxSource""<?php echo site_url('ajax/controller/get_table_data'); ?>",
   
"iDisplayLength "50,
            
"aaSorting"[[ 6"desc" ]],
   
'aoColumns' [
    { 
'sName''entry.publish_status''bSortable'false },
    
'sName''entry.entry_id'},
    
'sName''employee_name'},
    
'sName''employee.first_name''bVisible'false },
    
'sName''building.building_name'},
    
'sName''entry.observed_by' },
    
'sName''entry.date_submitted' },
    
'sName''functions''bSortable'false },
   
],
        
}); 

Thank you in advance.

 
Posted: 23 November 2011 08:34 AM   [ Ignore ]   [ # 284 ]   [ Rating: 0 ]
Joined: 2011-11-23
2 posts

nice post

thanks for sharing

Handicrafts products in Mumbai, India

 
Posted: 23 November 2011 08:46 AM   [ Ignore ]   [ # 285 ]   [ Rating: 0 ]
Joined: 2011-11-23
2 posts

nice information

thanks for sharing

Handicrafts Products in Mumbai,India

 
Posted: 26 November 2011 12:55 AM   [ Ignore ]   [ # 286 ]   [ Rating: 0 ]
Joined: 2011-11-15
5 posts

Trying to execute a simple callback in a helper file and it doesn’t do anything.

//leaddate = yyyy-mm-dd hh:mm:ss
$this->datatables->edit_column('leaddate','$1',format_date('leaddate')); 

in helper file

if(!function_exists('format_date')){

 
function format_date($tdate)
 
{
    $part
=explode(" ",$tdate);
    return 
$part[0];
  

no errors, just returns the date as if it didn’t use the function…very strange?? would actually like it to return am/pm format, but just trying to get this to work first. thanks.

 
Posted: 26 November 2011 03:15 AM   [ Ignore ]   [ # 287 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
109 posts
$this->datatables->edit_column('leaddate','$1',"format_date('leaddate')");  
 Signature 

Ignited Datatables
Nested Sets

 
Posted: 26 November 2011 01:16 PM   [ Ignore ]   [ # 288 ]   [ Rating: 0 ]
Joined: 2011-11-15
5 posts

awesome!

here’s my final helper,  if anyone had the same db format:

if(!function_exists('format_date')){

 
function format_date($date)
 
{
  $datestring
="%m/%d %h:%m %a";
  return 
mdate($datestring,human_to_unix($date));
  

thank you.

 
Posted: 08 December 2011 01:13 PM   [ Ignore ]   [ # 289 ]   [ Rating: 0 ]
Joined: 2011-12-08
7 posts

Hi, I’m Trying to execute a simple callback in a helper file and it doesn’t do anything.
$this->load->helper(‘statu_helper’);
$this->datatables->add_column(‘Acción’, “link_status(’$1’, ‘$2’)”, ‘donationId, status’));

and this my helper
if(!function_exists(‘link_status’)){

function link_status($id, $status)
{
  $url_m = base_url().“donations/status/”;
  $url_r = base_url().“donations/index/1”;
  //return $id.’ ‘.$status;
  switch($status)
  {
  case 0:
  return $url_m;
  break;
 
  case 1:
  return $url_r; 
  break;
  }
 
}
}

 
Posted: 08 December 2011 02:25 PM   [ Ignore ]   [ # 290 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
28 posts

php6,

try this

$this->datatables->add_column(‘Acción’'$1''link_status(donationId, status)')); 

instead of

$this->datatables->add_column(‘Acción’“link_status($1’$2’)‘donationIdstatus’)); 

Also adjust the helper to generate the complete link string and return that string (see below)
*cleaned up the function, switch is overhead in my opinion unless you have several cases.

function link_status($id$status)
{
  $url_m 
'<a href="'.base_url(donations/status).'">link text</a>';
  
$url_r '<a href="'.base_url(donations/index/1).'">link text</a>';
  
  return (
$status)?$url_m:$url_r;

*Don’t forget to add the quotation marks in the base_url function.  I ommitted them because the code tag messed up the display.


Let me know if that works.

 
Posted: 08 December 2011 02:49 PM   [ Ignore ]   [ # 291 ]   [ Rating: 0 ]
Joined: 2011-12-08
7 posts

jtrainaldi,

thank you.

I just want to know why you have to put the method in a helper and not the same controller

 
Posted: 08 December 2011 02:51 PM   [ Ignore ]   [ # 292 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
28 posts

I establish multiple databases in the config/database file.  The ignited datatable library defaults to the ‘active_group’ database that is established in the config file.

Is there a way to choose which database I can connect to?

 
Posted: 08 December 2011 02:53 PM   [ Ignore ]   [ # 293 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
28 posts
php6 - 08 December 2011 02:49 PM

jtrainaldi,

thank you.

I just want to know why you have to put the method in a helper and not the same controller

That is a question for the developer.

 
Posted: 08 December 2011 03:12 PM   [ Ignore ]   [ # 294 ]   [ Rating: 0 ]
Joined: 2011-12-08
7 posts

I just want to know. because we had so but the methods were in the driver and did nothing.

but sorry for the question, just as I appreciate the help

 
Posted: 08 December 2011 03:41 PM   [ Ignore ]   [ # 295 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
28 posts

No need to apologize.  I had the same thought as you.

 
19 of 28
19