3 Answers, 1 is accepted


Grid Setup:
<
div
id
=
"example"
class
=
"k-content"
>
<
h3
>Grid with only one column sorting enabled</
h3
>
<
div
id
=
"singleSort"
style
=
"width:600px;"
></
div
>
</
div
>
Sample Script:
<script>
$(document).ready(
function
() {
$(
"#singleSort"
).kendoGrid({
dataSource: {
data: [{
FirstName:
"FirstName1"
,
LastName:
"LastName1"
},
{
FirstName:
"FirstName1"
,
LastName:
"LastName2"
},
{
FirstName:
"FirstName3"
,
LastName:
"LastName3"
},
{
FirstName:
"FirstName1"
,
LastName:
"LastName4"
}],
},
groupable:
false
,
// this will remove the group bar
sortable:
true
,
columns: [
{
field:
"FirstName"
,
title:
"First Name"
,
sortable:
true
,
},
{
field:
"LastName"
,
title:
"Last Name"
,
sortable:
false
//note that if you do not set this to false, it will be true
},]
});
});​
</script>

Sorting by single column is demonstrated in the Grid Sorting Demo linked below:
- https://demos.telerik.com/kendo-ui/grid/sorting
The sorting mode could be set to 'single' or 'multiple' by using the Grid sortable.mode option:
- https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/sortable.mode#sortablemode
Regards,
Neli
Hi Neli,
Is there a cshtml code sample available? Something like this (below does not work):
<kendo-grid name="Grid">
<no-records template="No data available." /><columns>
<column field="Id" hidden=true></column>
<column field="Name" title="Name" width="100" sortable="true"></column>
<column field="Phone" title="Phone Number" sortable="false"></column>
</columns>
<pageable enabled="true" />
<sortable enabled="true" mode="single" />
<scrollable enabled="true" />
</kendo-grid>
Hi Bob,
As far as I see form the provided snippet you need an example of using Kendo Grid with tagHelpers. If this is the case you can take a look at the dedicated demo that is part of the Telerik UI for ASP.NET Core suite demos:
- https://demos.telerik.com/aspnet-core/grid/tag-helper
Also in the Telerik UI for ASP.NET Core documentation the examples are demonstrated with HtmlHelpers and TagHelpers. You need to click on the needed tab to check the configuration with the tagHelpers
I hope this helps.
Regards,
Neli