Complete ajax.data parameter fiddling example?

Complete ajax.data parameter fiddling example?

Rusty BallingerRusty Ballinger Posts: 21Questions: 7Answers: 0

First, to filter a large set of data on the server side, I want to initially request just a limited date range; then I want a couple of date pickers which let someone change the date range & send a new Ajax request using arguments from those guys. (I think full server-side processing is overkill for what I want; does that sound right?)

I see snippets here which show ajax.data examples, but is there a complete example which shows how to hook up a date picker or other UI component & trigger a new request with the updated arguments?

Second, for consistency, I want to use the same date picker that Editor uses when editing dates. Should I use Inline standalone editing for this? How do I get the "Update" button to trigger a reload of the table instead of a real edit?

(I apologize for what are probably bonehead-level questions.)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Answer ✓

    Hi Rusty,

    What you propose sounds like the way I would do it myself.

    You could use something like:

    ajax: {
      url: ...,
      data: function ( d ) {
        d.minDate = // get min date from whatever calendar picker you use
        d.maxDate = // likewise
      }
    }
    

    Then on the server-side use minDate and maxDate in your WHERE condition.

    Regarding the use of the same date picker that Editor uses, that isn't something that is directly supported, but it is possible. See this thread for some discussion on that.

    Allan

  • Rusty BallingerRusty Ballinger Posts: 21Questions: 7Answers: 0

    Thanks; that example helped.

    I found ajax.reload(), and was able to use that to reload the table when the user changes the date range. This table is also using individual column searching; is the callback passed to ajax.reload() the right place to rebuild those option lists, or is there something like the table's initComplete I should use? (The function I set for initComplete looks like it only fires the first time the table is loaded, not on subsequent calls to ajax.reload().)

  • Rusty BallingerRusty Ballinger Posts: 21Questions: 7Answers: 0

    Actually, never mind on that comment; I switched to text inputs, which don't have to be rebuilt after a reload.

This discussion has been closed.