ListView DataSource calling Create Action Multiple times

2 posts, 0 answers
  1. Scott Singleton
    Scott Singleton avatar
    2 posts
    Member since:
    Jul 2009

    Posted 03 Feb 2017 Link to this post

    So we've read the docs; done all the appropriate searching; yet cannot keep the listview from repeating calls to the create service.

    According to the docs the listview datasource expects the item that was added to be returned.  Here is our server side controller method:


    public ActionResult CreateMultiSelectItem([DataSourceRequest] DataSourceRequest request, long questionId, SurveyQuestionMultiSelectItem item)
        if (item != null && ModelState.IsValid)
            var vm = new SurveyQuestionMultiSelectViewModel(_surveyQuestionService.GetById(questionId));
        return Json(new[] {item}.ToDataSourceResult(request, ModelState));


    as you can see we are returning the exact item being created.


    The Datasource setup for the listview is as such:

    <div class="demo-section k-content wide">
        <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a>
                            model.Field(p => p.Id).DefaultValue(Guid.NewGuid());
                  .Create(create=>create.Action("CreateMultiSelectItem","SurveyQuestion", new { questionId = Model.SurveyQuestionId }))
                  .Read(read=>read.Action("ReadMultiSelectItem","SurveyQuestion",new { questionId = Model.SurveyQuestionId}))
                  .Update(update=>update.Action("UpdateMultiSelectItem", "SurveyQuestion", new { questionId = Model.SurveyQuestionId }))
                  .Destroy(destroy=>destroy.Action("DeleteMultiSelectItem", "SurveyQuestion",new { questionId = Model.SurveyQuestionId } ))



    So am I missing something totally obvious?  I do this sort of behavior in the Grid control all day long without this issue.


    -Scott Singleton

  2. Vasil
    Vasil avatar
    1642 posts

    Posted 07 Feb 2017 Link to this post

    Hi Scott,

    It looks to make a single request in our online demo here:
    The same happens if I run the code of the demo locally. So I am not sure why it behaves differently in your page.

    You may want to profile the executed JavaScript after the first response is received and see what function is exactly causing the second request.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top