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

Uncaught RangeError: Maximum call stack size exceeded

3 Answers 32 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Francis
Top achievements
Rank 1
Veteran
Francis asked on 07 Sep 2020, 11:57 AM

Hi I'm getting a JS error when trying to using cascading dropdowns (defined below)

@(Html.Kendo().DropDownList()
 .Name("makes")
 .HtmlAttributes(new { style = "width:100%" })
 .OptionLabel("Select make...")
.DataTextField("text")
 .DataValueField("value")
 .DataSource(source =>
 {
  source.Read(read =>
  {
   read.Url("/NoMatchVehicle/GetMakeValues");
  });
   })
  )
 
@(Html.Kendo().DropDownList()
  .Name("models")
  .HtmlAttributes(new { style = "width:100%" })
  .OptionLabel("Select model...")
   .DataTextField("text")
   .DataValueField("value")
  .DataSource(source =>
  {
 source.Read(read =>
  {
  read.Url("/NoMatchVehicle/GetModelValues?make=");
  read.Data("makes");
 
  })
  .ServerFiltering(true);
  })
  .CascadeFrom("makes")
  .Enable(false)
  .AutoBind(false)
  )

 

The first dropdown is populated fine but upon the selection on the first dropdown I get a JS error 

 

jquery.js:8641 Uncaught RangeError: Maximum call stack size exceeded
    at Function.isArray (<anonymous>)
    at buildParams (jquery.js:8641)

Any Ideas on why this could be happening I am basing this of this example 

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 10 Sep 2020, 09:30 AM

Hello Francis,

I don't see anything problematic in the configuration of the DropDownLists. The second one has a data function attached:

read.Data("makes");

What logic is executed in this function? If you comment this line, is there an exception?

Regards,
Ivan Danchev
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Francis
Top achievements
Rank 1
Veteran
answered on 10 Sep 2020, 11:05 AM

Hi Ivan,

I resolved the problem, the issue was i misunderstood the documentation. the problem was that I wasn't linking properly to the function that was grabbing the value of the first dropdown. 

0
warren
Top achievements
Rank 1
answered on 09 Feb 2021, 06:46 AM

This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.

How to fix it?

Wrap your recursive function call into a -

setTimeout
setImmediate
process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately.


Tags
DropDownList
Asked by
Francis
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Francis
Top achievements
Rank 1
Veteran
warren
Top achievements
Rank 1
Share this question
or