We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

newly added records using dialog box are not showing on grid

Thread ID:

Created:

Updated:

Platform:

Replies:

129025 Feb 22,2017 08:50 AM UTC Feb 24,2017 01:08 PM UTC JavaScript 1
loading
Tags: ejGrid
amsm
Asked On February 22, 2017 08:50 AM UTC

hi,
I created asp.net mvc 5 project (.net 4.6.1) using Syncfusion project template for web application in Visual Studio 2015.
Additionally I installed following packages:
Microsoft.AspNet.WebApi.OData - 5.7.0
Microsoft.Data.OData - 5.6.0
Syncfusion.JavaScript - 15.1.0.33
angularJS - 1.2.16

My grid uses angular directives and has WebApiAdaptor.
This is its declaration:

<div ng-app="myapp">
        <div ng-controller="myctrl">
            <div ej-grid id="Grid" e-datasource="systems"
                 e-allowpaging="true" e-pagesettings="sys_pageset"
                 e-allowsorting="true" e-allowmultisorting="false" e-sortsettings="sys_sortset"
                 e-allowfiltering="true" e-filtersettings="sys_filterset" e-allowsearching="true" e-searchsettings="sys_searchset"
                 e-allowgrouping="true" e-groupsettings="sys_groupset"
                 e-toolbarsettings="sys_toolbarset" e-editsettings="sys_editset">
                <div e-columns>
                    <div e-column e-field="Id" e-headertext="Id" e-isprimarykey="true" e-isidentity="true" e-allowfiltering="false" e-allowgrouping="false" e-width="25" e-textalign="right" e-type="number"></div>
                    <div e-column e-field="Name" e-headertext="Nazwa" e-type="string"></div>
                </div>
            </div>
        </div>
    </div>

and this is its configuration:

<script>
    (function () {
        var app = angular.module('myapp', ['ejangular']);
        app.controller('myctrl', function ($scope) {
            $scope.systems = ej.DataManager({ url: 'api/app', adaptor: 'WebApiAdaptor' });
            $scope.sys_pageset = { pageSize: 2 };
            $scope.sys_sortset = { sortedColumns: [{ field: 'Id', direction: 'ascending' }] };
            $scope.sys_filterset = { filterType: 'menu', showPredicate: false };
            $scope.sys_searchset = { fields: ['Name'], operator: 'contains', key: '', ignoreCase: true };
            $scope.sys_groupset = { showToggleButton: true, showDropArea: false };
            $scope.sys_toolbarset = { showToolbar: true, toolbarItems: ['search', 'add', 'edit', 'delete'] };
            $scope.sys_editset = { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: 'dialog', showDeleteConfirmDialog: true };
        });
    }());
</script>

controller code is as follows:

public class AppController : ApiController
    {
        private Models.InMemDb _db = null;


        public AppController(Models.InMemDb db)
        {
            _db = db;
        }

        public PageResult<Models.Element> Get(ODataQueryOptions opts)
        {
            var data = _db.Data.AsQueryable();

            return new PageResult<Models.Element>(opts.ApplyTo(data) as IEnumerable<Models.Element>, null, _db.Data.Count);
        }

        public void Post(Models.Element e)
        {
            e.Id = _db.Data.Count + 1;
            _db.Data.Add(e);
        }

        public void Put(Models.Element e)
        {
            var d = _db.Data.FirstOrDefault(i => i.Id == e.Id);
            if (d != null)
            {
                d.Name = e.Name;
            }
        }

        public void Delete(int id)
        {
            var d = _db.Data.FirstOrDefault(i => i.Id == id);
            if (d != null)
            {
                _db.Data.Remove(d);
            }
        }
    }

when I'm adding first record:




then this first row shows on the grid properly:




but when I'm adding second row:




then this second row is added to database but is not showing on the grid (pagesize is set to 2):




seems like grid is not refreshing after adding second record.
please help.

best regards,
Adam



Attachment: SyncfusionMvcApplication3_ca2c7bf1.zip

Venkatesh Ayothi Raman [Syncfusion]
Replied On February 24, 2017 01:08 PM UTC

Hi Customer, 

We considered this requirement “Added record doesn't show in grid while using webApiAdaptor and IsIdentity property” as bug and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.  
  
  

Reagrds, 
Venkatesh Ayothiraman. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;