Hi
if i save data in a textarea field all non standard attributes are removed after saving.
Example:
My text in field:
<span uk-icon="icon: triangle-right"></span>
After saving data:
<span></span>
Knows somebody why ?
Thanks
Hi
if i save data in a textarea field all non standard attributes are removed after saving.
Example:
My text in field:
<span uk-icon="icon: triangle-right"></span>
After saving data:
<span></span>
Knows somebody why ?
Thanks
Hi Guys, I am trying to implement server side individual column filtering using this example with little modification
Modifications:
1. Add footer above the headers
2. Add column filters only for specific columns
3. Trigger event on Enter keyCode
$('#myDataTable tfoot th').filter(':eq(2),:eq(4),:eq(6),:eq(8),:eq(10)').each( function () {
var title = $('#myDataTable thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" id ="filter'+$(this).index()+'"/>' );
} );
$('#myDataTable tfoot tr').insertBefore($('#myDataTable thead tr'))
var table = $('#myDataTable').Datatable({
....
})
table.columns(2,4,6,8,10).every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function (e) {
if ( that.search() != this.value && e.keyCode == 13) {
that.search( this.value ).draw();
}
} );
} );
In MVCController, I am capturing these pagination/search filters like below
@RequestParam(value = "draw", required = false) Integer draw,
@RequestParam(value = "order[0][column]", required = false) final Integer sortColumn,
@RequestParam(value = "order[0][dir]", required = false) final String sortOrder,
@RequestParam(value = "start", required = false) Integer start,
@RequestParam(value = "length", required = false) Integer length,
@RequestParam(value = "columns[2][search][value]", required = false) String col2search,
@RequestParam(value = "columns[4][search][value]", required = false) String col4search,
@RequestParam(value = "columns[6][search][value]", required = false) String col6search,
@RequestParam(value = "columns[8][search][value]", required = false) String col8search,
@RequestParam(value = "columns[10][search][value]", required = false) String col10search
Problem here is I am only getting the value in col2search which is obvious because I am triggering event on one column at a time. Currently I am getting just one filter from which enter event is triggered.
How do I search all filters added by just one request to server. e.g add search text to all these specific search placeholders and get matching result.
I have explored most examples/answers in forum but couldn't get it working. Can some one help please
How to show data table export button like xls,pdf etc in drop down as link.
Hi,
How can I programmatically select a row after inserting a new one ? (its has be inserted with an ajax call to the DB)
Thanks
Please help me to create individual column filtering on my server side datatables, that would be great if you want to make the documantation.
thank you
Below is the sample short code and should work.
I need to know how can i use _fnCallbackReg correctly for writing plugins
JSFIDDLE: https://jsfiddle.net/bababalcksheep/fsv0tLn3/2/
(function(window, document, $, undefined)
{
//
//
$(document).on('init.dt', function(e, oSettings)
{
var tCreated = function(row, data, dataIndex)
{
console.log('row', row);
return 's';
//$(row).addClass('test') ;
};
oSettings.oApi._fnCallbackReg(oSettings, 'aoRowCreatedCallback', tCreated, 'user');
});
//
//
})(window, document, jQuery);
Hi Allan,
Sorry for troubling you so often.. but
I am trying to use Select2 plugin with Tagging enabled.
Although it works correctly, but I am facing 1 issue in editing
When i try and edit a record, the tags/selectoptions are not pre populated in the select box.. and when I try and update the data manually it shows all the tags as selectable options and not tags..
Kindly please help me with this.
you can find the entire JS here...
http://gadhiya.in/web/js/commodity_transaction_field.js
Regards
Kaustubh
$.ajax({
type: "GET",
url: "/controller/action",
success: function (data) {
debugger
$("#_Grid").empty();
$("#_Grid").html(data);
},
error: function (xhr, ajaxOptions, thrownError) {
modalMessage('Failed to Load _ExpLevelGrid.', "danger");
}
});
the action method returns partial view of datatable
EDIT: update post to use back ticks (```) for code display
I noticed here on the forums that if I select "Ask a Question" then I can select the "Preview" button and there will be a button to "Edit" after the preview comes up.
However if I select "New Discussion" and then "Preview", there is no "Edit" button available afterwards.
Looks like yesterday they released v4.0.0.
Hello,
I am new to datatables and I am having issues getting my webform that uses a master page to use the datatable functionality. Can anyone give me any ideas?
I have the js files included on the html and the jQuery to reference the datatables.
Thanks!
I wanted to add something to my logging so that could quickly see at a glance what the actual changes to the data were.
There's an example of logging changes here: https://editor.datatables.net/manual/php/events#Logging-changes
And a related discussion here: https://datatables.net/forums/discussion/44932
I do an additional step to compare the $prevValues and the $values and store the difference in two different fields in the database.
I add each of these events to the instance of Editor:
// Pre functions
->on( 'preEdit', function ( $editor, $id, $values ) {
getPrevValues($editor->db(), $editor->table()[0], $id);
} )
->on( 'preRemove', function ( $editor, $id, $values ) {
getPrevValues($editor->db(), $editor->table()[0], $id);
} )
// Post functions
->on( 'postCreate', function ( $editor, $id, $values, $row ) {
logChange( $editor->db(), $editor->table()[0], 'create', $id, $values );
} )
->on( 'postEdit', function ( $editor, $id, $values, $row ) {
logChange( $editor->db(), $editor->table()[0], 'edit', $id, $values );
} )
->on( 'postRemove', function ( $editor, $id, $values ) {
logChange( $editor->db(), $editor->table()[0], 'delete', $id, $values );
} )
And then I use array_intersect_key()
along with array_diff_assoc()
(in PHP) to find the difference between the two and store that in separate fields:
$prevValues = [];
function getPrevValues ( $db, $table, $id ) {
global $prevValues;
$prevValues = $db->select( $table, '*', [ 'id' => $id ] )->fetch();
}
function logChange ( $db, $table, $action, $id, $values ) {
global $prevValues;
switch ($action) {
case "create":
$old_values = [];
$new_values = $values;
break;
case "edit":
$old_values = array_intersect_key(array_diff_assoc($prevValues,$values),array_diff_assoc($values,$prevValues));
$new_values = array_intersect_key(array_diff_assoc($values,$prevValues),array_diff_assoc($prevValues,$values));
break;
case "delete":
$old_values = $prevValues;
$new_values = [];
break;
}
if (!empty($old_values) || !empty($new_values) ) {
$db->insert( 'ws_log', [
'user' => $_POST['currentUser'],
'when' => date('c'),
'table' => $table,
'row' => $id,
'action' => $action,
'same_values' => json_encode($prevValues),
'old_values' => json_encode($old_values),
'new_values' => json_encode($new_values)
]);
}
}
Now at a glance I can see 1) who made a change, 2) when it was done, 3) what table and row was it done on, 4) what type of action it was (create, edit, or delete), and 5) what the specific changes to the data were. I also have the prev_values
in case I'd like to dig deeper.
Lip Brush Lipsticks,Website:http://www.jafbrush.com,Lip Brush
Eyeliner Smudge Brush Flat Eyeliner Brushes,Website:http://www.jafbrush.com,Eyebrow And Liner Brush
M6 Mini Waterproof Connectors 2 Pole IP 67 DC For Intelligent Product Waterproof Connector,Website:http://www.waterproofplugs.com,Waterproof Connector
M8 3pin Connectors IP67 Low Voltage Waterproof Connectors For Shared Bicycle Waterproof Connector,Website:http://www.waterproofplugs.com,Waterproof Connector
M12 2 Prong 240v Waterproof Connector IP67 For LED Connector Waterproof,Website:http://www.waterproofplugs.com,Waterproof Connector
I had to sum the values only if other values are the same.
I have a table like this
item_id quantity
1 10
2 7
1 12
3 5
2 11
1 3
I had to sum the quantity with the same item_id
so: item_id (1) =sum(10, 12, 3)
First of all, it's possible using render?
Or i must use some Php function?
Thank a lot for any ideas
I have created the data table with serverside:true to load data on pagination request. But when do a search it again make call to server side, but I need it to be search locally on already fetched data.
Is it possible with data table? How the configuration should look like. Please help.
$app.global.searchDataTable = $('#searchResultTableId').DataTable( {
processing: true,
serverSide: true,
ajax: {url: "./api/search/pagination/documents", type: "POST", data:searchCriteria},
ordering: true,
//fixedHeader: true,
scroller: true,
scrollY: ($(window).height() - 435) + 'px',
scrollX: true,
scrollCollapse: true,
initComplete: function(settings, json) {
$('.dataTables_scrollBody thead tr').css({visibility:'collapse'});
},
fixedColumns: {
leftColumns: 3
}
} );
During a session with the datatable, allow a user to name and save the curent state of the table (search params,ordering etc).
These would be saved to a database. Each user would have their own list of saved states.
Later, the use could pick from a list of the saved states and restore it.
Has anyone done something like this? I imagine I would use the stateLoadCallback method to load from the database. Is this the best approach?
Thanks and Regards
Don