Comments (16)
what kind of data you'd pass as a parameter to is_comm() ?
from ignited-datatables.
Try
->edit_column('fee_is_comm', '$1', 'is_comm(fee_is_comm)')
On Sat, Apr 19, 2014 at 8:47 AM, anupalusoft [email protected]
wrote:
helper function i created:
function is_comm($check)
{
if($check)
return 'Yes';
else
return 'No';
}
Now with ignited table i code in controller:
$this->datatables
->select('fee_id, fee_name, fee_is_comm, fee_remarks')
->unset_column('fee_id')
->edit_column('fee_is_comm', is_comm('$1'), 'fee_is_comm')
->add_column('Actions', get_ajax_buttons('$1'), 'fee_id')
->from('fee_types');
The the helper function treating the $check as string ('$1') which is actually Boolean (0|1) from database. It always return "Yes".See the issue if we can fix it.
Reply to this email directly or view it on GitHub:
#50
from ignited-datatables.
@n1crack Its not working. It return 'Yes' always.
Actually what ever we pass in function parameter it always treat as string '$1' in if condition of that function. thus always return 'Yes' in helper function.
@widnyana It is actually a Boolean value which i am trying to pass but seems like it treating it '$1' always.
from ignited-datatables.
try this
function is_comm($check)
{
if(is_bool($check) ) {
if($check === true)
return 'Yes';
else
return 'No';
}
else {
return 'not boolean';
}
}
i just wondering, what will returned with that func :/
from ignited-datatables.
It prints "not boolean" :/
But from database it comes boolean value then how it treating it as non boolean ?!
from ignited-datatables.
try to validate with another method, maybe comparing with string could help 😆
from ignited-datatables.
I don't know what to do. I tried all methods. Its an issue in library. Please give a fix. I can explain if you don't understand.
from ignited-datatables.
I can confirm this is an issue. I am using 1.15 version.
from ignited-datatables.
@fjafferi yes this is the big issue and now this plugin is useless for me. :(
Hoping developers will find any fix for this.
from ignited-datatables.
I will look for it as soon as i have free time.
On Tue, May 27, 2014 at 11:27 AM, anupalusoft [email protected]
wrote:
@fjafferi yes this is the big issue and now this plugin is useless for me. :(
Hoping developers will find any fix for this.
Reply to this email directly or view it on GitHub:
#50 (comment)
from ignited-datatables.
thanks @n1crack. I am looking into it myself. I'll update this post if i figure out the problem.
Thanks again.
from ignited-datatables.
double quotes on the function
->edit_column('fee_is_comm', '$1', "is_comm('fee_is_comm')")
from ignited-datatables.
regards,
I have the following code
Call Back
function crearBotonAccion($ID=0,$modulo='',$titulo='',$accion='')
{
$CI =& get_instance();
$CI->load->library('session');
$arrayKey= array();
$data = array();
foreach ($CI->session->userdata('SubModulos') as $value) {
$arrayKey = array(
'agregar' => $value->agregar,
'ver' => $value->ver,
'editar' => $value->editar,
'eliminar' => $value->eliminar,
);
$data = array(
'urlAgregar' =>base_url().strtolower($titulo).'/'.$accion,
'url' => base_url().strtolower($titulo).'/'.$accion.'/'.$ID,
'titulo' => strtolower($titulo),
'accion' => $accion,
'id' => $titulo."_".$accion,
);
if($value->nombre == $modulo && $arrayKey[$accion] =='si')
{
return $CI->load->view("botones/".$accion, $data);
}
}
}
View
<a data-rel="tooltip" title="Editar <?php $titulo;?>" href="<?php echo $url;?>" class="green" id="<?php $id;?>">
<i class="icon-edit bigger-150"></i>
</a>
Model
->add_column('action', '$1', 'crearBotonAccion(usuarioId, "Usuario", usuario, "editar")');
When I print to console me separate the html view of the json format and gives me an error in the datatable, but return a string I get well
Error if I use
return $CI->load->view("botones/".$accion, $data);
Successful if I use
return "<a title='".$accion.' '.strtolower($titulo)."'href='".$url2."'class='".$class."' id='".$titulo.'_'.$accion."'>
<i class='".$icon." bigger-120'></i> Crear ". $titulo ."</a>";
Sorry for my english
from ignited-datatables.
@anupalhub in my case, I can make this works, your function changed to this
function is_comm($check) { if(intval($check) == 1) return 'Yes'; else return 'No'; }
and in the controller
->edit_column('fee_is_comm', '$1', 'is_comm("fee_is_comm")')
maybe this works too
->edit_column('fee_is_comm', '$1', "is_comm('fee_is_comm')")
from ignited-datatables.
$this->is_comm('fee_is_comm')
from ignited-datatables.
First of all you can't address the function as it is now directly. you have to put it in quotes. In addition that the function has to be global. That means you have to define your function as a helper function.
My first comment was working. Again put the function in quotes.
->edit_column('fee_is_comm', '$1', 'is_comm(fee_is_comm)')
it returned always true in the first function, because you were checking if it has a value.
@widnyana was right, it is not a boolean. it is a string.
probably if($check == 'true' ) or if($check == 1 ) would worked.
I could have improved this library but I don't want anyone break their codes. I have rewritten the codes and make 'Composer' compatible a while ago. You can find the library here: datatables
The cons is you can't use active records like IgnitedDatatables, you have to write your sql query. And you have to use Composer of course.
the solution that I found is using a callback function instead of passing a string : edit column example. I think this is the best practice and it is as simple as the code below.
->edit('fee_is_comm', function($data) {
return $this->is_comm( $data['fee_is_comm'] );
})
And it's been 4 years. it is still an active issue. wow 😮
from ignited-datatables.
Related Issues (20)
- This library is not useful for server side pagination and column based search feature. HOT 1
- $this->ci->having implementation HOT 2
- ->where_in ->or_where error ?
- Shorting Searching not working in codeigniter 3.0.6
- there is no usage example.
- How Can We Use plain query without query builder HOT 1
- Group by error with PostgreSQL HOT 1
- Column 'id' in where clause is ambiguous HOT 4
- Button Next Page Not working HOT 1
- Date Range Filtering for Specific Column
- Error when use the aritmatic command * and + in $this->datatabel->select( ); HOT 2
- group_start and or_group_start implementation HOT 2
- What does `check_cType()` do? HOT 5
- Callbak URL Serialize Encrypt add_column or edit_column HOT 2
- Use this version instead HOT 11
- Cant Use this Library with current Datatable version HOT 4
- Error match_replacement on add_column
- Datatables serverside with union query
- Smart Search HOT 1
- Ignited Datatables selecting all columns even when column names are specified HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ignited-datatables.