This is a migrated thread and some comments may be shown as answers.

Locked Column creates Duplicate ID for Selection

4 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
3PL
Top achievements
Rank 1
3PL asked on 15 Jan 2016, 06:18 PM

So if in your column specification you specify Locked:true for example

columns: [
{
field: "OrderDate",
title: "Order Date",
width: 180,
locked: true,
lockable: false,
format: "{0:MM/dd/yyyy}"
},
{
field: "ShipCountry",
width: 180,
lockable: false,
title: "Ship Country"
}

]

then you add in multiple selections so

selectable: "multiple, row",

 

Now if you add your change event like this

 

change: function(e) {
var selectedRows = this.select();
alert(JSON.stringify(selectedRows));
},

 

you will see the length will now be double, IE if you select 1 row then the length of selectedRows is 2 with a duplicate entry,  If you remove the locked:true from the column then it gets it correct at 1.  I am guessing it is creating a duplicate locked column etc.

 I have confirmed this on the online examples just adding in this things.

Is this a known bug?

Is this a new bug?

Do you know a way around this so you can actually tell the accurate elements selected?

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Jan 2016, 12:04 PM
Hi,

The described behavior is expected because when you have locked column in the grid there will be two separate table elements for the data items - one for locked columns and one for the regular ones. This is why when a Grid row is selected, both of the rows are returned from the select method.

I hope this information helps.

Regards,
Pavlina
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
riz
Top achievements
Rank 1
answered on 12 Mar 2019, 02:57 AM
this is lazy response. I expect better from the telerik team. can you please post a solution to this issue?
0
riz
Top achievements
Rank 1
answered on 12 Mar 2019, 03:06 AM
for my purposes, i solved this by filtering out any duplicate selected ids.
0
Viktor Tachev
Telerik team
answered on 13 Mar 2019, 02:17 PM
Hello Riz,

If your requirement is to get the selected ids in the Grid I would suggest using the selectedKeyNames method. Note that in order for it to return correct information the schema.model.id field for the Grid DataSource should be defined. 


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
3PL
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
riz
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or