Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Pager only works with input type search or text

$
0
0
<form method="get" action="@Url.Action("Index")" data-cfdb-ajax="true" data-cfdb-target="#stasjonListe"><input type="search" placeholder="Search" name="searchTerm" /></form><form method="get" action="@Url.Action("Index", "Stasjoner", new {regionTerm = 1 })"
data-cfdb-ajax="true" data-cfdb-target="#stasjonListe"><input type="button" name="regionTerm" value="Test" /></form>

So when i click on page 2, the querystring is ?page=2&searchTerm=

If i change regionTerm input to type="search\text" the querystring is ?page2&searchTerm=&regionTerm=

Here is my Ajax\jquery code:

    var ajaxFormSubmit = function () {
        // grab a reference to the form to be submitted
        var $form = $(this);
        // options object
        var options = {
            // url we are going to
            url: $form.attr("action"),
            //type of request to make
            type: $form.attr("method"),
            // data to send to server
            data: $form.serialize()
        };

        // make async call
        $.ajax(options).done(function (data) {
            // target to update
            var $target = $($form.attr("data-cfdb-target"));
            // replace target with anything from server
            var $newHtml = $(data);$target.replaceWith($newHtml);$newHtml.effect("highlight");
        });

return false;
};
var getPage = function () { var $a = $(this); var options = { url: $a.attr("href"), data: $("form").serialize(), type: "get" };$.ajax(options).done(function (data) { var target = $a.parents("div.pagedList").attr("data-cfdb-target");$(target).replaceWith(data); }) .always(function () { showModal(); }); return false; }; $("form[data-cfdb-ajax='true']").submit(ajaxFormSubmit);$(".body-content").on("click", ".pagedList a", getPage);

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>