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

Select nothing in multiselect causes error

2 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 23 Jul 2015, 06:55 PM

Hi,

I use a MultiSelect to choose several values in an m:n relation.

Everything works as expected as long as I select one or more values.
But when I select nothing I get the following error:

0x800a138f - Laufzeitfehler in JavaScript: Die Eigenschaft "length" eines undefinierten oder Nullverweises kann nicht abgerufen werden.

The failing code is for(n=0,i=e.length;i>n;n++)o+=n%2?s(e[n]):a(e[n]),r._data.push(e[n]);return o}

This happens only when I add a new record.
If I edit an existing one it is possible to remove the formerly chosen element and update after this.

I initialize the field via model.Field(p => p.Salads).DefaultValue(new List<EECanteen.Models.FoodItem>());

To explain my problem - I want to edit meal offerings for a day and can choose from zero or more salads.

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 27 Jul 2015, 10:39 AM
Hello ManniAT,

I am not sure how the Grid is configured and when exactly the error occurs. Would you please share some code snippets, or ideally - a runnable sample that we can examine?

Regards,
Alexander Popov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
ManniAT
Top achievements
Rank 2
answered on 27 Jul 2015, 05:45 PM

I found the problem - it was created by a C# (model) class which was missing the creation of a list in the constructor.

Thank you

Manfred

Tags
Grid
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Alexander Popov
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or