Refresh the widget data used in ng-repeat

abuthahir
Tera Expert

Hi,

I am have a category widget which initially shows only limited number of categories. I have a button in the widget "View All". When the user clicks that button, the widget should refresh and show all the categories. Below is my code am using. Where am i doing wrong. ctomasi nathanfirth pradeepksharma

Server:

if(input){

  data.catParam = $sp.getParameter("kb_category");

  data.kb = $sp.getValue("kb_knowledge_base");

  var cats1 = new GlideRecord("kb_category");

  cats1.addQuery("parent_id", data.kb);

  cats1.orderBy('label');

  cats1.query();

  while(cats1.next()){

  data.categories.push({label: cats1.getDisplayValue("label"), value: cats1.getUniqueValue()});

  }

  }

Client:

$scope.seeAll = function()

  {

  c.server.get().then(function(r) {

  c.data.categories = r.data.categories;

  });

  };

1 ACCEPTED SOLUTION

i think we traced down the error.



it looks like c.server.update returns data it self. so you can directly do



c.data.categories = r.newItems;



see if this works.



(please mark helpful/like/correct if it helps)


View solution in original post

10 REPLIES 10

great..that is other alternative. can you please mark my previous reply as helpful or correct so that in future if someone uses c.server.update() ..this thread can be useful to them.