Pipeline with Editor Select Options

Pipeline with Editor Select Options

trout.william@gmail.comtrout.william@gmail.com Posts: 2Questions: 0Answers: 0

I modified the Editor "joinLinkTable" example with "serverside":true. Looks great.

I added the Pipeline exactly as shown on the Datatables example "http://datatables.net/examples/server_side/" page. When the Editor window is opened for a row, the select dropdowns are all empty.

I am new to DataTables and don't know here to look.

Help!

Replies

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

    You will probably run into more problems than just the select options if you are using the pipelining example code with Editor. The main issue is that if you do and edit, when DataTables next requests the data - the pipeline will give the stale data! You would need to clear the pipeline on each create, edit or delete. Perfectly possibly using events, but it due reduce how useful pipelining actually is.

    Allan

  • trout.william@gmail.comtrout.william@gmail.com Posts: 2Questions: 0Answers: 0

    Hi Allan,

    Thanks for the response. I determined that the options can be updated after the Pipeline ajax request with:

    $.each(json.options, function (name) {
    editor.field(name).update(json.options[name]);
    });

    Is this correct?

    While what you state is true, I have an updated Pipeline with methods called from the Editor to update or delete the cached entries. By calling table.draw(), changes appear immediately on the visual row, without asking the server for an entire page of data. (Especially after a delete!)

    If the user has changed a filtered or sorted column value, they must refresh the list for the row to appear in the correct place. But usually they just want confirmation of their changes on the visual row edited. (They'll catch on quick.)

    For create operations, the Pipeline is cleared to force a server refresh to assure the new row appears where the user expects it. I suppose it could be added to the top or bottom of the cache, or inserted after/before the selected row, but that is more than I want to bite off at the moment.

    Thanks,
    Bill

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

    $.each(json.options, function (name) { editor.field(name).update(json.options[name]); });

    Yes that looks fine. Having said that, I'm slightly surprised it is needed at all - the options should really just be passed all the way through. I'll look into that.

    Sounds like you've got a good grip on the pipeline method!

    Allan

This discussion has been closed.