Home Analyst Portal

KendoDropDown for Support Group on Custom Task only populating with items 50% of the time

Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
edited September 2017 in Analyst Portal

Hello Community,

My job doesn't require a lot of web development/javascript so I am having a hard time finding my error. I extended the Add Manual Activity custom task to have a few more fields and it works 100% some of the time, its almost as if it only works after a browser cache clear and a page refresh. I can't ask my techs to do this every time obviously so any help would be greatly appreciated


Just to clarify the only issue is with the support groups drop down not having items from the binded dataSource when clicking the task sometimes. Other times it works flawlessly.

Best Answer

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    edited September 2017 Answer ✓
    My guess would be, that the async AJAX call is to blame, as you can't be sure, that all the data is returned before you start processing it. You could set async: false on the call or you could utilize done() and process your data there, e.g.:
    <br>// Get MA support groups<br>(function() {<br>&nbsp; return $.getJSON("/api/V3/Enum/GetList", {<br>&nbsp;&nbsp;&nbsp; Id: MASupportGroupEnumGuid<br>&nbsp; });<br><br>})().done(function(json) {<br>&nbsp; $.each(json, function(key, val) {<br>&nbsp;&nbsp;&nbsp; supportgroupz[key] = val;<br>&nbsp; });<br><br>&nbsp; // Remove mysterious 'undefined' entries<br>&nbsp; supportgroupz = supportgroupz.filter(function(n){ return n != undefined });<br>});

Answers

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    edited September 2017 Answer ✓
    My guess would be, that the async AJAX call is to blame, as you can't be sure, that all the data is returned before you start processing it. You could set async: false on the call or you could utilize done() and process your data there, e.g.:
    <br>// Get MA support groups<br>(function() {<br>&nbsp; return $.getJSON("/api/V3/Enum/GetList", {<br>&nbsp;&nbsp;&nbsp; Id: MASupportGroupEnumGuid<br>&nbsp; });<br><br>})().done(function(json) {<br>&nbsp; $.each(json, function(key, val) {<br>&nbsp;&nbsp;&nbsp; supportgroupz[key] = val;<br>&nbsp; });<br><br>&nbsp; // Remove mysterious 'undefined' entries<br>&nbsp; supportgroupz = supportgroupz.filter(function(n){ return n != undefined });<br>});

  • Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    Thanks that was exactly the issue, I flipped a few functions to syncronous and changed up a few things and she works 100% now. Much appreciated Konstantin_slavin-Bo
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    Thanks that was exactly the issue, I flipped a few functions to syncronous and changed up a few things and she works 100% now. Much appreciated Konstantin_slavin-Bo
    No problem, happy to help!
Sign In or Register to comment.