custom table table not updating ajax

lawrence whittemore asked on March 17, 2022 18:38

I am using a controller to add a new custom table item via an ajax call. The custom table does get updated but I have to do a full page refresh to get the info to show. What am I missing. I'm calling the repository after the update but it's as if the update had happened yet.

 // Gets the custom table
        DataClassInfo customTable = DataClassInfoProvider.GetDataClassInfo(customTableClassName);
        if (customTable != null)
        {
            //sets order to last item
            int order = forumTopicsRepository.GetForumTopicsLastItemOrder(forumID);
            // Creates a new custom table item
            CustomTableItem newCustomTableItem = CustomTableItem.New(customTableClassName);

            // Sets the values for the fields of the custom table (ItemText in this case)
            newCustomTableItem.SetValue("Title", title);
            newCustomTableItem.SetValue("ForumID", forumID);
            newCustomTableItem.SetValue("ItemOrder", order);

            // Save the new custom table record into the database
            newCustomTableItem.Insert();
        }

        var forumTopics = await forumTopicsRepository.GetForumTopics(forumID);
        var forumTopicsModel = forumTopics.Select(forumTopicsItem => ForumTopicsViewModel.GetViewModel(forumTopicsItem));
        return View($"~/Components/ViewComponents/Forums/_ForumTopics.cshtml", forumTopicsModel);
    }

Recent Answers


lawrence whittemore answered on March 17, 2022 21:00

No idea what I changed but i have it working now...

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.