Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all 82258 articles
Browse latest View live

how can get contact?

$
0
0

i my name is mawdo kanteh live in Luanda Angola i need cheaper callback


Link Table is not being populated, what am I doing wrong?

$
0
0

I've been trying to figure this out for a while but can't seem to put my finger on it. I currently have a database structure as follows (with fake data):

-------------------    -----------------    -------------------
|     reviews     |    |    images     |    | reviews_images  |
-------------------    -----------------    -------------------
| id_rev |  name  |    | id_img | url  |    | rev_id | img_id |
-------------------    -----------------    -------------------
|   1    | Doom   |    |   1    | http |    |   2    |   1    |
|   2    | Doom 2 |    |   2    | http |    |   2    |   2    |
|   3    | Doom 3 |    |   3    | http |    |   2    |   3    |
-------------------    -----------------    -------------------

When I add a new record to the list it adds the records for both the reviews and the images table. For some strange reason the link table (reviews_images) does not get update and is left completely blank. Once the tables loads the new data I have the review data showing but with the blank spot where the image should be.

As the image table is being populated (and the file subsequently uploaded to the correct directory), I assume that the link table is working and doing its job during processing, but why it isn't during data injection I don't know. This is what I have for my server script (irrelevant parts left out):

Editor::inst($db, "reviews", "id_reviews")
    ->fields(
        Field::inst("reviews.id_reviews"),
        Field::inst("reviews.name")                 -> validator("Validate::notEmpty"),
        Field::inst("reviews_images.reviews_id")    -> options("reviews", "id_reviews", "id_reviews"),
        Field::inst("reviews_images.images_id")     -> options("images", "id_images", "id_images"),
        Field::inst("images.id_images")             -> setFormatter("Format::ifEmpty", null)
                                                    -> upload(Upload::inst($_SERVER["DOCUMENT_ROOT"]."/uploads/__ID__.__EXTN__")
                                                        -> db("images", "id_images", array(
                                                            "filename"      => Upload::DB_FILE_NAME,
                                                            "filesize"      => Upload::DB_FILE_SIZE,
                                                            "web_path"      => Upload::DB_WEB_PATH,
                                                            "system_path"   => Upload::DB_SYSTEM_PATH
                                                        ))
                                                        -> validator(function($file) {
                                                            return $file["size"] >= 500000 ?
                                                                "Files must be smaller than 500KB" :
                                                                null;
                                                        })
                                                        -> allowedExtensions(array("png", "jpg", "bmp", "gif"), "Please upload an image")
                                                    )
    )
    ->leftJoin("reviews_images", "reviews.id_reviews", "=", "reviews_images.reviews_id")
    ->leftJoin("images", "images.id_images", "=", "reviews_images.images_id")
    ->process($_POST)
    ->json();

Any ideas on what could be causing the issue from this? If need be my SQL syntax is the following (and works 100%):

// Loading data
SELECT
    reviews.id_reviews,
    reviews.name,
    images.url
FROM reviews
LEFT JOIN reviews_images
    ON reviews.id_reviews = reviews_images.reviews_id
LEFT JOIN images
    ON images.id_images = reviews_images.images_id

Editor 1.6.1 PHP Options error

$
0
0

Hi,

Since ver. 1.6.1 all of my tables stopped working because I used options. I tried one of the examples from the datatables.net, but it gives me the same error. Did I miss something when I updated the version? What can be the solution for this error?

I tried https://editor.datatables.net/examples/inline-editing/join.html

Fatal error: Uncaught exception 'ReflectionException' with message 'Class DataTables\Editor\Options does not have a constructor, so you cannot pass any constructor arguments' in /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php:50
Stack trace:

newInstanceArgs(Array)">newInstanceArgs(Array)">0 /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php(50): ReflectionClass->newInstanceArgs(Array)

1 /virtual/111.89.201.247/ssl/home/example/examples/php/join.php(26): DataTables\Ext::inst()

2 {main}

thrown in /virtual/111.89.201.247/ssl/home/example/php/Ext/Ext.php on line 50

// DataTables PHP library
include( "../../php/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;


/*
 * Example PHP implementation used for the join.html example
 */
Editor::inst( $db, 'users' )
    ->field(
        Field::inst( 'users.first_name' ),
        Field::inst( 'users.last_name' ),
        Field::inst( 'users.phone' ),
        Field::inst( 'users.site' )
            ->options( Options::inst()
                ->table( 'sites' )
                ->value( 'id' )
                ->label( 'name' )
            )
            ->validator( 'Validate::dbValues' ),
        Field::inst( 'sites.name' )
    )
    ->leftJoin( 'sites', 'sites.id', '=', 'users.site' )
    ->process($_POST)
    ->json();

Editor Buttons Not Showing

$
0
0

Dear Allan,

if I use this markup the editor button works perfectly

var otable = $('#dt_Table').DataTable({
                dom: 'Bfrtip',
                ajax: {
                    url: '/api/Controllers/Methods',
                    type: 'POST'
                },
                columns: [
                    { data: "_id" },
                    { data: "_code" }
                ],
                select: true,
                buttons: [
                    { extend: "create", editor: editor },
                    { extend: "edit", editor: editor },
                    { extend: "remove", editor: editor }
                ]
            });

but if I use

"sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6 hidden-xs'f><'col-sm-6 col-xs-12 hidden-xs'<'toolbar'>>r>" +
                        "t" +
                        "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>",

instead of

dom: 'Bfrtip',

The Editor button not show,

Can you please help me on this ?

Big data, slow

$
0
0

Hello, I do not speak English!

I use Datatables.net, thank you very much.
But I have a problem!
For very loaded data, the page load time is long, the problem occurs when the page loads, the slowness of the page loading.

How can I solve this problem?

I did not understand that !
https://datatables.net/examples/server_side/simple.html

Do you have a sample file?

thank you very much

Beginner Question: How do I make an AJAX call?

$
0
0

Sorry for this basic question.. but I can't figure out by myself how to apply the explanations given on this site about Ajax to my Datatable.

I have a text box near my Datatable. It has CSS Class "num_items". When I type a value in it makes another Ajax call and redraws the Datatable based on a query result from the database and server side processing:

$("input[type='text'].num_items").focusout( function() {
    oTable.fnDraw();
} );

I use Datatables "fnServerData": parameter within the var oTable = $("#mydatatable").dataTable( {.....}); call to send the value in the text box to server side processing to ultimately query the database...

        "fnServerData": function ( sSource, aoData, fnCallback ) {
                aoData.push( { "name": "min_qty", "value": $("#minQty").val() } );
                aoData.push( { "name": "max_qty", "value": $("#maxQty").val() } );
                $.ajax( {
                    "dataType": 'json',
                    "type": "GET",
                    "url": sSource,
                    "data": aoData,
                    "success": fnCallback
                } );
            }

But now I want to do something a bit different. I have a PopUp overlay that I want to display values in based on the row in the datatable that the user clicks on. I want to query the database to get this additional info and will need to send a unique identifier from the row that was clicked on. So basically I need to do an Ajax call but I don't know how to!

Can I do something like this? When the row is clicked on I want to make a query to the database but without having to use oTable.fnDraw(); which would make a full resort and re-filter of the table.

    $(document).on("click","table.display td.drug_name", function() {

               "fnServerData": function ( sSource, aoData, fnCallback ) {
                     aoData.push( { "name": "min_qty", "value": $("#minQty").val() } );
                     aoData.push( { "name": "max_qty", "value": $("#maxQty").val() } );
                     $.ajax( {
                         "dataType": 'json',
                         "type": "GET",
                         "url": sSource,
                         "data": aoData,
                         "success": fnCallback
                     } );
                 }


        $('#my_popup').popup('show');
    });

Finally, with serverside processing I'm used to having the line:

echo json_encode( $output );

.. which someone magically returns the query result from the database and Datatables knows how to display that in the table. But in my case here, how would I capture the query result in my jQuery onclick Row function..

$(document).on("click","table.display td.drug_name", function() {
..
Want to make Ajax call here and get result back here also !!
..
});

Sorry for the long winded question!

Thank you in advance.

Edit Tables - Column Default Contents - link based on field Value

$
0
0

Hi Everyone

I've created a edit table with a button in the last column (a hef control) which is linked to a page called /system/maintainStandardAnswers.php what I need to do is pass the page the parameter id with the value held in the table tblQuestionBankQuestions and the field ID - tblQuestionBankQuestions.id :neutral:

var table = $('#example').DataTable( {
dom: "Bfrtip",
ajax: "../server_side/scripts/ET_questionsBank.php",
iDisplayLength: 25,
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
{ data: "tblQuestionBankQuestions.question" } ,
{ data: "tblquestionTypes.questionType", editField: 'tblQuestionBankQuestions.questionType' } ,
{ data: "tblQuestionBankQuestions.projectField" } ,
{ data: null,
className: "centre",
// defaultContent: '<a href="" class="editor_edit">Edit</a> / <a href="" class="editor_remove">Delete</a>'
defaultContent: '<a href="/system/maintainStandardAnswers.php"><input id="maintainAnswers" name="maintainAnswers" value="Maint. Answers" class="btn btn-primary" readonly /></a>'
],
order: [ 1, 'asc' ],

Is there a way of adding this to the a href?

e.g.

defaultContent: '<a href="/system/maintainStandardAnswers.php?ID=' + tblQuestionBankQuestions.id +'"><input id="maintainAnswers" name="maintainAnswers" value="Maint. Answers" class="btn btn-primary" readonly /></a>'

Thank you in advance of anyhelp you can give.

possible regression with Editor.dependent() 1.6.1

$
0
0

This is related to https://datatables.net/forums/discussion/38027/use-of-options-instead-of-dependant

At least my code has regressed. Not sure if I was doing something nonstandard or not to cause this. I am sending you credentials by email so you can access http://sandbox.scoretility.com/raceresultservices

In this page with Editor 1.5.5, when clicking New, the first select would have values from http://sandbox.scoretility.com/servicecredentials Service Name field, through retrieving by ajax.

In 1.5.5, dataTables.editor.js code starting at line 2260 fires, but in 1.6.1 code starting at 2446 does not.

Because of the way my code is structured it's inconvenient for me to have both releases running at the same time. Let me know if I need to put 1.5.5 online for you to compare behavior.


How can i bind or append datas from my temporary datatable(dt) to Datatables.

$
0
0

Hi,
am using normal asp.net webpage(not MVC) to display some datas from sql server. At present am using gridview to display things. I found Datatable is a great tool to display my datas. Its having lots of inbuilt features.
As now am calling datas from back-end and stored it in a temporay storage i.e, datatable(dt). From there i bind it to gridview.
I would like to know how to bind those datas to this Datatables(with or without that gridview).

Datatable buttons not working on webpack

$
0
0

I'm new with webpack and i'm trying to move my existing project to webpack enviroment, i managed to get everything to work beside the Datatable.
The Datatable object is working fine besides the export buttons.

I'm working with webpack version 1.14.0 and Datatable version 1.10.13.
I have installed modules: datatables, datatables.net, datatables.net-bs, datatables.net-buttons, datatables.net-dt.

I tryed the following steps from this issue:
https://datatables.net/forums/discussion/32542/datatables-and-webpack

  1. I tryed to use the same js files that i'm using on my original project but that didnt work.

  2. I have followed swinc solution as mentioned by this link:
    https://gist.github.com/swemaniac/2fbe5d6d5e425b7c046168b6d6e74e95
    I added the next loader to my loaders in the config file:
    {test: /datatables\.net.*/, loader: 'imports?define=>false'}

I have added the folowing lines on my main script:

import 'datatables.net';
import dt from 'datatables.net-bs';
dt(window, $);

That solution didnt work and output this error message even though i'm using jQuery:
Uncaught TypeError: Cannot set property '$' of undefined

3/
I have followed swinc solution as mentioned by this linke:
stackoverflow.com/questions/29302742/is-there-a-way-to-disable-amdplugin

I installed imports-loader and add to my loaders in the config file:
{ test: /myjsfile.js/, loader: 'imports?define=>false'}

That selution didnt work too.

Can someone know how to load Datatable with full export button plugin, or can tell me what i'm doing wrong.

error in buttons.datatables.css | dt-button-background {z-index: 2001} covers the dropdown-menus.

$
0
0

div.dt-button-background {z-index: 2001}

The dropdown-menus z-index is only 1000 so when using column visibility on datatables the columns menu gets under the shadow of dt-button-background not allowing to choose options on the dropdown-menu, I fixed it creating the class on my side and moving the z-index of the dropdown-menu to 2002 so the datatables column visibility selector (dropdown-menu) can be operational, I dont know if this can help someone else or datatable team to fix it.

Andro Jesus********

On Some Computer Datatable export File is not working ??

$
0
0

print and copy are working fine but export in pdf, excel and csv is not working , when i click on export option pop up are come but background colur is changed automatically it not in black look like a screen is gone .

PostCreate, PostEdit and PostRemove logging to save on other database

$
0
0

I want to PostEdit to save logging on other database and no save to same database !

function logChange ($db, $action, $id, $values) {
            $db->insert('logs', array(
                'user'      => $_SESSION['user'],
                'action'          => $action,
                'values'       => json_encode($values),
                'row'         => $id,
                'date'         => date('d.m.Y')
            ));
}

...

->on('postCreate', function ($editor, $id, $values, $row) {
            logChange($editor->db(), 'create', $id, $values);
        })
        ->on('postEdit', function ($editor, $id, $values, $row) {
            logChange($editor->db(), 'edit', $id, $values);
        })
        ->on('postRemove', function ($editor, $id, $values) {
            logChange($editor->db(), 'delete', $id, $values);
        })
        ->process($_POST)
        ->json();

Please help me and thank you very much.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Datatable ColResize along with Individual column search and column filter

$
0
0

Greetings,

I am trying to use datatables along with individual column search and column visible. I am using the colResize plugin from
https://github.com/Silvacom/colResize
However, I am not able to resize because of the individual column search filter.
Here is my code


// Setup - add a text input to each footer cell var div_footer = divId+' tfoot th'; $(div_footer).each( function () { var title = $(div_footer).eq( $(this).index() ).text(); $(this).html( '<input type="search" placeholder="Search '+title+'" class="dataTables_filter form-control col-xs-2"/>' ); } ); table = $(divId).DataTable({ autoWidth: true, "pagingType": "simple", stateSave: true, columns: columns, "dom": "T<'col-sm-2'<'profile_list'>><'col-xs-6 col-sm-2'f>Z<'col-xs-6 col-sm-2'C>t<<'col-sm-3'l><'col-sm-3'i><'col-sm-3'p>>", "language": { "search": "" }, //responsive: true, scrollX: true, "ajax": { // "dataType": 'json', "url": url, "dataSrc": function ( json ) { //Make your callback here. return json.data; }, "type": "GET" }, "oTableTools": { "aButtons": [ { // "sButtonClass": 'add btn-info btn-xs', "sExtends": "print", }, { // "sButtonClass": 'add btn-info btn-xs', "sExtends": "collection", "sButtonText": "Download <i class=\"fa fa-angle-down\"></i>", "aButtons": ["csv", "xls", "pdf"] } ] }, colVis: { buttonText: "<span class='glyphicon glyphicon-th'></span>", "bRestore": true, "activate": "click", "label": function ( index, title, th ) { return (index+1) +'. '+ title; } }, "colResize": { "tableWidthFixed": false // "rtl": true } // colReorder: true }); //The following will maintain the filters available in the individual column search boxes var state = table.state.loaded(); if ( state ) { table.columns().eq( 0 ).each( function ( colIdx ) { var colSearch = state.columns[colIdx].search; if ( colSearch.search ) { $( 'input', table.column( colIdx ).footer() ).val( colSearch.search ); } } ); table.draw(); } // The following will apply the search for each individual column table.columns().every( function () { var column = this; $( 'input', this.footer() ).on( 'keyup change', function () { if(this.value != null && this.value != undefined){ var val = this.value.trim(); var arr = val.split('&'); var pattern = val; if(arr != null && arr.length>1){ pattern = ''; pattern = pattern + (arr[i]).trim(); }//End of if-loop column .search(pattern, true, false) .draw(); } }); // } });

Thanks.

Trouble with Editor fieds select

$
0
0

I'm using the Datatables Editor with a field select for two tables with the data of the examples. I've built a seletc field with the name of the city. Cities are in a different table from the one with staff names, In the staff table I have a field which is id_ciudad (the id of the city in the cities table).
The trouble is that I can't get the right city seleceted. It aways appears selected Edimburgh, even if that is not the city o the member of the staff I'm editing. The Editor object has been created in the following way:

        var objetoEditor = new $.fn.dataTable.Editor({
            ajax: 'crud_editor_04.php',
            table: '#tabla_de_personal',
            idSrc: 'id',
            i18n: {
                create: {
                    button: "Nuevo",
                    title:  "Crear nuevo registro",
                    submit: "Grabar"
                },
                edit: {
                    button: "Editar",
                    title:  "Editar registro",
                    submit: "Actualizar"
                },
                remove: {
                    button: "Borrar",
                    title:  "Borrar registro",
                    submit: "Borrar",
                    confirm: {
                        _: "¿Estás seguro de eliminar estos %d registros?",
                        1: "¿Estás seguro de eliminar este registro?"
                    }
                },
                multi: {
                    title: "Múltiples valores",
                    info: "Los registros seleccionados contienen diversos valores para este campo. Para editar este campo con el mismo valor en los registros seleccionados, pulsa aquí. En caso conterario, los registros mantendrán sus valores individuales en este campo.",
                    restore: "Restaurar los valores múltiples",
                    noMulti: "Esta entrada puede ser modificada individualmente, pero no como parte de un grupo."
                },
                datetime: {
                    previous:   'Anterior',
                    next:       'Siguiente',
                    months:     ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                    weekdays:   ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb']
                }
            },
            fields: [
                {label: 'Nombre:', name: 'personal.nombre', attr: {class:'form-control'}},
                {label: 'Apellido:', name: 'personal.apellido', attr: {class:'form-control'}},
                {label: 'Cargo:', name: 'personal.cargo', attr: {class:'form-control'}},
```             {```
```                 label: 'Ciudad:', ```
```                 name: 'personal.id_ciudad',```
```                 attr: {class:'form-control'}, ```
```                 type: "select", ```
```                 options: [```
```                     {label:'Edinburgh', value:'1'},```
```                     {label:'London', value:'2'},```
```                     {label:'New York', value:'3'},```
```                     {label:'San Francisco', value:'4'},```
```                     {label:'Sidney', value:'5'},```
```                     {label:'Singapore', value:'6'},```
```                     {label:'Tokyo', value:'7'}```
```                 ]```
```             },```
                {
                    label: 'F. Ingreso:',
                    name: 'personal.fecha_de_ingreso',
                    type: 'date',
                    def: function(){return new Date();},
                    dateFormat: 'dd-mm-yy',
                    attr: {readonly:true, class:'form-control', style:'display:inline'},
                    opts:{
                        buttonImage:'editor/images/calendar.png',
                        buttonImageOnly: true,
                        buttonText: 'Elegir fecha',
                        dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
                        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
                        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'],
                        firstDay: 1,
                        monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                        monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
                        changeMonth: true,
                        changeYear: true,
                        prevText: "Anterior",
                        nextText: "Siguiente"
                    }
                },
                {
                    label: 'Salario anual:',
                    name: 'personal.salario_bruto_anual',
                    attr: {class:'form-control'},
                    fieldInfo: 'El salario debe ir como valor numérico, con dos decimales (incluso si son 00), separados por un punto.'
                },
            ]
        });

How can I mark an option of the select field as selected? I've tried def: 'personal.id_ciudad', def:'ciudades.id' and def:'ciudades.id' but nothing works. No preselected option in my select.

I've bought a single developer License today, for the case it is a trial limitation, but it does not work all the same.

Can someone help me?

Thanks a lot everyone.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.


DataTable refuses to populate

$
0
0

The below listed code is almost exactly out of the DataTables.Net documentation.

I make an Ajax call to the server, code below, and the table does Not Populate

HTML

    <table width="100%" id="example" cellspacing="0" class="display">
        <thead>
            <tr>
                <th>comp_name</th>
                <th>addr_Address1</th>
                <th>addr_State</th>
                <th>pers_FirstName</th>
                <th>pers_LastName</th>
                <th>pers_Gender</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 2</td>
            </tr>
            <tr>
                <td>Row 2 Data 1</td>
                <td>Row 2 Data 2</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <th>comp_name</th>
                <th>addr_Address1</th>
                <th>addr_State</th>
                <th>pers_FirstName</th>
                <th>pers_LastName</th>
                <th>pers_Gender</th>
            </tr>
        </tfoot>
    </table>

JavaScript code:

      var myTable = $('#example').DataTable( {
          ajax: { url: "/api/PatientData/SearchPatientRecord"
                   },
        columns: [
        { data: "comp_name" },
        { data: "addr_Address1" },
        { data: "addr_State" },
        { data: "pers_FirstName" },
        { data: "pers_LastName" },
        { data: "pers_Gender" }
        ]
       } );

server code:

public class PatientRecord
{
    public string comp_name { get; set; }
    public string addr_Address1 { get; set; }
    public string addr_State { get; set; }
    public string pers_FirstName { get; set; }
    public string pers_LastName { get; set; }
    public string pers_Gender { get; set; }

    public PatientRecord() { }

}


public class PatientRecordList
{
    public long draw { get; set; }
    public int recordsTotal { get; set; }
    public int recordsFiltered { get; set; }
    public PatientRecordList() { }
    public List<PatientRecord> data = new List<PatientRecord>();
}



        PatientRecord prcd = new PatientRecord();

        prcd.addr_Address1 = "1st street";
        prcd.addr_State = "NY";
        prcd.comp_name = "Trump";
        prcd.pers_FirstName = "Betty";
        prcd.pers_Gender = "F";
        prcd.pers_LastName = "Smith";


        PatientRecordList prcdLst = new PatientRecordList();

        prcdLst.data.Add(prcd);

        prcdLst.recordsTotal = 75;
        prcdLst.recordsFiltered = 0;
        //          prcdLst.draw = Convert.ToInt64(variables[2]);
        prcdLst.draw = 1;

        return JsonConvert.SerializeObject(prcdLst);

Initialize data table using array containing data converted from json

$
0
0

Hi, I am having JSON data which I am converting into array but when I tried to initialized data table using this array,it showed nothing in the table.
`var dataSet=[{},{},{}];
var arr=$.map(dataSet, function(e1){
return e1;
})

$(document).ready(function(){
var table=$('#example').Datatable({
data:arr
});
});
`

Name:'push' creates empty select field

$
0
0

In Editor if the select column name is "push" it seems to create an empty select field.

For example:

{ label: 'Alert Type',  name: 'push', fieldInfo: 'Push notification or in-app alert', type: 'select',
                    options: [
                        { label: "Push Notification", value: 1 },
                        { label: "In-App Alert", value: 0 },
                    ], "default": 1,
                },

Once I changed the column name to "is_push" (or anything else) I had no issues.

Place Button-Collection above parent button

$
0
0

Hello,

I placed the buttons below my table, using the dom element. The colvis and page button open a button collection that is placed below the parent button, as seen in the picture. Is there a way to place these button collections above their parent buttons?

Server-side script: It works with mysql and I can't make it work with sqlite...

$
0
0

/* Database connection start */
$dsn = 'sqlite:/usr/share/nginx/html/sqliteent/dbent.db';
try {
$sqlite_db = new PDO($dsn);

} catch(PDOException $e) {
exit;
}

// storing request (ie, get/post) global array to a variable
$requestData= $_REQUEST;

$columns = array(
// datatable column index => database column name
0 =>'id',
1 =>'nome',
2 =>'cmt',
3 =>'mrid'
);

// getting total number records without any search
$sql = "SELECT id, nome, cmt, mrid ";
$sql.=" FROM acao";

$query = $sqlite_db->query($sql) or die("acao_table_data_sqlite.php: get acao");
$totalData = count($query->fetchAll()); // para resgatar todo o array
$totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.

$sql = "SELECT id, nome, cmt, mrid FROM acao";
$sql.= "";
if( !empty($requestData['search']['value']) ) { // if there is a search parameter, $requestData['search']['value'] contains search parameter
$sql.=" AND ( id LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR nome LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR cmt LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR mrid LIKE '" . $requestData['search']['value'] . "%' ) ";
}

$query = $sqlite_db->query($sql) or die("acao_table_data_sqlite.php: get acao");
$totalFiltered = count($query->fetchAll()); // when there is no search parameter then total number rows = total number filtered rows.

$sql. = " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " ";

/* $requestData['order'][0]['column'] contains colmun index, $requestData['order'][0]['dir'] contains order such as asc/desc */
$query = $sqlite_db->query($sql) or die("Erro no sql: acao_table_data_sqlite.php: get acao");
$totalFiltered = count($query->fetchAll()); // when there is no search parameter then total number rows = total number filtered rows.

$data = array();

foreach ($sqlite_db->query($sql) as $row) { // preparing an array
$nestedData=array();

$nestedData[] = $row["id"];
$nestedData[] = $row["nome"];
$nestedData[] = $row["cmt"];
    $nestedData[] = $row["mrid"];

$data[] = $nestedData;

}

$json_data = array(
"draw" => intval( $requestData['draw'] ), // for every request/draw by clientside
"recordsTotal" => intval( $totalData ), // total number of records
"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching,
"data" => $data // total data array
);

echo json_encode($json_data); // send data as json format

<?php > ?>
Viewing all 82258 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>