ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Problem Adding in Grid inline editing mode
Title:
B
I
{code}
?
Hi When I use a condition in GetGridItems Action like this : public ActionResult GridGetItems(GridParams g, string search) { search = (search ?? "").ToLower(); var list = Db.Dinners.Where(o => o.Name == "Dear"); var items = list.Where(o => o.Name.ToLower().Contains(search)).AsQueryable(); var model = new GridModelBuilder<Dinner>(items, g) { Key = "Id", // needed for api select, update, tree, nesting, EF GetItem = () => Db.Get<Dinner>(Convert.ToInt32(g.Key)), // called by the grid.api.update Map = MapToGridModel, }.Build(); return Json(model); } Then after creating a new grid item (in Grid inline editing mode) , the field values (that have a client format specified for them) are not shown and instead of their values their client format text is displayed but after refreshing the grid by refresh button, the appropriate values are displayed. How can I solve this Problem?? Best Regards.
Save Changes
Cancel
dear
asked at 18 Feb 2017
Answers
B
I
{code}
?
hi, you'll have to change the call to `inlineCreate`, so that you would pass in an initial model that has all the properties that are to be rendered in the cells so it can look like this: <div class="bar"> @{ var chefId = Db.Chefs.First().Id; var meals = Db.Meals.Take(2).Select(o => o.Id).ToArray(); var initObj = new { Name = "hi there", Date = DateTime.Now.ToShortDateString(), ChefId = chefId, MealsIds = meals, ChefName = "", Meals = "", BonusMeal = "", DispOrganic = "" }; } <button type="button" onclick="$('#DinnersGrid').data('api').inlineCreate(@DemoUtils.Encode(initObj))" class="awe-btn mbtn">Create with predefined values</button> </div> if you don't need default values, just replace "hi there" with "" etc. right now the first row that is rendered in the grid needs to have all the properties; in your case the grid had no initial results, and the first row was the one sent the by `inlineCreate`
Save Changes
Cancel
Omu
answered at 19 Feb 2017
it's OK,worked. Thanks for help me.
at 21 Feb 2017
dear
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK