Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2187] iOS: TableView index without index attribute

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-07-15T18:08:57.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsindex, ios, tableview
ReporterMatej
AssigneeMauro Parra-Miranda
Created2013-05-13T12:00:42.000+0000
Updated2016-03-08T07:41:10.000+0000

Description

If I have table view with index (Index contain whole alphabet) ,but in the table view I've got only values with "A", "B", "C", "D" (In all 300 - for example). When I click on the letter A/B/C/D there isn't no problem, I can see values which start with letter... But when I click for example to letter "E" or higher (Values where isn't set index in index array) then TableView automatically scroll to top on first letter "A". This is a big problem when I have values A->E then for example F/G is empty and rest is also set. When somebody click on the letter "F" tableview show letter "A". It has to stay on the last letter no scroll to first... I know that I can solve this "somehow" ,but that is annoying. Much better is fixed the "main" bug than every time solve... Thanks you so much * app.js (From KitchenSink)*
var win = Titanium.UI.createWindow();

var data = [
	{title:'Alan (click to change index)', hasChild:true, header:'A'},
	{title:'Alice', hasDetail:true},
	{title:'Alexander'},
	{title:'Amos'},
	{title:'Alonzo'},
	{title:'Brad', header:'B'},
	{title:'Brent'},
	{title:'Billy'},
	{title:'Brenda'},
	{title:'Callie', header:'C'},
	{title:'Cassie'},
	{title:'Chris'},
	{title:'Cameron'},
	{title:'Don', header:'D'},
	{title:'Dilbert'},
	{title:'Deacon'},
	{title:'Devin'},
	{title:'Darin'},
	{title:'Darcy'},
	{title:'Erin', header:'E'},
	{title:'Erica'},
	{title:'Elvin'},
	{title:'Edrick'},
	{title:'Frank', header:'F'},
	{title:'Fred'},
	{title:'Fran'},
	{title:'Felicity'},
	{title:'George', header:'G'},
	{title:'Gina'},
	{title:'Gary'},
	{title:'Herbert', header:'H'},
	{title:'Henry'},
	{title:'Harold'},
	{title:'Ignatius', header:'I'},
	{title:'Irving'},
	{title:'Ivan'},
	{title:'Dr. J', header:'J'},
	{title:'Jefferson'},
	{title:'Jenkins'},
	{title:'Judy'},
	{title:'Julie'},
	{title:'Kristy', header:'K'},
	{title:'Krusty the Clown'},
	{title:'Klaus'},
	{title:'Larry', header:'L'},
	{title:'Leon'},
	{title:'Lucy'},
	{title:'Ludwig'},
	{title:'Mary', header:'M'},
	{title:'Mervin'},
	{title:'Malcom'},
	{title:'Mellon'},
	{title:'Ned', header:'N'},
	{title:'Nervous Eddie'},
	{title:'Nelson'},
	{title:'The Big O', header:'O'},
	{title:'Orlando'},
	{title:'Ox'},
	{title:'Pluto', header:'P'},
	{title:'Paris'},
	{title:'Potsie'}
];

var tableview = Titanium.UI.createTableView({ data:data });

var index = [
	{title:'A',index:0},
	{title:'B',index:5},
	{title:'C',index:9},
	{title:'D',index:13},
	{title:'E',index:19},
	{title:'F',index:23},
	{title:'G',index:27},
	{title:'H'},
	{title:'I',index:33},
	{title:'J',index:36},
	{title:'K',index:41},
	{title:'L',index:44},
	{title:'M',index:48},
	{title:'N',index:52},
	{title:'O',index:55},
	{title:'P',index:(data.length -1)}
];

tableview.index = index;
win.add(tableview);
win.open();
(Click on "A" and slow slide down to "P". If you will be on the letter "H" where isn't set any index param you will see first letter ("A"). That is the bug. If there isn't any index table can't show first letter. It must stay on last index/letter...)

Comments

  1. Daniel Sefton 2013-05-13

    Hi Matej, Please provide a simple reproducible test case that we can drop into an app.js and run. Thanks!
  2. Matej 2013-05-15

    Done ;)
  3. Matej 2013-06-16

    Please can you edit "Needs more info". I already added info... Thanks
  4. Matej 2013-06-28

    ???
  5. Daniel Sefton 2013-07-15

    Hi Matej, I can't reproduce this on iOS 6 simulator with Ti SDK 3.1 GA or 3.2 CI. Clicking E scrolls to E values, F scrolls to F values etc.
  6. Matej 2013-07-15

    Hi, what about H?
  7. Daniel Sefton 2013-07-15

    Oh I see, the description needs changing...
  8. Daniel Sefton 2013-07-15

    Didn't see the part below the test case, my apologies.
  9. Daniel Sefton 2013-07-15

    So basically you're saying that if no index attribute is set, then clicking on the index shouldn't scroll to the top, it should just stay put and do nothing? By default the index is 0, so in that respect it makes sense.
  10. Matej 2013-07-15

    Exactly. For example application Contacts (Alphabetical list...) that you can find in an iPhone is working like this. It is much better than...
  11. Daniel Sefton 2013-07-15

    Yes, you're right. I'll clean up the issue and move to Ti Mob. Tested and confirmed on iOS 6 simulator with Ti SDK 3.1.1 GA and 3.2 CI.
  12. Daniel Sefton 2013-07-15

    Actually, the behavior I saw in the contacts app was that it scrolled to the nearest index with content when tapping an index with no content. The behavior in Titanium is exactly the same. The fact is that if you don't set an index attribute, the index attribute is 0 by default. In the contacts app I guess they do set the index attribute for all alphabet values. So my question is why do you need to omit the index attribute for some indexes?
  13. Matej 2013-07-16

    OK so when I want to have in my application same behavior like in contacts app I have to set every index. Isn't it easier to make it automatically by Titanium?
  14. Daniel Sefton 2013-07-17

    Correct. Well I suppose Titanium could set the index to be the array position, but I don't see much of a need to make this change (there are only 26 letters in the alphabet you need to set it for), and it may break apps which rely on being able to set the index manually.

JSON Source