Hi, I have a form with an input id "table_name", How can I send this input value to the server_processing.php via Ajax POST data?
I want to change the database table name directly from the form without having to edit the php file.
Please see screenshot, any help is much appreciated.
How to post a form input value to a server process?
Date field localization issue
I have a CRUD management application, which I've obtained using the DTE generator. One of the fields is of date type, which I want to give a specific format, with these elements:
- Moment.js (included in the whole DTE package by generator)
- Plugin datetime.js (written by Allan Jardine)
- Plugin datetime-moment.js (written by Allan Jardine)
In file 'table.mapi.js' (DTE generator), I add these lines
moment.locale('es'); // Chage locale to spanish
$.fn.dataTable.moment( 'ddd, D MMM YYYY', 'en' ); // Call function to give format to datetime field -- note that if I put 'es' on locale parameter, order doesn't work (some plugin compatibility issue?)
after $(document).ready(function() {
then, I define ('fields' param of var editor) the following:
"label": "Fecha:",
"name": "fecha",
"type": "datetime",
"def": function () { return new Date();},
"format": "ddd, D MMM YYYY",
"opts": { "showWeekNumber": false, "momentLocale": 'es' }
and
"data": "fecha",
"render": function ( data, type, full, meta ) { if (type === 'display') { if (data) { var mDate = moment(data); data = (mDate && mDate.isValid()) ? mDate.format("LL") : ""; } } return data; }
('columns' param of datatables), to get date displayed on large format.
Till now, all this works fine. The problem arrives on "New" record button's hand, when I fill in the fields (selecting desired date on datepicker) and then I press "Save" button, validator shows the following error:
"Date is not in the expected format", and, obviously, doesn't perform the op (save data to mysql db).
In addition, when I select one row, in order to edit its data, the modal edit form shows the fields; but date field is still on default locale ('en').
I suposse this is due to issues with format specified in date validator, since I've left the defaults created by DTE generator (except empty field validation, that's been customized), so:
Field::inst( 'fecha' )
->validator( function ( $val, $data, $opts ) { return empty( $val ) ? 'Este es un campo requerido' : true; } )
->validator( 'Validate::dateFormat', array( 'format'=>'D, j M Y' ) )
->getFormatter( 'Format::date_sql_to_format', 'D, j M Y' )
->setFormatter( 'Format::date_format_to_sql', 'D, j M Y' ),
What's the correct validation in this case? Do I need configure some kind of i18n on PHP settings in validation module, such as Moment 'locale'?
Thanks in advance
Weird characters in Copy to Clipboard splash page
In the Buttons plugin, the Copy to Clipboard button will put up two different splash pages, depending on the amount of data being copied.
The first splash page looks fine, it will copy the text to clipboard and then tell you how many rows were copied.
The second splash page will come up and ask you to ctrl-c to copy the larger amount of data. The problem is, this splash page has some weird characters. "Press ctrl or <weird characters> + c..."
Here's a screenshot: http://imgur.com/a/qCxt3
I've tested this in the latest Chrome, Firefox on Ubuntu and Edge on Windows 10. I'm not sure if this is a charset issue on my machines, or something else? Is anyone else seeing this issue?
These are my generated includes:
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.13/b-1.2.4/b-html5-1.2.4/b-print-1.2.4/datatables.min.css"/>
<script type="text/javascript"
src="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.13/b-1.2.4/b-html5-1.2.4/b-print-1.2.4/datatables.min.js"></script>
Here is my javascript:
$('#datatable').dataTable({
"aaSorting": [[0, 'desc']],
"aLengthMenu": [[10, 50, 100, 500, -1], [10, 50, 100, 500, "All"]],
"iDisplayLength": 500,
dom: '<"col-md-2"l><"col-md-offset-5 col-md-3"B>frtip',
buttons: [
'copy', 'excel', 'csv', 'print'
]
});
pdfHTML5 export Unicode Characters not show
I have a datatable, which contains Unicode characters in cells. When I used pdfHtml5 export, the characters do not show up in the pdf file. Can someone help me please?
Unable to add additional columns due to ajax error
Hello!
At the moment I'm attempting to add another column to my page. However, I will get an ajax error whenever I do. It's fine with 10 columns, but as soon as I add the 11th, the ajax error will appear.
Here's my debugger
http://debug.datatables.net/ewolon
And the console error shows:
responded with a status of 403 (Forbidden)
One last problem, I promise. Uncaught Cannot extend unknown button type: selected
Uncaught Cannot extend unknown button type: selected.
I started another table and cant get around this error.
The table is from Generator.
Issue with Invalid JSON, yet lints clean
I'm trying to build a tabbed report using 5 datatables. I have abandoned this idea, as I have been unable to get it to work.
I have switched to single pages for each, but hitting the same issues.
3 of the tables are returning invalid JSON errors, in fact I'm getting 8+ alerts per page on the same query.
I don't understand why the JSON is not working, and why its attempting to run AJAX 8+ times per page
I've included my code here: http://live.datatables.net/jamidaza/1/edit?html,js
The example doesn't work, as it requires the php data component.
However, I've included a small working set of data below as it is returned from php/ajax
{"draw":15,"recordsTotal":"56282","recordsFiltered":"13","data":[["2","06-JUN-14","246246","246246","246246","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","246246criteria_null_value",null,"criteria_null_value",null],["3","06-JUN-14","26500?","265000","265009","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26500?criteria_null_value",null,"criteria_null_value",null],["4","06-JUN-14","26501?","265010","265019","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26501?criteria_null_value",null,"criteria_null_value",null],["5","06-JUN-14","26502?","265020","265029","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26502?criteria_null_value",null,"criteria_null_value",null],["6","06-JUN-14","26503?","265030","265039","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26503?criteria_null_value",null,"criteria_null_value",null],["7","06-JUN-14","26504?","265040","265049","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26504?criteria_null_value",null,"criteria_null_value",null],["8","06-JUN-14","26505?","265050","265059","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26505?criteria_null_value",null,"criteria_null_value",null],["9","06-JUN-14","26506?","265060","265069","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26506?criteria_null_value",null,"criteria_null_value",null],["10","06-JUN-14","26507?","265070","265079","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26507?criteria_null_value",null,"criteria_null_value",null],["11","06-JUN-14","26508?","265080","265089","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26508?criteria_null_value",null,"criteria_null_value",null],["12","06-JUN-14","26509?","265090","265099","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","26509?criteria_null_value",null,"criteria_null_value",null],["13","06-JUN-14","2651??","265100","265199","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","2651??criteria_null_value",null,"criteria_null_value",null],["14","06-JUN-14","265265","265265","265265","000-AOLIM","AOLIM-SAOLIM","AOLIM-SAOLIM","000-AOLIM","Native","265265criteria_null_value",null,"criteria_null_value",null]]}
Any assistance appreciated
Allan
Probem integrating field type plugins with datatable editor
I can't figure out why I can't integrate any field type plugins. The console always outputs **Uncaught Error adding field - unknown field type selectize** (tried select2 and CKEditor)
. I'm current running the trial version. Could this be the reason?
Currently
- script load order has the selectize.min.js loading after the dataTable.editor.min.js script
- selectize is being initialized using the fields.type option.
fields: [ {
label: "Category:",
name: "category_name",
type: "selectize"
}, {
label: "Subcategory:",
name: "subcategory_name",
type: "selectize"
}]
Input field with value from another datatable
I am pkanning to set up a small project with the editor but one field has to be filled with a value from another datatable.
E.g. ... I have table orders having general data about an order but i want to fill client data from table clients ...
So I create row in orders having a coloumn client id. When clicking on client id a popup comes up with a datatables on client table where user can search for client and selected value returns client id to editor in client id column.
how do i do that?
Regards,
Sebastian
How to bind loaded data to datatable???
I am trying to load a json which is a servlet response made by "ObjectMapper mapper" . All i do is submit a button which send a Post to a servlet and the response is a Json created by Hackson FasterXmL. I want to update the table when I get the response but have had no luck populating the table. Can Anyone Pleeease help me??
Load json data which is local in pagefrom servlet to datatable.
I am trying to load a json which is a servlet response made by "ObjectMapper mapper" . All i do is submit a button which send a Post to a servlet and the response is a Json created by Jackson FasterXmL. I want to update the table when I get the response but have had no luck populating the table. Can Anyone Pleeease help me??
Editing in Related Tables
I'm trying to port an existing web app into DataTables/Editor. Any record in the table being edited might have zero to many related records in another table. Is there any way from within an Editor form to invoke the editor again on the related table record in the related table? I'd like to be able to create a record in the related table when necessary, as well as to display the related records in that table. So far, I haven't found a way to do this within the DataTables/Editor framework.
Since this is a feasibility question, I don't have a problem pagers debug or link to. However, I can provide more detailed information if that would help someone who wants to respond.
.draw() - not working. What do I do wrong?
When the value in #table2 is modified in editor, #table1 needs to redraw as some values has change.
Therefore I have the code:
var editor = new $.fn.dataTable.Editor({
ajax: 'php/page...[some_link].... .php,
table: '#table2',
fields: [
{
"label": "something",
"name": "something"
}
]
}).on('submitComplete', function () {
var my_table = $('#tabel1').DataTable();
// my_table.ajax.reload(); - also tried as I thought it requires to refresh with data from server
my_table.draw();
});
But no success. What do I do wrong?
How to download css and js files without internet connection
I saw the external link to the respective js and css files, but my web app is not connected to the internet at all, i was wondering how i can download the datatables files?
can I develop edit option using data tables for more than 100,000 records of data.?
I have 100,000 data to edit. Previously to display the data I have used data tables server side scripting to just display and multi column filtering. Now I want to edit. How can I approach? Could you please suggest me.
Colresize is not working.
Hi All,
I am using datatable with fixed column, column resize and reorder plugins. I have total 19 columns in table. I have first four columns fixed, non re-sizable and reorder-able. I am using vertical and horizontal scrollbar functionality of datatable. I have given min-width and max-width for columns through "aoColumnDefs". I am facing following two problems.
1) If I resize my column to max width then it is not resize to min width.
2) If I am trying to resize my column to below/than min-width then neighbor column is automatically increasing to max-width.
I am attaching my datatable initialization below.
var table = $('#example').DataTable({
bDeferRender: true,
bProcessing: true,
bFilter: false,
stateSave: false,
scrollX: true,
scrollCollapse: true,
scrollY: totalCalculatedheight + "px",
paging: false,
fixedColumns: { leftColumns: 4, heightMatch: 'auto' },
ordering: false,
"bAutoWidth": false,
dom: 'C<"clear">RZlfrtip',
colResize: { exclude: [0, 1, 2, 3] },
colReorder: { fixedColumnsLeft: 4 },
"aoColumnDefs": columns});
If anybody come across this issues or faced this type of issues please send me solutions. Or you can guide me.
DT 10 - Column rendering
Hello,
In this case i need to display the content of column #5 if the value of column #2 start with "F" ...
How can i do this ?
{ render: function (data, type, row) {
if ( data.length === 0)
{return '<span class="text-danger">some text</span>';}
else if ( data.slice(0,1) == 'F' )
{return '<span class="text-danger">content of column #5</span>';}
else
{return '<span>' + data + '</span>';}
},
targets: [2]
},
Thanks a lot,
Marc
Accessing raw filter data
Hi,
Sorry In case I already asked this before but I wondered how can I access raw column data when working with filtered data with the following/other? api table.rows({filter: 'applied'})
, the data that I'm after is something like the _aFilterData
(legacy?) .
In other words, I'm looking for a way to access the columns -> render output that is being displayed in the table
I have the following test case , when I set in cumulative_filtering: true
in yadcf I'm using the table.rows({filter: 'applied'}).data().toArray();
api which does not provide me the columns -> render output, but if I set cumulative_filtering: false
I use the settingsDt.aoData
which does provide me the needed data (but that data can't be used because its not the filtered one,
Thanks ahead.
Highest id
Im looking for the highest id in the datatable regardless of whether its on this page or the next.
Im a student and new to all of this, so i apologise for my vagueness.
index column
I have include the index column code about this example: https://datatables.net/examples/api/counter_columns.html
If I load the Page the first time, the column index are shown correct. to go to the next page the column index are shown
[object OBJECT]. to go forward or back to the first page the column index did show this object. I have no idea where my problem is. Should I do this on the Server side?
Here the debug Link: debug.datatables.net/iqiriv
Andreas