EllisLab text mark
Advanced Search
19 of 30
19
   
Ignited DataTables
Posted: 23 November 2011 07:34 AM   [ # 281 ]   [ Rating: 0 ]
Joined: 2011-11-23
2 posts

nice post

thanks for sharing

Handicrafts products in Mumbai, India

 
Posted: 23 November 2011 07:46 AM   [ # 282 ]   [ Rating: 0 ]
Joined: 2011-11-23
2 posts

nice information

thanks for sharing

Handicrafts Products in Mumbai,India

 
Posted: 25 November 2011 11:55 PM   [ # 283 ]   [ 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 02:15 AM   [ # 284 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-26
111 posts
$this->datatables->edit_column('leaddate','$1',"format_date('leaddate')");  
 Signature 

Ignited Datatables
Nested Sets

 
Posted: 26 November 2011 12:16 PM   [ # 285 ]   [ 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 12:13 PM   [ # 286 ]   [ 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 01:25 PM   [ # 287 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
29 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 01:49 PM   [ # 288 ]   [ 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 01:51 PM   [ # 289 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
29 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 01:53 PM   [ # 290 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
29 posts
php6 - 08 December 2011 01: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 02:12 PM   [ # 291 ]   [ 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 02:41 PM   [ # 292 ]   [ Rating: 0 ]
Avatar
Joined: 2010-02-23
29 posts

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

 
Posted: 09 December 2011 01:39 AM   [ # 293 ]   [ Rating: 0 ]
Avatar
Joined: 2010-07-15
91 posts
jtrainaldi - 08 December 2011 01:53 PM
php6 - 08 December 2011 01: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.

do remember that callbacks are made inside a library file which of course has no direct access to which controller uses it. therefore, it is much easier or actually, just possible (from a library point of view) to use helpers instead for their callbacks…

 Signature 

Ignited Datatables

 
Posted: 09 December 2011 03:26 AM   [ # 294 ]   [ Rating: 0 ]
Avatar
Joined: 2008-09-11
760 posts

i already asked this question till now no answer how we can add checkbox column in datatables for check all or uncheck all like gmail any possibility

 Signature 

CI,JQuery,Google Maps | widget with CI loader | Thumbnail, Image Resize, Image Crop Helper | CI shortcode

 
Posted: 09 December 2011 08:30 AM   [ # 295 ]   [ Rating: 0 ]
Avatar
Joined: 2010-01-07
19 posts

this is my query

SELECT ACCOUNT.account_id,ACCOUNT.name,ACCOUNT.bill_city,ACCOUNT.bill_country,EMAIL.email,COUNTRY.short_name,CONTACT.type,CONTACT.value FROM tbl_accounts AS ACCOUNT LEFT JOIN tbl_accounts_email AS EMAIL ON ACCOUNT.account_id=EMAIL.account_id && EMAIL.primary=1 LEFT JOIN tbl_country AS COUNTRY ON ACCOUNT.bill_country=COUNTRY.country_id LEFT JOIN tbl_accounts_contact AS CONTACT ON ACCOUNT.account_id=CONTACT.account_id && CONTACT.type='website' GROUP BY ACCOUNT.account_id 
$this->load->library('datatables');
  
$this->datatables
   
->select("A.account_id,A.name,C.type,C.value,E.email,E.primary ",FALSE)
   ->
from('tbl_accounts AS A')
   ->
join('tbl_accounts_contact AS C','A.account_id=C.account_id','left')
   ->
join('tbl_accounts_email AS E','A.account_id=E.account_id','left')
      ->
where('E.primary''1')
->
add_column('action''<a href="'.site_url(" title="Edit" class="with-tip"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/pencil.png" width="16" height="16"></a>&nbsp;&nbsp;<a href="" id="$1" title="Delete" class="with-tip delete"><img src="'.base_url().'assets/backend/skin/images/icons/fugue/cross-circle.png" width="16" height="16"></a>', 'id'); 

I want to add group by with this query. Please help me.

Thanks in advance,
Logan

 Signature 

Can…..Can….We Can Rule the world…........

 
19 of 30
19