Expression where of sql in iniline editor

Expression where of sql in iniline editor

recibeTodorecibeTodo Posts: 7Questions: 2Answers: 1

hello I would urgently appreciate help in this problem.

I'm getting a data by url when I put it in staff.php does not receive it, what could I do...

When this is working well,

->where( 'id', 4546)

when I replace with the variable that comes in the url it does not work

->where( 'id', $_GET['valor']).

Missing something in javascript?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,331Questions: 1Answers: 10,436 Site admin

    Without being able to see the Javascript I can't say for certain. Can you give me a link to a page showing the issue, or show your Javascript for DataTables and Editor please?

    My guess is that you don't have a ?valor=... parameter on the Ajax url for one (or both) of DataTables and Editor.

    Allan

  • recibeTodorecibeTodo Posts: 7Questions: 2Answers: 1

    Hello Allan, thank you for answering.

    $(document).ready(function() {
        editor = new $.fn.dataTable.Editor( {
            ajax: "../php/staff.php",
            table: "#example",
            fields: [ {
                    label: "Progresivo:",
                    name: "dettagli.progresivo"
                }, {
                    label: "Descrizione:",
                    name: "dettagli.descrizione"
                }, {
                    label: "Base Asta:",
                    name: "dettagli.prezzo"
                }, {
                    label: "Ubicazione:",
                    name: "dettagli.ubicazione"
                }, {
                    label: "Acquirente:",
                    name: "dettagli.idClienti",
                    type: "select"
                    
                }, {
                    label: "Data Vendita:",
                    name: "dettagli.data_vendita",
                    type: "datetime"
                }, {
                    label: "Aggiudicazione:",
                    name: "dettagli.aggiudicazione",
                }, {
                    label: "Nº fattura:",
                    name: "dettagli.fattura"
                }, {
                    label: "Data fattura:",
                    name: "dettagli.data_fattura",
                    type: "datetime"
                }, {
                    label: "Data reso:",
                    name: "dettagli.data_reso",
                    type: "datetime"
                }
            ]
    
        } );
        $('a.editor_create').on('click', function (e) {
            e.preventDefault();
     
            editor.create( {
                title: 'Create new record',
                buttons: 'Add'
            } );
        } )
    
        //Activate an inline edit on click of a table cell
        $('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
            
            editor.inline( this, {
                    buttons: { label: '>', fn: function () { this.submit(); } }
                } );
        });
    
    
        $('#example').DataTable( {
            responsive: true,
            dom: "Bfrtip",
            ajax: "../php/staff.php",
            columns: [
                {
                    data: null,
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false
                },
                { data: "dettagli.progresivo" },
                { data: "dettagli.descrizione" },
                { data: "dettagli.prezzo", render: $.fn.dataTable.render.number( '.', ',', 2, '$' ) },
                { data: "dettagli.ubicazione" },
                //{ data: "dettagli.idClienti" },
                { data: "clienti.nome", editField: "dettagli.idClienti" },
                { data: "dettagli.data_vendita" },
                { data: "dettagli.aggiudicazione", render: $.fn.dataTable.render.number( '.', ',', 2, '$' )  },
                { data: "dettagli.fattura" },
                { data: "dettagli.data_fattura" },
                { data: "dettagli.data_reso" },
    
            
                
            ],
            order: [ 1, 'asc' ],
            select: {
                style:    'os',
                selector: 'td:first-child'
            },
        
    
    
  • recibeTodorecibeTodo Posts: 7Questions: 2Answers: 1
    Answer ✓

    It seems that I have solved this in this way

    $(document).ready(function() {
        editor = new $.fn.dataTable.Editor( {
            ajax: "../php/staff.php?id=<?php echo $_GET['valor']; ?>",
            table: "#example",
    
    
    
    $('#example').DataTable( {
            responsive: true,
            dom: "Bfrtip",
            ajax: "../php/staff.php?id=<?php echo $_GET['valor']; ?>",
            columns: [
    
    
This discussion has been closed.