在页面加载时填充客户端网格 [英] Populate a client-side grid on page load

查看:76
本文介绍了在页面加载时填充客户端网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个实现客户端网格的自定义控件 SlickGrid [ ^ ]。



我想在页面加载时填充数据。我有几个自定义的javascript函数可以做到这一点,所以我只需要获取json对象。



我是否必须在页面加载时获取此数据,还是可以在页面元数据中将其写入某处?我玩弄了这个想法,只是在动态js中将它写成一行,但它看起来很糟糕:S



谢谢

Andy



PS:我的老板说我应该使用telerik kendo,但我没有看到优势。



更新:除了将数据源写入页面之外,似乎没有预加载数据源的方法。我将不得不坚持使用网络服务。

感谢RyanDev。



更新(再次) :

RyanDev提出了一个好主意^ _ ^

Hi,

I have a custom control that implements the client side grid SlickGrid[^].

I want to populate the data on page load. I have several custom javascript functions that can do this so I just need to get the json object.

Do I have to 'fetch' this data on page load or can I write it in the page metadata somewhere? I toyed with the idea of just writing it line for line in dynamic js but it just looks bad :S

Thanks
Andy

PS: My boss said I should just use telerik kendo, but I fail to see the advantage.

UPDATE: There does not appear to be a way of preloading the datasource other than writing it onto the page. I'll have to stick with a web service.
Thanks to RyanDev.

UPDATE (again):
RyanDev came up with a good idea ^_^

推荐答案

如评论中所述,您可以将数据加载到隐藏中Page_Load事件页面上的字段。然后在document.ready你可以立即开始使用它。



但是,这可能会给你的页面加载缓慢的印象。许多人反其道而行之前有一个更具反应性的页面。他们让页面快速加载,然后在document.ready中进行处理。



显然,您可以选择哪种方式最适合您。
As mentioned in the comments, you could load the data into a hidden field on the page in the Page_Load event. Then in the document.ready you can start using it right away.

However, this may give the impression that your page loads slowly. Many people do the opposite to have a more reactive page. They let the page load quickly and then do the processing in document.ready.

Clearly it's your choice of which way works best for you.


这篇关于在页面加载时填充客户端网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆