Possible to change global search variable name?

Possible to change global search variable name?

gcurrie333gcurrie333 Posts: 6Questions: 1Answers: 0

DT in server-side mode using a scripting language (MivaScript) and system (Miva Merchant) that builds page content and renders it to a browser.

The global Search variable seems to be Search. Unfortunately, Miva Merchant converts all post variables to CGI variables, and one Miva-specific variable is called... wait for it... Search. So my global search var from DataTables appears to get nullified before I can ever see it.

(Seems like the ajax post vars are a little generic - Draw, Columns, Start, Length, Order seem like they could exist already on some systems. Nice to have a way to namespace them)

Is there a way to work around this, or do I need to drop the global search when using Miva Merchant?

This question has accepted answers - jump to:

Answers

  • gcurrie333gcurrie333 Posts: 6Questions: 1Answers: 0

    Is there any way to change the global search variable name?

  • gcurrie333gcurrie333 Posts: 6Questions: 1Answers: 0

    Does anyone here have an answer?

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    Answer ✓

    Use ajax.data as a function to modify the data submitted to the server.

    Allan

  • gcurrie333gcurrie333 Posts: 6Questions: 1Answers: 0

    Brilliant! Thanks so much for responding.

    I am using the ajax.data option as a function to add my own parameters, yet I didn't realize I could 'redirect' existing data into my own params. Or at least I didn't understand that the global search value was sitting in d.search.value.

    (By the way, the ajax.data option page shows the function as having two arguments (data and settings) but the examples show only one (d). As a result, I copied and edited an example, but I clearly don't understand how and why it works. Is the disparity between arguments a documentation bug, or is it that I don't understand what's on that page? Most likely the latter!)

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    Answer ✓

    The settings object contains all the information about a DataTable instance that DataTables needs to be able to use the table (data, configuration, etc). But this object is generally considered to be private. You should never need to get information from the settings object - but it does still exist. Hence the disparity between the reference and the example. I don't want people using the settings object!

    Allan

This discussion has been closed.