Giter Site home page Giter Site logo

Comments (2)

jeffdupont avatar jeffdupont commented on July 1, 2024

Normally I use this with a separate event, whether it be an onclick of a "Filter" button or onblur of a textfield. Basically you would call out the datatable object that you want to update.

var dt = $("#link_table").data("datatable")

Once I have my element, I gather the filter data currently on the table

postdata = dt.options.filter

Then I update the properties on the filter that I want to update

postdata.search_mode = $('#search_mode').val();

Finally I call the render function to rerender the datatable without reloading the whole page.

dt.render();

On the server side, the post comes in as an associative array with filter as the main. So for PHP you would pull in the post data like so.

$filter_data = $_POST['filter'];

// $filter_data contains
array(
  "search_mode" => foo
);

Hope this helps.

from bootstrap-data-table.

PanosSynetos avatar PanosSynetos commented on July 1, 2024

Sorry to bump an old question, but it is related to an issue that I'm facing.
The above "trick" will work only if I haven't modified the post data that i'm passing.

If I add any extra post data , like the csrf token, or an ID that I want to pass

, post: {_token: "<?php echo csrf_token();?>", category_id: <?php echo $category->category_id; ?>}

then after the

dt.render();

, i check in firebug and the extra "search_mode" filter does not get posted.
If i comment out the ,post: {......} and do the same, then search_mode is posted.

Any ideas about this?

from bootstrap-data-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.