Form Post and sorting/paging

Jul 23, 2013 at 2:32 PM
I'm trying to use the grid and I have a Form Post which sets my query parameters and I return a result set to the grid. But now when I try to page or sort, the grid is directed to the "get" request action. How can I send another post to the back end to sort and page my data?

Has anyone else had this issue? I was trying not to have to rewrite much of grid views. I have result sets that may be ~10000 records and I don't want to pull that data back all the time unless I have to.
Jul 24, 2013 at 5:05 AM
I figured it out. I modified the _Pager anchors with a jquery script to send an ajax post to the server and then replaced the grid with the updated dataset.
The key to this script is the eval call which re-binds the click to bypass the anchor get calls
<script type="text/javascript" id="sc">
 $(document).ready(function () {
        $("form").submit(function () {
            $('form')[0].action = getPathFromUrl($('form')[0].action);
            return true;
        });

        $('.ajaxable, .grid-header a').click(function (event) {
            event.preventDefault();

            var url = $(this).attr('href');

            $.post(url, $('form').serialize(), function (data) {
             
                $('section.main-content').replaceWith($(data).find('section.main-content'));
              
                eval($('#sc'));
            });

        });

    });
</script>