Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144416 | May 6,2019 07:45 AM UTC | May 13,2019 07:03 AM UTC | Vue | 3 |
![]() |
Tags: Data Grid |
İ want to add some editable grid tables with a button called “new table” in Vue. I haven’t found any example or something else.
And then the User get or post datas into/from my mysql database. How I can do this. What I have to prepare?
thankful for any reply
data: new DataManager({
url: "Home/DataSource",
updateUrl: "Home/Update",
insertUrl: "Home/Insert",
removeUrl: "Home/Delete",
adaptor: new UrlAdaptor
}),
another question where should i use this code?
public ActionResult DataSource(DataManager dm)
{
var DataSource = OrderRepository.GetAllRecords();
DataResult result = new DataResult();
result.result = DataSource.Skip(dm.Skip).Take(dm.Take).ToList();
result.count = result.result.Count;
return Json(result, JsonRequestBehavior.AllowGet);
}
public class DataResult
{
public List<EditableOrder> result { get; set; }
public int count { get; set; }
}
when i want to perform a insert operation on the server-side. How and where i should to use this example:
public ActionResult Insert(EditableOrder value) { //Insert record in database }
[fetchdata.vue.html]
<ejs-grid :dataSource="data" height="auto" width="540" :toolbar="toolbar" :editSettings="editSettings">
...
</ejs-grid>
[fetchdata.ts]
data: () => {
return {
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
data: new DataManager({
url: "Home/UrlDatasource",
updateUrl: "Home/Update",
insertUrl: "Home/Insert",
removeUrl: "Home/Delete",
adaptor: new UrlAdaptor()
}),
};
},
[HomeController.cs]
public IActionResult UrlDatasource([FromBody]DataManagerRequest dm)
{
...
return Json(new { result = DataSource, count = count });
}
public ActionResult Update([FromBody]ICRUDModel<OrdersDetails> value)
{
...
return Json(value.value);
}
public ActionResult Insert([FromBody]ICRUDModel<OrdersDetails> value)
{
...
return Json(value.value);
}
public ActionResult Delete([FromBody]ICRUDModel<OrdersDetails> value)
{
...
return Json(value);
}
|
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.
This page will automatically be redirected to the sign-in page in 10 seconds.