Work

不会做fe的rd不是好op

这几天折腾前端 jquery, ajax, javascript, css, html都接触了那么点点
jquery:    
   选择器$('#id')   
   事件$().on('click'/'keyup')   
   效果$().html().treeview()

ajax:    
   type: post/get   
   dataType: json/html   
   success/error: callback   
   请求比php的curl简单

css:   
   对应htmlOption的class=treeview   
   图片url为css文件所在的相对路径

html:   
   <buttion id='search-domain'>       
      id对应了js中的选择器id 一般button会有相应的.on事件   
   <input name='a1' id='domain-prefix' type='text'>   
   <div id='show-result'></div>       
      可以用js$('show-result').html() 直接在div中插入html代码

了解的不多,但是编写一个基本的html请求从前到后再到前基本能用了

最后简介一下yii的ctreeview用法
首先按照CTreeView的data格式构造data内容
$data = array(
  'text'=>内容
   'expanded'=>默认折叠还是展开
   'children'=>子节点
)
在view里可以直接调用:
$this->widget('CTreeView', array('data'=>$data,'htmlOption'=>array('id'=>'domain-dns-list','class'=>'treeview')))
也可以在后端返回:
$this->response(array('status'=>0, 'data'=>CTreeView::saveDataAsHtml($data)));
CTreeView的savaDataAsHtml函数会将$data生成树图的html代码然后封装成字符串
然后在前端的js中通过ajax来请求得到json格式的response, 取出data, 用js的:
$('#').html(response.data).treeview() 
就可以展示这颗折叠树了

最后我败在了saveDataAsHtml上。。 遇到问题 第一个要查手册

posted on 2012-11-01 12:04 lonelycastle 阅读(128) 评论(0)  编辑 收藏 引用 所属分类: work


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理