Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sorting By Foreign key Column Text not value in Kendo Grid MVC

the sorting in mvc kendo grid foreign column sort by values not text enter image description here

the code is

@Html.Kendo().Grid( _
    Of cls.ProductSpecificationM).Name("Grid").Columns(
    Sub(i)
            i.Bound(Function(p) p.ProductSpecification_ID).Hidden(True)

            i.ForeignKey(Function(p) p.Attribute_ID_FK, DirectCast(ViewBag.Attributes, System.Collections.IEnumerable), "Attribute_ID", "Attribute_Name").EditorTemplateName("_Attribute_ID_FK").Title("Name")
            i.ForeignKey(Function(p) p.AttributeValue_ID_FK, DirectCast(ViewBag.AttributeValues, System.Collections.IEnumerable), "AttributeValue_ID", "AttributeValue_Name").EditorTemplateName("_AttributeValue_ID_FK").Title("Value")
            i.Command(Sub(w)
                              w.Destroy()
                      End Sub)
    End Sub).ToolBar(Sub(k)
                             k.Create() : k.Save()

                     End Sub).Editable(Function(e) e.Mode(GridEditMode.InCell)).Pageable(Function(i) i.Input(True).PageSizes({10, 20, 50, 100, 200, 300, 400}).Refresh(True)).Sortable().Filterable().DataSource( _
                                                       Function(p) p.Ajax().PageSize(50).Batch(True).ServerOperation(False).Model(Sub(i)
                                                                                                                                          i.Id(Function(p2) p2.ProductSpecification_ID)
                                                                                                                                          i.Field(Function(p2) p2.Item_ID_Fk).DefaultValue(ViewBag.Id)
                                                                                                                                          i.Field(Function(p2) p2.AttributeValue_ID_FK).DefaultValue(1)
                                                                                                                                          i.Field(Function(p2) p2.Attribute_ID_FK).DefaultValue(1)
                                                                                                                                  End Sub) _
                                                             .Read("EditingInline_Read", "Products", New With {.id = ViewBag.Id}) _
                                                             .Update(Function(u) u.Action("EditingInline_Update", "Products")) _
                                                             .Destroy(Function(update) update.Action("EditingInline_Destroy", "Products")) _
                                                             .Create(Function(update) update.Action("EditingInline_Create", "Products"))).Events(Function(e) e.Edit("edit"))

how Can I sort by the column text ?

like image 971
Farahatology Avatar asked Dec 05 '25 13:12

Farahatology


1 Answers

Looks like kendo doesn't support it. Need to come up with some other solution.

Reponse by Atanas Korchev (Admin, Kendo UI) We can’t support this in all cases because the data source won’t have all data (it usually has just the foreign key which is the value)

You can use Grouping if that helps to some extend. Grouping column in Kendo

like image 194
HaBo Avatar answered Dec 09 '25 01:12

HaBo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!