Editor search with server side and mjoins does not work.

Editor search with server side and mjoins does not work.

naspersgaspnaspersgasp Posts: 53Questions: 14Answers: 1

Hi,

Good day.

I've disabled searching and ordering on the client side with:

columnDefs: [
        {
          "searchable": false,
          "targets": 6
        },
        {
          "orderable": false,
          "targets": 6
        }
]

But the server side still fails with the "Unknown field: Image (index 6)" error. On the client I can see the ordering is disabled. But the searching on that column still happens on the server side.

Any idea? Thanks.

Regards.

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 9,520Questions: 0Answers: 1,576

    Hi @naspersgasp ,

    If searchable is set alongside serverSide, then the searchability of each column is sent to the server within the Ajax request. It's up to the server side script to then use that information and return the matching data appropriately.

    Cheers,

    Colin

  • naspersgaspnaspersgasp Posts: 53Questions: 14Answers: 1

    Hi,

    Thanks @colin.

    The server side processing is handled by the editor NodeJS library supplied . I'm not handling it manually. I just use the editor module supplied.

    Regards.

  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin

    Thanks for the clarification. I'm afraid that the server-side libraries do not currently support search on the MJoined columns. Search needs to be disabled for them using the columns.searchable option.

    Alternatively, if you have less than tens of thousands of rows, just disable server-side processing. The client-side will be able to search them okay.

    Allan

  • naspersgaspnaspersgasp Posts: 53Questions: 14Answers: 1

    Hi,

    Good day.

    What I am saying is that I am disabling them. But having them disabled does not exclude the option from being sent to the server from the client. If that makes sense? I think the client should not send the column info to the server if it is set as not searchable and not orderable.

    I'll see if I can't remove the options on the server side for now. Maybe that will solve the issue in the short term.

    Regards.

  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    Answer ✓

    I see what you mean. The client side should also be seeing a searchable flag for the columns (which is the value of columns.searchable). So the server-side script should be checking to see if the column is marked as searchable or not before attempting to do any searching on it.

    Allan

  • naspersgaspnaspersgasp Posts: 53Questions: 14Answers: 1

    Yup, the change is needed on the Node JS server side.

    It is at line 1410:

    if (http.columns[i].searchable !== 'false') { 
    

    and line 1423:

    if (search !== '' && column.searchable !== 'false') {
    

    of editor.js

    The test for false was incorrect. When I have a chance, I'll create a PR. Thanks.

    Regards.

  • allanallan Posts: 52,493Questions: 1Answers: 8,010 Site admin
    Answer ✓

    Thanks! I'm with you now - and thanks for the PR. It has been merged in and will be in the next release.

    Allan

This discussion has been closed.