This is a migrated thread and some comments may be shown as answers.

TKDataSource binding with UI controls in AutoCompleteTextView

4 Answers 45 Views
AutoCompleteTextView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ferdinando
Top achievements
Rank 1
Ferdinando asked on 21 Mar 2016, 11:17 AM

Hi,

I am trying to customize the appearance of the cells in the listView of the AutoCompleteTextView. In my case, for example, I would like to have two lines of text with different information. 

In order to do so, I have seen it is possible to use set the initCell and createCel from TKDataSourceListViewSettings, but this seems to have no effect in this case. Am I doing something wrong?

4 Answers, 1 is accepted

Sort by
0
Accepted
Sophi
Telerik team
answered on 21 Mar 2016, 03:46 PM
Hi Ferdinando,

You can provide custom cell for the suggestions listview of the AutoCompleteTextView. 
Consider the following code snippet.
_listView = (TKListView*)self.autocomplete.suggestionView;
  
 [_listView registerClass:[MyCustomCell class] forCellWithReuseIdentifier:@"cell"];
 
 TKListViewGridLayout *layout = [TKListViewGridLayout new];
 //setup layout..
 _listView.layout = layout;

You can get the listview and change the type of cells it uses, you can also change the layout of the TKListView.
In case you need detailed example of this, you can check our sdk examples. Here is link to the repo, the AutoCompleteCustomization example shows how to provide custom cell for the listview.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ferdinando
Top achievements
Rank 1
answered on 21 Mar 2016, 05:22 PM

Hi Sophi,

I know it is possible to do it by registering a custom cell, but I was wondering if there was anything more "automatic".

I mean, in my case I want to have a custom cell with two labels, so in order to initialize it I need also to implement a delegate to TKListViewDataSource and so listView:cellForItemAtIndexPath: (necessary) and listView:numberOfItemsInSection:. While the first one is necessary, the second one is just an unnecessary method to implement in my opinion.

If it was possible just to create customize the cell in the DataSource with initCell and createCell one wouldn't need to implement the delegate TKListViewDataSource at all. Besides, when using the delegate one needs also to expose the underlying list containing the objects to show, and this is an utter duplications in my opinion.

0
Sophi
Telerik team
answered on 24 Mar 2016, 09:33 AM
Hello Ferdinando,

At this moment there is no "automatic" way. What you are suggesting here is quite handy and easy way to provide inner implementation for the datasource with no need to actually implement its methods.
It will be considered as a feature of the TKAutoCompleteTextView and possibly implemented.
In order to track the feature request I have created issue in the feedback portal based on your suggestion.
Here is the link to the issue and I am also adding 500 points to your Telerik account.
Thank you for your valuable feedback and suggestions.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ferdinando
Top achievements
Rank 1
answered on 24 Mar 2016, 11:09 AM

Hi Sophi,

Thanks for your help. At leas now I am sure that I'm not missing any hidden functionality :)

Tags
AutoCompleteTextView
Asked by
Ferdinando
Top achievements
Rank 1
Answers by
Sophi
Telerik team
Ferdinando
Top achievements
Rank 1
Share this question
or