轻松学习jQuery插件EasyUI EasyUI创建RSS Feed阅读器
作者:lijiao 时间:2024-05-03 15:31:44
本文实例讲述了通过 jQuery EasyUI框架创建一个RSS阅读器,分享给大家供大家参考。具体如下:
运行效果截图如下:
我们将使用以下插件:
layout:创建应用的用户界面。
datagrid:显示 RSS Feed 列表。
tree:显示 feed 频道。
步骤 1:创建布局(Layout)
<body class="easyui-layout">
<div region="north" border="false" class="rtitle">
jQuery EasyUI RSS Reader Demo
</div>
<div region="west" title="Channels Tree" split="true" border="false" style="width:200px;background:#EAFDFF;">
<ul id="t-channels" url="data/channels.json"></ul>
</div>
<div region="center" border="false">
<div class="easyui-layout" fit="true">
<div region="north" split="true" border="false" style="height:200px">
<table id="dg"
url="get_feed.php" border="false" rownumbers="true"
fit="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="title" width="100">Title</th>
<th field="description" width="200">Description</th>
<th field="pubdate" width="80">Publish Date</th>
</tr>
</thead>
</table>
</div>
<div region="center" border="false" style="overflow:hidden">
<iframe id="cc" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>
</div>
</div>
</div>
</body>
步骤 2:数据网格(DataGrid)处理事件
在这里我们要处理一些由用户触发的事件。
$('#dg').datagrid({
onSelect: function(index,row){
$('#cc').attr('src', row.link);
},
onLoadSuccess:function(){
var rows = $(this).datagrid('getRows');
if (rows.length){
$(this).datagrid('selectRow',0);
}
}
});
本实例使用 'onSelect' 事件来显示 feed 的内容,使用 'onLoadSuccess' 事件来选择第一行。
步骤 3:树形菜单(Tree)处理事件
当树形菜单(Tree)数据已经加载,我们需要选择第一个叶子节点,调用 'select' 方法来选择该节点。 使用 'onSelect' 事件来得到已选择的节点,这样我们就能得到对应的 'url' 值。 最后我们调用数据网格(DataGrid) 的 'load' 方法来刷新 feed 列表数据。
$('#t-channels').tree({
onSelect: function(node){
var url = node.attributes.url;
$('#dg').datagrid('load',{
url: url
});
},
onLoadSuccess:function(node,data){
if (data.length){
var id = data[0].children[0].children[0].id;
var n = $(this).tree('find', id);
$(this).tree('select', n.target);
}
}
});
标签:jQuery,EasyUI,RSS,Feed
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python实现比较两个文件夹中代码变化的方法
2022-04-07 23:16:08
SQL2005 学习笔记 窗口函数(OVER)
2024-01-27 09:50:49
HTML+CSS 模仿Windows 7 桌面效果
2010-06-17 14:33:00
![](https://img.aspxhome.com/file/UploadPic/20106/17/1044050-15s.png)
CentOS 7安装Mysql并设置开机自启动的方法
2024-01-27 05:32:47
Django 中间键和上下文处理器的使用
2022-04-19 05:04:56
![](https://img.aspxhome.com/file/2023/7/83667_0s.png)
使用python爬取微博数据打造一颗“心”
2022-05-28 22:30:09
![](https://img.aspxhome.com/file/2023/3/103653_0s.png)
python中while循环语句用法简单实例
2021-12-03 22:34:44
python 运算符 供重载参考
2021-01-20 01:15:45
Python中Turtle库改变画笔(海龟)方向的两种方法总结
2022-04-21 11:09:52
![](https://img.aspxhome.com/file/2023/3/78823_0s.png)
CSS解决未知高度的垂直水平居中自适应问题
2009-03-17 17:06:00
PHP Laravel实现文件下载功能
2023-11-18 12:20:27
跨浏览器让javascript文件携带图片数据
2011-03-31 17:12:00
Python图像处理库PIL详细使用说明
2021-10-14 17:43:44
整理各种js按比例缩放图片方法
2007-09-27 20:01:00
详解Python的迭代器、生成器以及相关的itertools包
2022-07-24 01:03:44
Django项目如何给数据库添加约束
2023-08-10 14:49:39
![](https://img.aspxhome.com/file/2023/4/62014_0s.jpg)
关于MySql 10038错误的完美解决方法(三种)
2024-01-27 06:16:18
Python正确重载运算符的方法示例详解
2022-01-13 21:35:42
SQL实现LeetCode(181.员工挣得比经理多)
2024-01-17 03:15:01
python事件驱动event实现详解
2021-07-27 21:17:04
![](https://img.aspxhome.com/file/2023/2/82742_0s.jpg)