{ "id": "86388", "key": "TIMOB-7673", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16092", "description": "2014 Sprint 08", "name": "2014 Sprint 08", "archived": true, "released": true, "releaseDate": "2014-04-24" }, { "id": "16093", "description": "2014 Sprint 08 SDK", "name": "2014 Sprint 08 SDK", "archived": true, "released": true, "releaseDate": "2014-04-24" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-04-17T17:34:56.000+0000", "created": "2012-02-13T03:24:34.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "module_api", "qe-closed-3.3.0", "qe-testadded" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "issuelinks": [ { "id": "48674", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "150426", "key": "TIDOC-2282", "fields": { "summary": "Documentation for insertAt and replaceAt is missing", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "17495", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "92293", "key": "TIMOB-9225", "fields": { "summary": "iOS: Review composite layout feature requests", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-08-14T14:39:50.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "h2. Problem\r\n\r\nIn dynamic scenarios, we often need to add view components at specific positions in parent view container. For example, if parent view container has 3 child view components, we may want to add view at first position (\"add\" always adds at the end).\r\n\r\n\r\nCurrently, this is not possible to do natively in Titanium, but it's very useful feature which Titanium should have supported natively.\r\n\r\nh2. Workaround\r\n\r\nAs a workaround, this approach can be used: https://gist.github.com/1485751\r\n\r\n\r\nIt works fine for small number of child elements, but for large number of child elements there could be performance drop.\r\n\r\nh2. Solution\r\n\r\nImplement those functionality for all view-like components (for those components that can contain other components). I suggest following syntax:\r\n\r\n{code}\r\nview.replaceAt(1, Ti.UI.createButton()); //replaces child element at index 1 with a button\r\nview.insertAt(1, Ti.UI.createButton()); //adds a button at index 1\r\n{code}", "attachment": [], "flagged": false, "summary": "Ti API: \"replaceAt\", \"insertAt\", and \"getAt\" functionality for view-like UI components", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [ { "id": "112222", "key": "TIMOB-13386", "fields": { "summary": "Specification: Create Ti.UI.View.replaceAt/insertAt/getAt specification", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } ], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": null, "comment": { "comments": [ { "id": "183182", "author": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "body": "It's the implementation of this :\r\n\r\nhttps://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/cl/UIView\r\n\r\ninsertSubview:atIndex:\r\n", "updateAuthor": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "created": "2012-02-15T06:22:01.000+0000", "updated": "2012-02-15T06:22:01.000+0000" }, { "id": "183312", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We already offer the {{zindex}} property of views to determine where they are displayed in a hierarchical layer:\r\n\r\nhttp://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.View.zIndex-property.html\r\n\r\nIf there is a rationale for this beyond view layer positioning the ticket must be updated to include:\r\n\r\n* A sample use case\r\n* A valid justification for the feature\r\n* An explanation of why existing features cannot be used in place\r\n\r\nIt is worth noting that, in addition, the implementation of {{zindex}} on iOS places the view in the layer position exactly as this ticket describes is desirable.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-15T15:39:13.000+0000", "updated": "2012-02-15T15:40:08.000+0000" }, { "id": "183364", "author": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "body": "Hi Stephen,\r\n\r\nhere a simple but usefull case :\r\nImagine, you want to create a huge scrollableView with 500 views Inside (for my case). It's impossible to load every views on start as you know there will be a lack of memory. So you need to populate dynamically your scrollableView. \r\n\r\nA part of the algorithm :\r\n- On start you create 3 views with page 1, 2, 3. \r\n- Imagine myapp.myScrollableView.currentPage is on 2, at index 1. If there's a scroll to the right, the current page is 3 and myapp.myScrollableView.currentPage = 2. There's no page to the right ... so you make myapp.myScrollableView.addView(myapp.createPage(4)) and then you remove the first myapp.myScrollableView.removeView(myapp.myScrollableView.views[0]). There's no problem with this case but ...\r\n\r\nThe other part that cause problem\r\n- Imagine you have pages 2, 3 and 4, myapp.myScrollableView.currentPage = 1 and the current page is 3.\r\n- Now there's a scroll to the left so the current page is 2, myapp.myScrollableView.currentPage = 0 and there's no page on left side so ... you need to add a view to the left, that is to say ADDING a page to the BEGINNING of myapp.myScrollableView.views and remove the last views myapp.myScrollableView.removeView(myapp.myScrollableView.views[2]\r\n\r\nA solution on ipad 2 :\r\nIf you use a simple array (myarray) in which you can add any item at the beginning etc.\r\nYou just have to write :\r\n\r\nmyapp.myScrollableView.views = myarray\r\n\r\nbut this will make the view winkle.\r\n\r\n{code}\r\n(function(){\r\nmyapp = {]\r\nmyapp.win = Ti.UI.createWindow();\r\n\r\nvar page1 = Ti.UI.createView({ backgroundColor:'#123' });\r\nvar page2 = Ti.UI.createView({ backgroundColor:'#246' });\r\nvar page3 = Ti.UI.createView({ backgroundColor:'#48b' });\r\n\r\nmyapp.myScrollableView = Ti.UI.createScrollableView({\r\n views:[page1,page2,page3],\r\n showPagingControl:true\r\n});\r\n\r\nmyapp.myScrollableView.addEventListener('scroll', myapp.scrollHandler);\r\nmyapp.scrollHandler = function(){\r\n // if go to the right\r\n if(myapp.myScrollableView.currentPage == 2){\r\n // add at the end\r\n // remove the first\r\n \r\n }\r\n // if go to the left\r\n if(myapp.myScrollableView.currentPage == 0){\r\n // add to the begin\r\n // remove the last\r\n }\r\n}\r\n})();\r\n\r\n{code}", "updateAuthor": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "created": "2012-02-16T00:04:52.000+0000", "updated": "2012-02-16T00:04:52.000+0000" }, { "id": "183365", "author": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "updateAuthor": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "created": "2012-02-16T00:05:26.000+0000", "updated": "2012-02-16T00:05:26.000+0000" }, { "id": "183366", "author": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "body": "Thank you very much :)", "updateAuthor": { "name": "max", "key": "max", "displayName": "process", "active": true, "timeZone": "Europe/Paris" }, "created": "2012-02-16T00:08:44.000+0000", "updated": "2012-02-16T00:08:44.000+0000" }, { "id": "183368", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "OK, I experimented with \"zIndex\" property and it does exactly what is wanted in this ticket (on Android also).\r\n\r\n\r\nBut why that property is called \"*z*Index\" when it arranges elements in x or y axis when parent element's layout property is set to \"horizontal\" or \"vertical\"? I thought it should arrange elements in z axis only (it seems natural to assume \"zIndex\" does similar thing as it does in CSS: https://developer.mozilla.org/en/Understanding_CSS_z-index).\r\n\r\n\r\nBecause of that, I think that name \"zIndex\" is not the best choice. I assume \"xyzIndex\" name is out of question :) (\"stackIndex\" maybe ... ) so at least behavior of \"zIndex\" should be properly documented (by that I mean documentation should contain explanation of \"zIndex\" behavior when different layouts are defined).\r\n\r\n\r\n\r\nIMHO, real solution would be:\r\n\r\n* leave \"zIndex\" property, but make it work only when parent element's \"layout\" property is set to \"absolute\" (there is no point in using \"zIndex\" with \"vertical\" and \"horizontal\" layout because there is no way elements will overlap)\r\n* implement methods from this ticket (as it is described below \"Solution\" header)\r\n\r\n\r\n\r\nThat way:\r\n* \"zIndex\" would do exactly what its name says\r\n* it would be much clearer how to add element at specific position\r\n\r\nWhen developer asks how to add element at specific position, the answer would be:\r\n\r\n* use \"insertAt\" method\r\n\r\ninstead of:\r\n\r\n* use \"zIndex\" (that is not really \"z\" index), but you need to make sure parent element has layout property defined as \"horizontal\" or \"vertical\" because if layout is set to \"absolute\" \"zIndex\" does what its name says it does. Also, you need to set \"zIndex\" to all child elements to get this work and you need to be careful not to f*ck up indexes when inserting at specific position (different views can have same values for \"zIndex\").\r\n\r\n\r\nIn the end ... I know this is fairly trivial issue that can be solved relatively easily. But leaving things as they are now leads developers to frustration because Titanium behavior differences from behavior they are familiar with and they need to do work and loose time to find and implement basic functionality that is naturally to have.\r\n\r\n\r\nI personally don't have great interest in this ticket (hey, I wrote a workaround long time ago), I reported this because I think this kinds of basic functionality, that is intuitive and easy to use, makes developers happy and is must have in framework. :)", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-16T02:51:11.000+0000", "updated": "2012-02-16T02:51:11.000+0000" }, { "id": "183410", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It's called {{zindex}} because that's what it does. Where views are placed in the {{children}} of a view determines the layered display order.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-16T10:12:06.000+0000", "updated": "2012-02-16T10:12:06.000+0000" }, { "id": "183526", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "But it doesn't do what its name says:\r\n\r\n\r\nIn CSS 2.1, each box has a position in three dimensions. In addition to their horizontal and vertical positions, boxes lie along a \"z-axis\" and are formatted one on top of the other. Z-axis positions are particularly relevant when boxes overlap visually. (from CSS 2.1 Section 9.9.1 - Layered presentation) \r\n\r\n\r\nHere is a picture also: http://msdn.microsoft.com/en-us/library/bb980110%28v=vs.95%29.aspx\r\n\r\n\r\n\r\nWhen parent element has layout defined as \"absolute\", then it does what its name says (and it's identical functionality to the one that already exists in other technologies), otherwise it does something else (it's similar thing, but it works in other dimensions).\r\n\r\n\r\n\r\nAnyway ... we usually need to insert element at specific position after content has rendered. To do that, we need to add z-indexes initially (before content is rendered) when child views are added:\r\n\r\n{code}\r\nparent.add(child1);\r\nchild1.zIndex = parent.children.length - 1; //zIndex = 0\r\nparent.add(child2);\r\nchild2.zIndex = parent.children.length - 1; //zIndex = 1\r\nparent.add(child3);\r\nchild3.zIndex = parent.children.length - 1; //zIndex = 2\r\n...\r\n{code}\r\n\r\n\r\nNow, if I want to add element at second position (index 1):\r\n\r\n{code}\r\nparent.add(child22);\r\nchild22.zIndex = 1;\r\n{code}\r\n\r\n\r\nSince there is \"child2\" with \"zIndex\" set to 1, to get this work I need to increment \"zIndex\" to all child elements:\r\n\r\n{code}\r\nfor (var i = index + 1; i < parent.children.length; ++i) {\r\n parent.children[i].zIndex = i;\r\n}\r\n{code}\r\n\r\n\r\n\r\n\r\nCompare that approach with suggested approach:\r\n\r\n\r\n{code}\r\nparent.add(child1);\r\nparent.add(child2);\r\nparent.add(child3);\r\n...\r\n{code}\r\n\r\n\r\n{code}\r\nparent.insertAt(1, child22);\r\n{code}\r\n\r\n\r\nTwo times less code, no DRY, no need to wrap that functionality into Titanium UI wrappers, better performance, right semantic.\r\n\r\n\r\n\r\nIf don't find that reasons justified, then I don't have anything else to say, except:\r\n\r\n\r\n\r\n\r\niQuit :)\r\n\r\n\r\n\r\n\r\nP.S. JFTR, this feature request is labeled as \"iOS\", while my initial request was made for all platforms.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-17T01:39:51.000+0000", "updated": "2012-02-17T01:39:51.000+0000" }, { "id": "183632", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "There are a couple of things at issue here but I'm going to start an internal technical discussion about this feature. The way zindex operates with horiz/vert layout needs to be resolved at the very least.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-17T10:15:21.000+0000", "updated": "2012-02-17T10:15:21.000+0000" }, { "id": "183639", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ivan -\r\n\r\nIt's been requested that you give PE some more information about the {{zindex}} problems. The documentation is supposed to be correct - if {{zindex}} is doing anything other than interacting with the z-positioning layer of views on either platform (positioning within the subview order is a nice side-effect on iOS only it seems), that is a bug. Addressing {{zindex}} issues directly is a separate issue, so please file a bug report for that instead of adding to this feature request.\r\n\r\nIt seems like the feature that you're requesting would only be particularly useful for vert/horiz layout (again, {{zindex}} should be doing the view layering positioning correctly for composite, since where a view is placed in the hierarchy there only determines where it lives in the layered draw order) but both platforms could easily support this capability as an optional argument to {{Ti.UI.View.add()}}.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-17T11:00:21.000+0000", "updated": "2012-02-17T11:00:54.000+0000" }, { "id": "183643", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "On Mobile Web zIndex follows ths CSS spec as described by Ivan: it arranges elements along the z-axis only. In a horizontal or vertical layout, zIndex has no effect, since controls can't overlap.\r\n\r\nInternally we already have an _insertAt(view,index) method that we use all the time. It is extremely useful for doing horizontal/vertical layout operations. For example, we use it when inserting a tab into a tabgroup. This method internally calls the insertBefore method exposed by the DOM.\r\n\r\nI am _*strongly*_ in favor of making z-index only affect the z-axis and adding an insertAt method (or some similar method/set of methods). Having z-index affect something other than the z-axis is very unintuitive, and also makes it context sensitive (which is a parity and documentation hassle).", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-17T11:29:00.000+0000", "updated": "2012-02-17T11:29:00.000+0000" }, { "id": "183743", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Stephen,\r\n\r\nI don't know what \"PE\" stands for? :)\r\n\r\n\r\nIn the documentation, \"zIndex\" is explained this way: \"Z index position relative to other sibling views.\"\r\nThat seems very generic explanation, maybe there should be mention of z-axis (for people not familiar with \"zIndex\" from other technologies) and that it works (will work) only when \"absolute\" layout is used.\r\n\r\n\r\nOptional argument to \"add\" method seems fine from technical point of view, although I like clear and dont-make-me-think method names (like \"insertBefore\", \"insertAt\", \"insertAfter\" - although they all could use just one method in the background).", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-20T01:37:10.000+0000", "updated": "2012-02-20T01:37:10.000+0000" }, { "id": "191574", "author": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Based on the comments, it sounds like there's some support for this feature request, so reopening.", "updateAuthor": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-18T08:54:33.000+0000", "updated": "2012-04-18T08:54:33.000+0000" }, { "id": "191576", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "+1 I really really think we should implement this feature. FWIW Mobile Web already has this feature using the (undocumented, hidden) method _insertAt().", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-18T08:58:13.000+0000", "updated": "2012-04-18T08:58:13.000+0000" }, { "id": "192350", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-04-24T02:32:07.000+0000", "updated": "2012-04-24T02:32:07.000+0000" }, { "id": "223186", "author": { "name": "kabriel", "key": "kabriel", "displayName": "Kabriel Robichaux", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It surprises me that even Ti 3.0 doesn't yet have the ability to add a child at a specific index. This seems like a foundational feature that is clearly supported by the underlying system. What will it take to get insertAt added? It sounds like the zIndex conversation might have sidetracked this request. zIndex doesn't seem to have any influence over the x,y position of children views in horizontal or vertical layouts (as was implied by some posts here).", "updateAuthor": { "name": "kabriel", "key": "kabriel", "displayName": "Kabriel Robichaux", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-11T21:56:33.000+0000", "updated": "2012-10-11T21:56:33.000+0000" }, { "id": "225452", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "This is most useful when using layout vertical/horizontal. zIndex does not work in that case.\r\n\r\nh3. Example code\r\n{code}\r\n\r\nvar win = Ti.UI.currentWindow;\r\nwin.backgroundColor = '#ccc';\r\nwin.layout = 'vertical';\r\n\r\nvar red = Ti.UI.createView({\r\n backgroundColor: 'red',\r\n width: Ti.UI.FILL,\r\n height: 90,\r\n zIndex: 2\r\n});\r\n\r\nvar green = Ti.UI.createView({\r\n backgroundColor: 'green',\r\n width: Ti.UI.FILL,\r\n height: 100, \r\n zIndex: 3\r\n});\r\n\r\nvar blue = Ti.UI.createView({\r\n backgroundColor: 'blue',\r\n width: Ti.UI.FILL,\r\n height: 120,\r\n zIndex: 1\r\n});\r\nwin.add(red);\r\nwin.add(blue);\r\nwin.add(green);\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-29T23:11:13.000+0000", "updated": "2012-10-29T23:11:13.000+0000" }, { "id": "226212", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Note that because zIndex works differently, having a zIndex on views and using these proposed methods is UNDEFINED. In other words, if we implement them, and you use them, and you have an issue with views that have zIndex, that issue is invalid.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-05T22:00:42.000+0000", "updated": "2012-11-05T22:00:42.000+0000" }, { "id": "240249", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "While we would really like to achieve this for 3.1.0, we don't have the bandwidth with other outstanding features. My goal is to get this in 3.2.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-28T21:05:28.000+0000", "updated": "2013-02-28T21:05:28.000+0000" }, { "id": "240257", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I want to add that we depricate zindex. This would replace the original need for zIndex, and be much more performant.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-28T21:43:14.000+0000", "updated": "2013-02-28T21:43:14.000+0000" }, { "id": "240474", "author": { "name": "johncblandii", "key": "johncblandii", "displayName": "John C. Bland II", "active": true, "timeZone": "America/Chicago" }, "body": "+100 for adding insertAt. I'd also vote for removeAt and a getViewAt; basically rounding out the ability to add, remove and get a view at a specific location.\r\n\r\nMaybe another ticket could be added for a removeAllViews() method too. ;-)", "updateAuthor": { "name": "johncblandii", "key": "johncblandii", "displayName": "John C. Bland II", "active": true, "timeZone": "America/Chicago" }, "created": "2013-03-03T04:18:43.000+0000", "updated": "2013-03-03T04:18:43.000+0000" }, { "id": "240475", "author": { "name": "johncblandii", "key": "johncblandii", "displayName": "John C. Bland II", "active": true, "timeZone": "America/Chicago" }, "body": "Here is an initial implementation of an insertViewAt in use in my app: https://gist.github.com/johncblandii/5074660. It is based on the gist linked above but modified.\r\n\r\nI haven't performance tested it but I definitely don't like the idea of removing every element first then adding them back. For now, it will work but would love to see a true implementation.", "updateAuthor": { "name": "johncblandii", "key": "johncblandii", "displayName": "John C. Bland II", "active": true, "timeZone": "America/Chicago" }, "created": "2013-03-03T05:38:48.000+0000", "updated": "2013-03-03T05:38:48.000+0000" }, { "id": "246703", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I have created a very simple extension to TiViewProxy for iOS, the drawback is that the parent view flashes... \n\nhttps://gist.github.com/pec1985/5348549", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-04-09T19:20:19.000+0000", "updated": "2013-04-09T19:20:19.000+0000" }, { "id": "283614", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/5109", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T20:42:33.000+0000", "updated": "2013-12-10T20:42:33.000+0000" }, { "id": "283620", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test code for the above PR:\n{code}\nvar win = Titanium.UI.createWindow({\n\tlayout: 'vertical'\n});\n\nvar optionsView = Ti.UI.createView({\n\theight: 50,\n\tbackgroundColor: '#ccc'\n});\n\nvar insertButton = Ti.UI.createButton({\n\tleft: 0,\n\twidth: 100,\n\ttitle: 'insertAt 2'\n});\n\nvar replaceButton = Ti.UI.createButton({\n\tright: 0,\n\twidth: 100,\n\ttitle: 'replaceAt 4'\n});\n\noptionsView.add(insertButton);\noptionsView.add(replaceButton);\n\nwin.add(optionsView);\n\nfor(var i = 0; i < 10; i++) {\n\twin.add(Ti.UI.createView({\n\t\theight: 30,\n\t\tbackgroundColor: 'green',\n\t\ttop: 5\n\t}));\n}\nwin.open();\n\nvar flag1 = 0;\nvar flag2 = 0;\ninsertButton.addEventListener('click', function() {\n\twin.insertAt({\n\t\tview: Ti.UI.createLabel({\n\t\t\ttop: 5, width: Ti.UI.FILL, height: 50,\n\t\t\ttext: 'insertAt',\n\t\t\tbackgroundColor: flag1++ % 2 ? 'blue' : 'red'\n\t\t}),\n\t\tposition: 2\n\t});\n});\nreplaceButton.addEventListener('click', function() {\n\twin.replaceAt({\n\t\tview: Ti.UI.createLabel({\n\t\t\ttop: 5, width: Ti.UI.FILL, height: 50,\n\t\t\ttext: 'replaceAt',\n\t\t\tbackgroundColor: flag2++ % 2 ? 'yellow' : 'orange'\n\t\t}),\n\t\tposition: 4\n\t});\n});\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T20:59:17.000+0000", "updated": "2013-12-10T20:59:17.000+0000" }, { "id": "301262", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "We have only implemented insertAt and replaceAt on iOS and Android. getAt is not required since you can always do view.children[i] to get equivalent functionality\r\n\r\nPR merged", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-04-17T17:34:56.000+0000", "updated": "2014-04-17T17:34:56.000+0000" }, { "id": "302152", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with test environment:\r\nAppc-Studio:3.3.0.201404211130\r\nsdk:3.3.0.v20140422163054\r\nacs:1.0.14\r\nalloy:1.4.0-dev\r\nnpm:1.3.2\r\ntitanium:3.3.0-dev\r\ntitanium-code-processor:1.1.1-beta1\r\nxCODE:5.1.1\r\nDevice:Iphone5s(7.1.1),LG-P970(v4.0.4)\r\n\r\nTi API \"replaceAt\" and \"insertAt\" working fine in both android and ios.", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T09:44:19.000+0000", "updated": "2014-04-23T09:44:19.000+0000" } ], "maxResults": 27, "total": 27, "startAt": 0 } } }