TKDataSource binding with UI controls in AutoCompleteTextView

5 posts, 1 answers
  1. Ferdinando
    Ferdinando avatar
    9 posts
    Member since:
    Mar 2016

    Posted 21 Mar Link to this post

    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?

  2. Answer
    Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 21 Mar Link to this post

    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
  3. DevCraft banner
  4. Ferdinando
    Ferdinando avatar
    9 posts
    Member since:
    Mar 2016

    Posted 21 Mar Link to this post

    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.

  5. Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 24 Mar Link to this post

    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
  6. Ferdinando
    Ferdinando avatar
    9 posts
    Member since:
    Mar 2016

    Posted 24 Mar in reply to Sophi Link to this post

    Hi Sophi,

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

Back to Top
DevCraft banner