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();
  • 相关阅读:
    bzoj1066: [SCOI2007]蜥蜴(最大流)
    bzoj4551: [Tjoi2016&Heoi2016]树(树链剖分)
    bzoj2663: [Beijing wc2012]灵魂宝石(二分+匈牙利)
    bzoj2150: 部落战争(匈牙利)
    bzoj1797: [Ahoi2009]Mincut 最小割(最小割+强联通tarjan)
    bzoj3993: [SDOI2015]星际战争(网络流)
    bzoj3504: [Cqoi2014]危桥(网络流)
    bzoj3212: Pku3468 A Simple Problem with Integers(线段树)
    bzoj4590: [Shoi2015]自动刷题机(二分答案)
    [WC2013]糖果公园
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2403313.html
Copyright © 2011-2022 走看看