zoukankan      html  css  js  c++  java
  • titanium开发教程0409删除rows

    12

    // this sets the background color of the master UIView (when there are no windows/tab groups on it)
    Titanium.UI.setBackgroundColor('#000');
    
    // create tab group
    var tabGroup = Titanium.UI.createTabGroup();
    
    var win = Titanium.UI.createWindow({  
        title:"Main Window",
        backgroundColor:"#FFFFFF",
        //navBarHidden:true, //Hide the nav bar for the window
        tabBarHidden:true //Hide the tab bar for the window
    });
    var tab = Titanium.UI.createTab({  
        icon:"KS_nav_views.png",
        title:"Main Tab",
        window:win
    });
    
    var data = [
    	{title:"Backpack Cal", leftImage:"images/01-backpack-cal-thumb.png", className:"tableRow", hasCheck:true},
    	{title:"California Calm", leftImage:"images/02-calm-cal-thumb.png", className:"tableRow", hasDetail:true},
    	{title:"California Hotsprings", leftImage:"images/03-hotsprings-cal-thumb.png", className:"tableRow", hasChild:true},
    	{title:"Cycle California", leftImage:"images/04-cycle-cal-thumb.png", className:"tableRow"},
    	{title:"From Desert to Sea", leftImage:"images/05-desert-cal-thumb.png", className:"tableRow"},
    	{title:"Kids California", leftImage:"images/06-kids-cal-thumb.png", className:"tableRow"},
    	{title:"Nature Watch", leftImage:"images/07-nature-watch-cal-thumb.png", className:"tableRow"},
    	{title:"Snowboard Cali", leftImage:"images/08-snowboard-cal-thumb.png", className:"tableRow"},
    	{title:"Taste of California", leftImage:"images/09-taste-cal-thumb.png", className:"tableRow"}
    ]
    
    var tableView = Titanium.UI.createTableView({
    	data:data,
    	editable:true,
    	allowsSelectionDuringEditing:true
    	
    });
    
    //Tap a row to delete it
    tableView.addEventListener("click",function(e){
    	//Switch between the editing and non-editing mode
    	/*
    	if(!tableView.editing){
    		tableView.editing = true;
    	}else{
    		tableView.editing = false;
    	}
    	*/
    	//Android: use deleteRow
    	tableView.deleteRow(e.index);
    })
    
    //Restore the row; exit editing mode
    tableView.addEventListener("delete",function(e){
    	tableView.editing = false;
    })
    
    win.add(tableView);
    
    tabGroup.addTab(tab);  
    
    // open tab group
    tabGroup.open();
  • 相关阅读:
    重读数据结构——严蔚敏C语言版
    Tcp/Ip网络通讯初探
    XMLHttpRequest post 传递多个参数及服务器端读取
    HDOJ 1106 排序 (字符串处理)
    用Java创建数组工具类ArrayTool
    自己动手编写一个VS插件(三)——创建工具栏之一
    「译」JavaScript 的怪癖 1:隐式类型转换
    javascript 中强制执行 toString()
    VS 2008的64位编译环境的安装和使用
    计算机神书『编码:隐匿在计算机软硬件背后的语言』
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2403313.html
Copyright © 2011-2022 走看看