Filter the list in a combobox

Filter the list in a combobox

jalapejalape Posts: 117Questions: 2Answers: 1

Hi,
I want to filter the list in a combobox, from a datatable editor. When I use the where condition, I do not have any errors, but it does not return any records.

Editor::inst( $db, 'tb_diccionario' )
->field(
Field::inst( 'tb_diccionario.materia_id' )
->options( Options::inst()
->table( 'tb_materia' )
->value( 'id' )
->label( 'materia' )
->where( 'tb_materia.activo', 1 )
),
Field::inst( 'tb_materia.materia' ),

->leftJoin( 'tb_materia', 'tb_materia.id', '=', 'tb_diccionario.materia_id' )

*Activo es un campo de la tabla materia de tipo tinyint.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Could you add ->debug(true) immediately before the ->process(...) method call and then use the debugger to give me a trace please (after reloading the page) - click the Upload button and then let me know what the debug code is.

    Allan

  • jalapejalape Posts: 117Questions: 2Answers: 1

    Hi Allan,
    Muchas gracias por tu tiempo.
    I've added ->debug(true) in front of ->process($_POST) and I have not found any problem in the debugger. It just happens that the list does not show the data. I made a screenshot with and without the line: ->where( 'tb_materia.activo', 1 )
    Thank you


  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    So when you use ->where( 'tb_materia.activo', 1 ) what does the server respond with please? Can you show me the raw JSON data?

    Allan

  • jalapejalape Posts: 117Questions: 2Answers: 1

    Excuse my ignorance.
    I have tried to find a way to get the JSON data. I downloaded the plugin for Firefox: JSONView, but still I do not know how to do it.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @jalape ,

    Easiest way it go to the developer tools in the browser (F12 on both Chrome and Firefox) and look on the network tab. You'll see the JSON in the response tab.

    Cheers,

    Colin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    This tech note shows the steps you are use to get it.

    Allan

  • jalapejalape Posts: 117Questions: 2Answers: 1

    Hi,
    Thank you very much to both of you for answering.
    I have checked the browser response with raw JSON data. In the screenshot I marked with a red arrow the field with problems. In the json_without.jpg file, it does not have the where condition, and it shows the data. In the file json_with.jpg, you have the line:
    ->where( 'tb_palabra.materia', 1 )
    And it no longer shows any data.
    I have put another capture of the table, to see that there is indeed that field and that it contains data that meet that condition.



  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you copy and paste the JSON return for me please? I need to be able to see the full thing - specifically the debug object.

    Allan

  • jalapejalape Posts: 117Questions: 2Answers: 1

    Files that start with "with" have the line:
    -> where ('tb_palabra.materia', 1)
    The others do not.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I'm not sure what the two "Archive" text files are?

    Also in the docx files they show that debug(true) wasn't enabled on the server-side. I need that to be able to see the query that was being executed. If you could just send the response content as a text file, that would be great.

    Allan

  • jalapejalape Posts: 117Questions: 2Answers: 1

    The "archive" documents are taken from the import option in HAR. I add a screenshot. What I have not managed to know is how enabled on the server-side. I do not have much experience with the Firefox debugging tools.
    Thank you.

This discussion has been closed.