How to use datatable editor from generator to codeignator 3, would you give me tutorial or article ?
Datatable editor from generator to codeignator
Ellipsis renderer not working with mjoin?
The following is not working for Ellipisis renderer on column 4 'unit outcome' which is using mjoin data. Not sure where the problem is though. The data from mjoin is wrapped in para tags. I can get ellipsis applied to other columns in this table no problem.
var table = $( '#unit_table' ).DataTable( {
responsive: true,
columnDefs: [ {
targets: 4,
render: $.fn.dataTable.render.ellipsis( 10, true )
} ],
ajax: "program_data/unit_data.php",
dom: "Blfrtip",
columns: [ {
data: "unit.unit_code"
}, {
data: "unit.unit_name"
}, {
data: "unit.points"
}, {
data: "year.year_name"
},{
data: "unit_outcome",
render: "[; ].unit_outcome"
}, {
data: "unit.modified"
}, {
data: "unit.modified_by"
} ],
select: {
style: 'os',
selector: 'td:first-child'
},
buttons: [ ]
} );
Function to exclude columns from print
The client wants printed output that only includes the currently visible columns, which I can do with ':visible'. However they also want to exclude certain columns, irrespective of their visibility. So I need a way to exclude the columns they don't want, whilst selecting visible columns that aren't in the exclude list.
I think the only way I can do this is with a function as a column-selector. However I can't get it to work, just testing with the following:
{
extend: "print",
text: "Print - Results",
exportOptions: {
function(idx, data, node) {
return false;
}
}
}
As far as I can tell, the function doesn't execute when I click the print button, and all columns appear in the output.
I've tried to do a test case of this but I get a script error when I include the buttons plugin:
http://live.datatables.net/lekoduwu/1/edit?html,js,console,output
Can you either tell me what I'm doing wrong in the demo, or let me know if what I'm trying to do with the Print button is possible?
Cheers.
Next page $("form").submit problem
This code not working on 2.,3. page help please.
[code]
$(document).ready( function () {
formajax2(".formajax",true,"Kullanıcı Düzenle");
function formajax2(div,pop,title){
$(div).submit(function(e) {
e.preventDefault();
var form = $(this);
var url = form.attr('action');
$.ajax({
type: "GET",
url: url,
data: form.serialize(),
success: function(data)
{
if (pop==true){ popup(data,title); }
}
});
});
}
});
[/code]
How to keep the default ctrl + click & drag behaviour with Select enabled?
I like the ability to select individual cells as well as cell ranges with ctrl + click
and ctrl + click & drag
in order to copy the underlying data.
But it seems that behaviour is completely disabled when I enable the Select extension, whichever mode I use.
Is there a way to enable both features?
At least when the selection mode doesn't require the ctrl
key, like multi
.
Why searchPanes button not work with searchPanes option???
please help me how to mix searchPanes Button example https://datatables.net/extensions/searchpanes/examples/initialisation/collapseStart.html with cascadePanes option https://datatables.net/extensions/searchpanes/examples/initialisation/viewTotalCascade.html ??
sorry im new user.
Will Editor-Server work propery with .NET Core 2.2?
I plan to use DataTables-Editor in my existing .NET Core Web / Web API 2.2 application.
Will any of the published dll-s (DataTables-Editor-Server.dll for 2.1 and 3.0) work with it?
Thank you!
How to inline edit the data in the row and update the same in a datatable
I want to edit the data in the table with inline editing.
I want to do the following flow
1. Clicking the edit button, selected row should be enable to edit along with Update and cancel button should show.
2. Clicking update button, updates the change.
Doing this on MVC 5.
Bug in Editor BS4 NPM package?
Hello,
i have a problem with the npm package "datatables.net-editor-bs4".
The file ~datatables.net-editor-bs4/js/editor.bootstrap4.js has two places (line 8 and 21) where it requires the package "datatables.net-bs".
=> Shouldn't it require the package "datatables.net-bs4"?
I fixed the problem by adding an alias for it in my webpack config.
Best regards
Furkan
I am the new guy
There can be a great deal of competition if you choose to promote something as a possible <a href="http://snow-drop-tales.sakura.ne.jp/s/yybbs63/yybbs.cgi?list=thread">apa itu affiliate</a>. However, you are able to look for the positive and turn these failures into learning experiences. This stay at home moms business opportunity could possibly be called the most effective online due on the limitless variety of products it is possible to promote.
ScrollY locked header & align issue (example provided)
When using ScrollY the header becomes locked and will sometimes mis-align. The main issue is when scrolling horizontally the header does not move and if there are headers off screen you never see them.
HTML:
(example table from https://datatables.net/examples/basic_init/zero_configuration.html)
CSS:
td { white-space: nowrap; }
th { white-space: nowrap; }
js:
$("#example").DataTable({
dom: 'Bfrtip',
"scrollY": "35vh",
"scrollCollapse": true,
"paging": false
});
Example showing the issue:
http://jsfiddle.net/Cyberjetx/hgvtqxux/34/
How to have button click event separated from button click event
i have been trying to have separate button click event and row click event. how ever when i try to edit a tuple using a button click event row click event triggers.
Below is my table loading and row click event.
$(document).ready(function () {
var dataTable;
$('#Person').parsley();
$.ajax({
url: "/Details/GetAllDetails",
type: "Get",
datatype: "json",
success: function (data) {
dataTable = $("#persondatatable").DataTable({
select: true,
data: data,
columnDefs: [
{
"click": false, "targets": [6],
"width": "24%"
}
],
columns: [
{ "data": "Id", "visible": false },
{ "data": "Firstname" },
{ "data": "LastName" },
{ "data": "PhoneNo" },
{ "data": "Email" },
{ "data": "SSN" },
{
"data": "Id", "render": function (data) {
return '<a class="btn btn-primary" style="margin-left:30px" onclick="editdetails(' + data + ')">Edit</a> <a class="btn btn-danger" style="margin-left:5px; margin-right:-15x" onclick="deletedetails(' + data + ')">Delete</a>'
}
}
],
})
$('#persondatatable tbody tr').on('click', function (e) {
e.stopPropagation();
var datalist;
var id = dataTable.row(this).data().Id;
$.ajax({
type: 'Post',
url: "/Details/ViewDetails/" + id + " ",
success: function (data) {
FirstName.textContent = data[0].Firstname,
LastName.textContent = data[0].LastName,
Address.textContent = data[0].Address,
DOB.textContent = data[0].DOBString,
Email.textContent = data[0].Email,
Phone.textContent = data[0].PhoneNo,
SSN.textContent = data[0].SSN
}
})
});
}
});
})
shown below is my edit table function
function editdetails(id) {
$('#Person').parsley().reset();
$.ajax({
url: "/Details/Edit/",
type: "POST",
data: JSON.stringify({ id: id }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var id = data[0].Id;
$('#id').val(data[0].Id),
$('#firstname').val(data[0].Firstname),
$("#lastname").val(data[0].LastName),
$('#address').val(data[0].Address),
$('#dob').val(data[0].DOBString),
$('#email').val(data[0].Email),
$('#phone').val(data[0].PhoneNo),
$('#ssn').val(data[0].SSN)
}
});
}
Reading a Boolean field from an SQL database.
i am reading an SQL table and its working fine.
However if i simple read a boolean colomn "IsBaseLine" from the same SQL table. (the boolean data : "IsBaseLine",)
Then I get an error:
DataTables warning: table id=tblData - Requested unknown parameter 'IsBaseLine' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
I've read around in circles trying to render and test the (data) but to no avail.
Can anyone help?
MDC for Web + Datatables
Hi,
will be supported MDC for web instead of MDL as this is outdated and no more updated by Google, since they are focusing on this lib.
Thanks
enable search and filtering on server-side datatable using foreign keys names not id's
Hi guys,
i am using server-side datatable, i have 2 foreign keys, i am showing not id's but name in other table. But when i make search and enter names it doesn't work, i want to enable search only in showed attributes. Thanks
<?php
//include connection file
include_once("connection.php");
// initilize all variable
$params = $columns = $totalRecords = $data = array();
$params = $_REQUEST;
$columns = array( 'id_doc','ref','taille','date_ajout' , 'type', 'nature', 'date_doc', 'date_echeance', 'date_notif', 'date_modif');
$where = $sqlTot = $sqlRec = "";
// check search value exist
if( !empty($params['search']['value']) ) {
$where .=" WHERE ";
$where .=" ( id_doc LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR date_ajout LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR type LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR nature LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR date_doc LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR date_echeance LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ";
$where .=" OR date_notif LIKE '%".mysql_real_escape_string($params['search']['value'])."%' ) ";
}
// getting total number records without any search
$sql = "SELECT * FROM `document` ";
$sqlTot .= $sql;
$sqlRec .= $sql;
//concatenate search sql if value exist
if(isset($where) && $where != '') {
$sqlTot .= $where;
$sqlRec .= $where;
}
$sqlRec .= " ORDER BY ". $columns[$params['order'][0]['column']]." ".$params['order'][0]['dir']." LIMIT ".$params['start']." ,".$params['length']." ";
$queryTot = mysqli_query($conn, $sqlTot) or die("database error:". mysqli_error($conn));
$totalRecords = mysqli_num_rows($queryTot);
$queryRecords = mysqli_query($conn, $sqlRec) or die("erreur en affichant l historique");
//iterate on results row and create new index array of data
include 'connect.php';
while ( $aRow = mysqli_fetch_array( $queryRecords ) ){
$row = array();
for ( $i=0 ; $i<count($columns) ; $i++ )
{
if ( $columns[$i] == "type" )
{
/* Special output formatting for 'version' column */
$comp=$aRow[ $columns[$i] ];
$sql="SELECT * FROM document_type where id_type='$comp'";
$req= mysql_query ($sql) ;
$datay= mysql_fetch_array($req);
$val = $datay['nom'];
$row[] = $val;
}
else if ( $columns[$i] != ' ' )
{
/* General output */
$row[] = $aRow[ $columns[$i] ];
}
}
//$output['data'][] = $row;
$data[] = $row;
}
$json_data = array(
"draw" => intval( $params['draw'] ),
"recordsTotal" => intval( $totalRecords ),
"recordsFiltered" => intval($totalRecords),
"data" => $data // total data array
);
echo json_encode($json_data); // send data as json format
?>
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
[And joined two threads together as both stuck in spam filter]
server-side formatter loop not showing last row
array( 'db' => '`s`.`nom`', 'dt' => 2, 'formatter' => function( $d, $row ) {
include('connect.php');
$id=$row[0];
$sqlg="SELECT s.nom as lenom FROM societe s,document_societe d where d.id_doc='$id' and s.id_soc=d.id_soc ";
$reqg= mysql_query ($sqlg) ;
$datag= mysql_fetch_array($reqg);
$lesoc='';
$nbr=mysql_num_rows($reqg);
$i=0;
while($datag= mysql_fetch_array($reqg))
{ $idn = $datag['lenom'];
$lesoc.=$i." <span class='label label-outline-success'>".$idn."</span><br/>";
$i=$i+1;
}
return $lesoc;},'field' => 'lenom','as' => 'lenom' ),
Editor - Select rows by specific column
Hi
I've been looking through the forum and examples, but have been unable to find what I'm looking for.
Taking the standard example, Name, position, office, extension, salary, how would I create a search based upon e.g. office only ?
I'm hoping that someone will have a link to live.datatables.net that already does this.
Many thanks in advance
Justin
where condtition with arrays - serverside
Hi!
I've got the following code.
include(dirname(__FILE__)."/../Editor-PHP-1.9.2/lib/DataTables.php");
// Alias Editor classes so they are easy to use
use DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Validate,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\ValidateOptions;
$my_id=$_POST['my_id'];
$timepoolid=$_POST['timepool_id'];
//$yourQueryArray = join(',',$timepoolid);
// Build our Editor instance and process the data coming from _POST
$editor = Editor::inst($db, 'crapper_vulnerability', 'crapper_vulnerability.id')
// ->order('ip')
->fields(
Field::inst('crapper_vulnerability.outputtool'),
Field::inst('crapper_vulnerability.testtypeid'),
Field::inst( 'crapper_vulnerability.toolid' ),
Field::inst( 'crapper_vulnerability.scanid' ),
Field::inst( 'crapper_vulnerability.fp' )
->setFormatter( function ( $val, $data, $opts ) {
return ! $val ? 0 : 1;
} ),
Field::inst( 'crapper_vulnerability.cvss_temp' ),
Field::inst( 'crapper_vulnerability.cvss_env' ),
Field::inst( 'crapper_vulnerability.cvss_base_new' ),
Field::inst( 'crapper_vulnerability.not_in_report' )
->setFormatter( function ( $val, $data, $opts ) {
return ! $val ? 0 : 1;
} ),
Field::inst( 'crapper_vulnerability.ip' ),
Field::inst( 'crapper_vulnerability.mac' ),
Field::inst( 'crapper_vulnerability.netbiosname' ),
Field::inst( 'crapper_vulnerability.os' ),
Field::inst( 'crapper_vulnerability.start' ),
Field::inst( 'crapper_vulnerability.stop' ),
Field::inst( 'crapper_vulnerability.plugin_id' ),
Field::inst( 'crapper_vulnerability.plugin_name' ),
Field::inst( 'crapper_vulnerability.port' ),
Field::inst( 'crapper_vulnerability.protocol' ),
Field::inst( 'crapper_vulnerability.cve' ),
Field::inst( 'crapper_vulnerability.cvss_base_score' ),
Field::inst( 'crapper_vulnerability.service_name' ),
Field::inst( 'crapper_vulnerability.description' ),
Field::inst( 'crapper_vulnerability.solution' ),
Field::inst( 'crapper_vulnerability.kundenr' ),
Field::inst( 'crapper_vulnerability.rapport' ),
Field::inst( 'crapper_vulnerability.filename' ),
Field::inst( 'crapper_vulnerability.tp_key' ),
Field::inst( 'crapper_vulnerability.plugin_output' ),
Field::inst( 'crapper_vulnerability.timepool' ),
Field::inst( 'crapper_vulnerability.id' )
)
->where('crapper_vulnerability.kundenr', $my_id)
->where( function ( $q ) use ( $timepoolid) {
$q->where( 'crapper_vulnerability.timepool', '(SELECT crapper_vulnerability.timepool FROM crapper_vulnerability WHERE crapper_vulnerability.timepool LIKE :timepool)', 'IN', false);
$q->bind( ':timepool', '%'.$_POST['timepool_id'].'%' );}
)
->process($_POST)
->debug(true)
->json();
I'm trying to use an array $timepool in a where condition, but I'm getting the following error:
Notice: Array to string conversion
How do I resolve this?
Kind regards,
Svendber
stateSaveCallback and stateLoadCallback: Custom Buttons in DOM
Hi
I have a container for a set of custom buttons drawn in the dataTables initialisation using a div like:- dom: "<'#sds-btns.col'f>"
sort of scenario.
A set of buttons are prepared using PHP to decide which buttons are appropriate for the table in use. An example of the button preparation is:-
$sdsButtons = '';
// SDS BUTTONS
// $obj['show_upload_button'] = true or false
if ($obj['show_upload_button'])
{
$sdsButtons .= "{ name: 'upload', className: 'btn btn-sm btn-outline-blue px-2', text: '" . Text::get('BUTTON_TEXT_UPLOAD') . "', titleAttr: '" . Text::get('LINK_TITLE_UPLOAD_FILE') . "', action: function () {
$('#id-upload').modal('show');
}
},";
}
Any custom buttons that were created are then added to the container with:-
var sdsB = new $.fn.dataTable.Buttons( tbl,
{
buttons:[" . $sdsButtons . "]
});
sdsB.container().appendTo( '#sds-btns' );
Everything works perfectly well, No issues, all is good.
However, if I add stateSave: true
to the table initialisation then the buttons are not added to the DOM despite there being no errors and the code executing seemingly normally.
So, I added stateSaveParams before I save the state using stateSaveCallback() function:-
stateSaveParams: function (settings, ssData) {
ssData.buttons = [" . $sdsButtons . "]
},
The buttons and everything else gets saved to my database as a JSON string like:-
"buttons":[{"attr":{"id":"add-new-tbl_crm"},"name":"new","className":"btn btn-sm btn-outline-blue px-2","text":"Create New","titleAttr":"Create New","action":""},{"attr":{"id":"btn-slideout","type":"button","aria-pressed":"true","data-toggle":"button"},"className":"btn btn-sm btn-outline-blue px-2 active","name":"slideout","text":"<i class='fas fa-filter fa-fw'><\/i>","titleAttr":"Apply Filter"}]
But, immediatley following the save, the 'new' button fires as though it has been clicked and the 'action' on that button is carried out!
2 questions arise from this.
Why does the 'new' button (id='add-new-tbl_crm') fire?
How do I load the button info back in the stateLoadParams(see below) function before stateLoadCallback is called
stateLoadParams: function (settings, ssData)
{
// I don't know what to do here
??????? = ssData.buttons;
},
Add editor datatable from a button
Good afternoon (o;
I am just playing with the trial version of datatable editor for our internal ordering system where of course lots of tables will be used..
One page for example shows a table of shopping carts which are either empty or incomplete....
So is it possible when I click in the cart table that it shows in a new table, which is editable, all items belonging to this cart or an empty cart?
Of course the ajax url GET parameter would change as well when selecting a different cart...
thanks in advance
richard