sencha touch 如何获得list中选中项的元素(element)
2012-06-10 01:36
537 查看
原理:通过使用Ext.select()方法选中list中选中的item的元素
原文:http://www.sencha.com/forum/showthread.php?174989-get-list-item-component-x-y-position-in-an-item-tap-event
Sencha Touch 交流 QQ 群 224711028 欢迎您的加入。
文档源代码:
?
获得element后我们可以对元素进行附加样式的操作:
?
附:Ext.select方法API:
select( String/HTMLElement[]
selector, [HTMLElement/String root] ) : Ext.dom.CompositeElementLite
Selects elements based on the passed CSS selector to enable Element methods
to be applied to many related elements in one statement through the returned CompositeElementLite object.
selector : String/HTMLElement[]
The CSS selector or an array of elements
root : HTMLElement/String (optional)
The root element of the query or id of the root
Ext.dom.CompositeElementLite
原文:http://www.sencha.com/forum/showthread.php?174989-get-list-item-component-x-y-position-in-an-item-tap-event
Sencha Touch 交流 QQ 群 224711028 欢迎您的加入。
文档源代码:
//get my view, which is just a sized down Ext.Sheet varview = this.getItemMenuView().create(); //note that the quotes around the itemindex value here are required to include and don't seem to be in the sencha docs; this function was failing until I included the quotes varitemEl = Ext.select("div.x-list-item[itemindex=\""+ idx + "\"]", listCmp.getId() ); //I know that the array returned by Ext.select above will only ever be a single element array, so we just grab the first element here varel = itemEl.first(); varx = el.getX(); vary = el.getY(); varsize = el.getSize(); x = x + size.width / 2; y = y + size.height; view.setTop(y); view.setLeft(10); view.show(); }
?
获得element后我们可以对元素进行附加样式的操作:
varitemEl = Ext.select(".x-item-selected", myApp.getSectionList().getId() ); varel = itemEl.first(); console.log(itemEl); console.log(el); Ext.get(el).addCls('search-item-active');
?
select( String/HTMLElement[]
selector, [HTMLElement/String root] ) : Ext.dom.CompositeElementLite
Selects elements based on the passed CSS selector to enable Element methods
to be applied to many related elements in one statement through the returned CompositeElementLite object.
Parameters
selector : String/HTMLElement[]The CSS selector or an array of elements
root : HTMLElement/String (optional)
The root element of the query or id of the root
Returns
Ext.dom.CompositeElementLite
相关文章推荐
- sencha-touch1.1-combobox(selectfield)如何获得选中的value
- 如何在点击sencha-touch-list中通过点击item获得所在的绑定字段
- sencha-touch1.1中如何对list表item进行选中
- sencha touch 2中list如何动态添加或移除一个button
- Sencha touch中Ext.List如何高度自适应的解决方法
- 学习笔记之Document Object Model(1)——如何使用document获得文档元素(element对象)
- sencha touch 2中list如何动态添加或移除一个button
- 如何在sencha touch 生成模板的阶段获得json数据
- VC2005中list control控件如何获得选中的行
- 如何在sencha touch中将选中的item状态自动变为不选中
- sencha touch中list如何撑满整个view
- sencha touch中list如何撑满整个view
- 如何在Sencha Touch List Item中添加一个Button
- sencha touch 1.1中如何不用proxy 获得wcf传入的jsonp数据
- sencha touch中list如何撑满整个view
- check: 获得所有呗选中的checked标签的元素值 mapArrayElement(arrEles)
- sencha touch 2中list如何动态添加或移除一个button
- 如何获得list<T>中的元素值
- jquery如何根据多选框name来获得选中的值
- sencha touch 2 tabpanel中List的不显示问题,解决方案