简体   繁体   English

在MVC3实体框架中使用slickgrid

[英]usage of slickgrid in MVC3 entity framework

I would like to use slickgrid in my project to make editing a schedule easy. 我想在项目中使用slickgrid来简化时间表的编辑。 I downloaded it and found that the documentation in the folder and on the sites i have visited to be very vague. 我下载了它,发现文件夹和我访问过的站点上的文档非常模糊。 they do not show code as to how you would pull from a database. 它们没有显示有关如何从数据库中提取代码。 Does anyone have or know of any examples that show a view, model, and controller for slickgrid implementation? 是否有人知道显示slickgrid实现的视图,模型和控制器的示例? There is an example on code project but it uses data that is not in a database and is very simple in concept. 有一个关于代码项目的示例,但是它使用的数据不在数据库中,而且概念上非常简单。

I've never used slickgrid before but based on the example page slickgrid example the following may help get you in the right direction: 我以前从未使用过slickgrid,但基于示例页面slickgrid示例 ,以下内容可能会帮助您朝正确的方向发展:

//Controller
public JsonResult GetSlickGridData()
{
        var slickGridData = db.SlickGridData.ToList();
        return Json(slickGridData, JsonRequestBehavior.AllowGet);
}

//View
var data = [];
$.getJSON("/Index/GetSlickGridData", function (items) {
data = items;
});
grid = new Slick.Grid("#myGrid", data, columns, options);

So the idea here would be to use the jquery getJSON method to call your controller and bring back the information and store it in data. 因此,这里的想法是使用jquery getJSON方法来调用您的控制器,并带回信息并将其存储在数据中。 Again I'm not too familiar with slickgrid so you may have to also convert 'items' above to a javascript array before assigning it to 'data'. 再次说明,我对slickgrid不太熟悉,因此您可能还必须将上面的“ items”转换为javascript数组,然后才能将其分配给“ data”。

Have you looked at spreadsheet example provided by the developer(s)? 您是否看过开发人员提供的电子表格示例? http://mleibman.github.com/SlickGrid/examples/example-spreadsheet.html http://mleibman.github.com/SlickGrid/examples/example-spreadsheet.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM