使用jqGrid和HTML5本地数据库 [英] Using jqGrid with HTML5 local database
问题描述
我想将jqGrid用于相当大的HTML5 / SQLite应用程序。所有数据都是本地数据,我永远不会调用服务器。我已经构建了一个非常简单的桥类,通过将 url
设置为'#'$ c来劫持正常的服务器 - 客户端通信$ c>使用
在提交
后捕获已更改的数据,但这非常非常黑客。有没有更好的方法呢?
I would like to use jqGrid for a pretty large HTML5/SQLite application. All of the data will be local and I'll never be calling a server. I've build a pretty simple bridge class that sort of hijacks the normal server-client communication by setting the url
to '#'
capturing the changed data with afterSubmit
but it is very, very hacky. Is there a better method of doing this?
推荐答案
由于jqGrid 3.7有
Since jqGrid 3.7 there is
selector.jqGrid({
data: mydata,
datatype: "local",
...
});
参数组合,允许您指定自己的数据。 mydata
这里是一个行数组 {id:1,mycol1:val1...}
combination of parameters, that allows you to specify your own data. mydata
here is an array of rows in form {"id":1,"mycol1":"val1"...}
jqgrid demo - 查看版本3.7中的新功能 - 立即加载数据阵列
jqgrid demo - look into "New in version 3.7" - "Load data array at once"
您还需要实现自己的重新加载机制。
You will also need to implement your own reloading mechanism.
这篇关于使用jqGrid和HTML5本地数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!