Unknown field: (index 0)

Unknown field: (index 0)

omurltsomurlts Posts: 35Questions: 6Answers: 0
edited September 2018 in Free community support
var editor;
$(document).ready(function() {
  var table = $('#datalistesi').DataTable({
    pageLength   : 10,
    lengthChange : false,
    select       : true,
    deferRender  : true,
    language     : {"url": "assets/plugins/datatables/tr.lang"},
    ajax: {
      url: "staff.php",
      type: "POST"
    },
    searchCols : [],
    serverSide: true,
    columnDefs : [
      {
        targets : 0,
        render : function (data) {
          return data.mod_datalistesi.id;
}
      },
      {
      }
    ],
    columns: [
      { data: null },
      { data: "mod_datalistesi.id" },
      { data: "mod_datalistesi.firma" }
    ],
    ///stateSave: true,
    order : [[1, 'desc']]

  });
});

hello server side data return but searching give error How can I fix

Answers

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @omurlts ,

    You would normally get that error when the data being returned doesn't match the columns that are defined. Could you post the Ajax response, please, or better still, point to a page that demonstrates the problem?

    Cheers,

    Colin

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018

    hello @colin

    thanks for answering. im fix this problem but im have new problem

    ->leftJoin( 'mod_cagri_cagrilistesi', 'mod_cagri_cagrilistesi.arama_id', '=', 'mod_cagri_aramalistesi.id' )

    im want mod_cagri_cagrilistesi last arama_id how selecting this

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    I don't understand what you mean I'm afraid. Could you elaborate please?

    Thanks,
    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    hello @allan

    1- ) how make editor in group by

    2-) Client Side working this code (two value filter)

    table.columns(2).search(f_data_select .join("|"), true,false).draw();

    but server side not working

    what should I do

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    1- ) how make editor in group by

    There is no option to use the current PHP, NodeJS or .NET libraries with a GROUP BY command. You would need to use a VIEW.

    2-) Client Side working this code (two value filter)

    The current PHP, NodeJS and .NET libraries do not currently support regular expression search I'm afraid.

    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    :S im so much tired...

    im want ask new!

    1-) im how range two date filter (server side) !! any example have ?

    2-) im need multi select data (server side)

    im how make this pls give me example ...

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    1-) im how range two date filter (server side) !! any example have ?

    I don't have an example of that specifically. However, this example shows how you can send extra data to the server (in this case the date values) and use a condition in whatever server-side script you are using (are you using any of the provided libraries?) to perform that search. Then just call draw() when the date is changed for the filter.

    2-) im need multi select data (server side)

    This would need to be implemented with some custom code. If you can tell me what server-side libraries you are using, I'll be able to point you to the documentation showing how to perform custom queries.

    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018

    hello @allan im have editor licence.

    This would need to be implemented with some custom code. If you can tell me what server-side libraries you are using, I'll be able to point you to the documentation showing how to perform custom queries.

    im using editor library and mysql database...

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    Thanks - assuming you are using the PHP libraries, the documentation for how to perform custom conditions is available here. Similar docs are available for the .NET and NodeJS libraries.

    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    it would be better if it was a sample code block

    thanks @allan

This discussion has been closed.