Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
grid not respecting row selection mode
posted

Ive initialised my grid using MVC helper and set the selection mode to row but this is not being respected when the grid is rendered, if I hover over the grid , all the rows are 'selected'.  Im populating my grid via an ajax call (im populating a graph and grid from the same datasource).  Why is single row selection not being honoured ?

heres the grid definition

@(Html.Infragistics()
                                                    .Grid(Model.Records)
                                                    .ID("Grid")
                                                    .Width("100%")
                                                    .Height("400px")
                                                    .PrimaryKey("ID")
                                                    .AutoGenerateColumns(false)
                                                    .AutoGenerateLayouts(false)
                                                    .Columns(column =>
                                                    {
                                                        column.For(x => x.PriceDateString).HeaderText("Price Date").Width("25%");
                                                        column.For(x => x.MaximumnPrice).HeaderText("High (£/MWh)").Width("25%");
                                                        column.For(x => x.AveragePrice).HeaderText("Average (£/MWh)").Width("25%");
                                                        column.For(x => x.MinimumnPrice).HeaderText("Low (£/MWh)").Width("25%");
                                                    })
                                                    .Features(features =>
                                                    {
                                                        features.Selection().Activation(true).MultipleSelection(false).Mode(SelectionMode.Row);
                                              
                                                    })
                                                    .ResponseDataKey("Records")
                                                    .Render())

and the ajax call to populate it

function Populate() {
var dayOption = $("input[name='optDays']:checked").val();
$.ajax({
url: '@Url.Action("GetpriceData", "Price")',
data: { period: dayOption },
async: true,
type: 'GET',
success: function (returnval) {

if (returnval.success == true) {

$("#Chart").igDataChart({
dataSource: returnval.Records
});
$("#Grid").igGrid("option", "dataSource", returnval.Records);
}
if (returnval.success == false) {
bootbox.alert({ title: '<div class="text-center text-danger"><i class="fa fa-exclamation-triangle"></i>&nbsp;&nbsp;ERROR</div>', message: returnval['responseText'] });
}
},
error: function (returnval) {

}
});
}

both the chart and grid are populated exactly as i expected but the grid will not honour single row selection, whats going on here ?  anyone help ?

Parents
No Data
Reply
  • 17590
    Suggested Answer
    Offline posted

    Hello Mark,

    Thank you for posting in our community.

    By design igGrid Selection feature uses unique primary keys for row selection. In case that there are duplicate primary keys when a row is hovered all rows having the same id will have hovered style applied. From the code snippet provided I see that the primary key for your grid is "ID". Please ensure that every row has an unique "ID" and test the behavior. If the issue is still reproducible please feel free to send me a small, isolated sample where I can replicate the behavior along with steps to reproduce it. This is going to be highly appreciated.

    Looking forward to hearing from you. 

Children