Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.32 KB | None | 0 0
  1. /*
  2. * custom tempalte
  3. */
  4. var myTemplate = { childTemplates: [ { type : 'Ti.UI.View',
  5. bindId : 'groupHead',
  6. properties: { // top : '2dp',
  7. width : '100%',
  8. height : '55dp',
  9. },
  10. childTemplates : [ { type : 'Ti.UI.View',
  11. bindId : 'groupHeadc',
  12. properties: { width : '40%',
  13. height : '55dp',
  14. left:'0dp',
  15. backgroundImage:'/imgs/pix.png',
  16. backgroundRepeat:true
  17. },
  18. childTemplates : [{ type : 'Ti.UI.Label',
  19. bindId : 'lblGroupTitle',
  20. properties: {color : '#000000',
  21. left : '2dp',
  22. right : '45dp',
  23. height : Ti.UI.SIZE,
  24. width:'100%',
  25. horizontalWrap:true,
  26. font : {
  27. fontSize : '14dp',
  28. fontFamily : customFont
  29. },
  30. }
  31. }]
  32. },
  33. { type : 'Ti.UI.View',
  34. bindId : 'groupc',
  35. properties: { //top : '2dp',
  36. width : '60%',
  37. height : '55dp',
  38. //left:'50%',
  39. right:'0dp',
  40. backgroundImage:'/imgs/pix.png',
  41. backgroundRepeat:true
  42. },
  43. childTemplates : [{ type : 'Ti.UI.Label',
  44. bindId : 'lblGroupc',
  45. properties: {color : '#000000',
  46. left : '2dp',
  47. right : '45dp',
  48. height : Ti.UI.SIZE,
  49. width:'80%',
  50. horizontalWrap:true,
  51. font : {
  52. fontSize : '14dp',
  53. fontFamily : customFont,
  54. //LineHeight:'10dp',
  55. },
  56. }
  57. }]
  58. },
  59. { type : 'Ti.UI.ImageView',
  60. bindId : 'close',
  61. properties: { height : '16dp',
  62. width : '16dp',
  63. right : '5dp',
  64. image : '/imgs/cross-red.png',
  65. bubbleParent : false
  66. },
  67. events : { click : deleteContact }
  68. }
  69. ],
  70. // events : { click: rowClick }
  71. },
  72. ]
  73. };
  74.  
  75. /*
  76. * this function listener to delete row from listview is working
  77. */
  78. function deleteContact(e)
  79. {
  80.  
  81. Ti.API.info("Delete ListView Raw = "+ JSON.stringify(e) );
  82.  
  83. var sectionIndex = 0;
  84.  
  85. Ti.API.info("Raw = "+ e.itemIndex );
  86.  
  87. //not working
  88. grainSection[sectionIndex].deleteItemsAt(e.itemIndex,1);
  89.  
  90. }
  91.  
  92.  
  93. grainSection[s] = Ti.UI.createListSection();
  94. var grainDataSet = [];
  95. var sections = [];
  96.  
  97. listviews[l] = Ti.UI.createListView({ templates: { 'template': myTemplate },
  98. defaultItemTemplate: 'template',
  99. width : "100%",
  100. height : "100%",
  101. // borderRadius : 5,
  102. backgroundColor : "transparent",
  103. caseInsensitiveSearch: true
  104. });
  105. contentView.add(listviews[l] );
  106.  
  107. function deleteContact( e )
  108. {
  109.  
  110. Ti.API.info("Delete ListView Raw = "+ JSON.stringify(e) );
  111. Ti.API.info("Raw = "+ e.itemIndex );
  112. e.section.deleteItemsAt( e.itemIndex, 1 );
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement