user7442280
user7442280

Reputation: 1

list editor with valuesURL gets 403 (no credentials sent)

I am communicating wuth a backend application that provides the data. To handle css issues I use in the config

  ajaxURL: url,
      ajaxConfig: {
        method: "GET",
        credentials: "include",
      },

so far this works.

For a list editor i am using valuesURL

but when the list editor calls the backend, it gets 403 because no credentials are sent.

can I force tabulator on calling the valuesURl to use some parameter, if so, how?

kind regards

Randy

So I tried to dynamically get values for a list editor, but tabulator does not resend credentials as in the ajax request for data. I would expect to get the list options instead of 403.

Upvotes: 0

Views: 68

Answers (1)

John Bratus
John Bratus

Reputation: 1

I know this is old and likely not relevant anymore, but if anyone else comes upon this dilema, there is a hacky solution to this by adding the AJAX params directly into the URL itself.

{title:"Test", field:"test", sorter:"string", headerFilter:"list",
            headerFilterParams:{
                valuesURL:`/testurl/filter_list.php?table=${table_name}&key=value`,
                clearable:true
        }},

Tabulator parses the url string into an AJAX url builder, so as long the only variable it recieves is the url itself, this works. The list editor allows for a remotefilter option when using autocomplete setting, and that will break this workaround, as one ends up with an url containing two ? symbols.

Also, according to documentation, the correct solution is this:

The valuesURL option is only intended for a simple GET ajax request. If you need to make a different/more complex request, then you should use the valuesLookup option and make the ajax request yourself.

https://tabulator.info/docs/6.3/edit#editor-list

Upvotes: 0

Related Questions