最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

輕松學(xué)習(xí)jQuery插件EasyUI EasyUI創(chuàng)建RSS Feed閱讀器

 更新時(shí)間:2022年05月06日 15:03:27   投稿:lijiao  
這篇文章主要幫助大家輕松學(xué)習(xí)jQuery插件EasyUI,我們將通過 jQuery EasyUI框架創(chuàng)建一個(gè)RSS閱讀器,感興趣的小伙伴們可以參考一下

本文實(shí)例講述了通過 jQuery EasyUI框架創(chuàng)建一個(gè)RSS閱讀器,分享給大家供大家參考。具體如下:

運(yùn)行效果截圖如下:

我們將使用以下插件:

layout:創(chuàng)建應(yīng)用的用戶界面。
datagrid:顯示 RSS Feed 列表。
tree:顯示 feed 頻道。

步驟 1:創(chuàng)建布局(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:數(shù)據(jù)網(wǎng)格(DataGrid)處理事件

在這里我們要處理一些由用戶觸發(fā)的事件。

$('#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);
 }
 }
});

本實(shí)例使用 'onSelect' 事件來(lái)顯示 feed 的內(nèi)容,使用 'onLoadSuccess' 事件來(lái)選擇第一行。

步驟 3:樹形菜單(Tree)處理事件

當(dāng)樹形菜單(Tree)數(shù)據(jù)已經(jīng)加載,我們需要選擇第一個(gè)葉子節(jié)點(diǎn),調(diào)用 'select' 方法來(lái)選擇該節(jié)點(diǎn)。 使用 'onSelect' 事件來(lái)得到已選擇的節(jié)點(diǎn),這樣我們就能得到對(duì)應(yīng)的 'url' 值。 最后我們調(diào)用數(shù)據(jù)網(wǎng)格(DataGrid) 的 'load' 方法來(lái)刷新 feed 列表數(shù)據(jù)。

$('#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);
 }
 }
});

以上就是關(guān)于EasyUI創(chuàng)建RSS Feed閱讀器的相關(guān)教程,希望對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論

广州市| 宝丰县| 诸城市| 临沧市| 安吉县| 方山县| 辉县市| 陇西县| 富阳市| 陇西县| 安义县| 三明市| 佛山市| 安义县| 桐梓县| 霍林郭勒市| 揭阳市| 广宁县| 偃师市| 逊克县| 新河县| 酉阳| 汨罗市| 孟州市| 丽水市| 泽普县| 黑河市| 江源县| 平度市| 遵义市| 德保县| 乌鲁木齐市| 潜江市| 海晏县| 东宁县| 天水市| 锦州市| 信丰县| 子洲县| 旬阳县| 营口市|