Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 Webgrid sorting problem with 2nd+ columns
    text
    copied!<p>in this sample the sorting of the grid works well with the first column. Every other column can only be sorted ascending, the "sortdir" never switches to "DESC". (Ajax caching is also disabled)</p> <p>Does anybody knows a solution or had the same problem? What im doing wrong?</p> <p>Controller:</p> <pre><code>[OutputCache(Location = OutputCacheLocation.None)] public ActionResult Index_Result_Org(string sort, string sortdir) { this.setRep(); this.rep.LoadOV(); return View("Index_OV", rep.GetOV(sort != null ? sort : "Kennung", sortdir != null ? sortdir == "ASC" : true)); } </code></pre> <p>View:</p> <pre><code>@model List&lt;Models.OV_View&gt; @{ Layout = null; var grid_BA = Html.Grid&lt;OV_View&gt;(Model, ajaxUpdateContainerId: "BAS_OV", canPage: false, defaultSort: "Kennung"); } &lt;div id="BAS_OV"&gt; @grid_BA.GetHtml( htmlAttributes: new { @id = "webgrid_BA" }, alternatingRowStyle: "alt", tableStyle: "BAS", columns: grid_BA.Columns( grid_BA.Column("Kennung", header: "Verbandskennung", format: @&lt;text&gt;@Html.Label(@item.Data.Kennung)&lt;/text&gt;, canSort: true), grid_BA.Column("Name", header: "Verbandsname", format: @&lt;text&gt;@item.Data.Name&lt;/text&gt;, canSort: true), grid_BA.Column("Anzahl", header: "Anzahl", format: @&lt;text&gt;@item.Data.Anzahl&lt;/text&gt;, canSort: true, style: "counter_column"), grid_BA.Column("Select", header: "X", canSort: false, format: @&lt;text&gt;&lt;input id="Select" name="Select" type="checkbox" onclick="Select(this)" value="@item.Select" @(item.Select == true ? "Checked" : null) /&gt;&lt;/text&gt;, style: "checkbox_column"), grid_BA.Column("ID", "", format: @&lt;text&gt;@item.Data.ID&lt;/text&gt;, canSort: false, style: "invisible_column") ) ) &lt;/div&gt; </code></pre>
 

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