Apr 09, 2020, 12:03 AM
How does Ext.Net 7 support Asp.Net Core MVC development model
It looks like Ext.Net 7 is missing some features,such as:
1. Use X.AddScript to write Javascript code to client.
1. Use X.AddScript to write Javascript code to client.
namespace Ext.Net.MVC.Examples.Areas.Form_TextField.InputMask_Native.Controllers
{
public class InputMask_NativeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult HandleBtnClick()
{
var pattern = "99/99/9999";
// Getting the TextField dynamically does not mean its input mask will not be null,
// so the only way here is to call the actual client-side scripts.
X.AddScript("App.TextField1.setNote('" + pattern + "');");
X.AddScript("App.TextField1.inputMask.setPattern('" + pattern + "');");
return new DirectResult();
}
}
}
2. Use this.GetCmp<>() to get a proxy of client component, and invoke the method of proxy to generate client calls.using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Ext.Net.MVC.Examples.Areas.GridPanel_ComponentColumn.Overview.Controllers
{
public class OverviewController : Controller
{
public ActionResult Index()
{
return View(TestData.GetData());
}
public ActionResult DoTasks(string tasks)
{
var tasksDict = JSON.Deserialize<Dictionary<string, string>[]>(tasks);
var store = this.GetCmp<Store>("StoreTasks");
foreach (var task in tasksDict)
{
var id = JSON.Deserialize<int>(task["TaskID"]);
var progress = JSON.Deserialize<float>(task["Progress"]);
var status = JSON.Deserialize<int>(task["Status"]);
var record = store.GetById(id);
record.BeginEdit();
if (status == 1)
{
record.Set("Status", 2);
}
progress += 0.2f;
record.Set("Progress", progress);
if (progress >= 1)
{
record.Set("Status", 3);
}
record.EndEdit();
}
return this.Direct();
}
}
}
It would be useful to have an article about the MVC development model.