Skip to Content
avatar image
Former Member

select first item in list issue

Hi All,

While i navigate from detail1  page to another master2-detail2 page , i have to select first record in master2 by default while laoding master2-detail2.

but it is not working and no error in console also.

below is my code for default selection.

in master2 controller and in onInit() method i have written code as below.

this.waitForInitialListLoading(function() {

  //On the empty hash select the first item

  this.selectFirstItem();

  });

waitForInitialListLoading: function(fnToExecute) {

  jQuery.when(this.oInitialLoadFinishedDeferred).then(jQuery.proxy(fnToExecute, this));

  },

selectFirstItem: function() {

  var oList = this.getView().byId("list2");

  var aItems = oList.getItems();

  if (aItems.length) {

  oList.setSelectedItem(aItems[0], true);

  }

  },

please help

Regards,

Vamsi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 23, 2015 at 09:16 AM
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Pradeep Kumar

      Thank you all for your quick responses and solutions.

      it is working when i use updateFinished  event in the list and enabled the required fields in detail page as

      i have disabled those fileds in another event .


      Regards,

      Vamshi

  • Oct 23, 2015 at 01:25 PM

    Hi,

    Can u try this

    $('#listid:first-child').attr('selected',true);

    Its selected using jquery!

    Add comment
    10|10000 characters needed characters exceeded