Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, I just solved my problem like this :</p> <ol> <li><p>For paging : add new parameter for each action called 'type' and validate based on the parameter.</p> <pre><code>public ActionResult Formations(GridSortOptions sort, int? page, string type, string filter = "all") { if (type != null &amp;&amp; !type.Equals("Formation")) page = 1; IPagination&lt;StratUnitVo&gt; pagination = ...... return PartialView("_Formations", pagination); } </code></pre></li> <li><p>For sorting : use ajax sort for mvc grid :</p> <pre><code>$(function () { ajaxSort('pools', 'Stratigraphy', 'Pools'); ajaxSort('formations', 'Stratigraphy', 'Formations'); ajaxSort('zones', 'Stratigraphy', 'Zones'); }); function ajaxSort(tableId, controllerName, actionName) { $(document).on('click', '#' + tableId + ' &gt; table &gt; thead &gt; tr &gt; th &gt; a', (function () { // store the href attribute, will get the column and direction parameter var href = $(this).attr('href'); // mvc grid sort url is : 'http\\controllerName\\actionName?Column=columnname&amp;Direction=[Ascending|Descending] var temp = href.split('&amp;'); // retrieve the column name var column = temp[0].split('=')[1]; // retrieve sort direction var direction = temp[1].split('=')[1]; // retrieve column header var columnHeader = $(this).text(); // remove the href attribute, prevent postback $(this).removeAttr('href'); // use ajax to sort $.ajax({ url: '/' + controllerName + '/' + actionName, data: { 'Column': column, 'Direction': direction }, dataType: 'html', success: function (data) { $('#' + tableId).html(data); columnHeader = columnHeader.replace('\u25B2', '').replace('\u25BC', ''); // show up down arrow // \u25B2 and \u+25BC is the unicode character for up/down triangle (arrow) to display in HTML var column = $('#' + tableId + ' &gt; table &gt; thead &gt; tr &gt; th &gt; a:contains(' + columnHeader + ')'); if(direction == 'Ascending') column.text(columnHeader + "\u25B2"); else { column.text(columnHeader + "\u25BC"); } }, }); })); } </code></pre></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload