Message Boards

Getting nil rows from baseListView in ios

thumbnail
Prakash Kumar Singh, modified 6 Years ago.

Getting nil rows from baseListView in ios

Junior Member Posts: 85 Join Date: 1/30/15 Recent Posts
Liferay Screen version : - 2.0.1

Hi
i am creating custom list screenlet. Screenlet is populated with list data. but when i am using below code for other functionalities .It returning nil .I am confused what is actual this return.


let rows = (screenlet.screenletView as? BaseListView)?.rows
  print("rows" , rows)



Thanks in advance for any help !!
thumbnail
Victor Galan, modified 6 Years ago.

RE: Getting nil rows from baseListView in ios

Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts
Where are you executing that code?

rows cant be nil so the screenletview is the nil here, maybe its not yet initialized
thumbnail
Prakash Kumar Singh, modified 6 Years ago.

RE: Getting nil rows from baseListView in ios

Junior Member Posts: 85 Join Date: 1/30/15 Recent Posts
Victor Galan:
Where are you executing that code?
rows cant be nil so the screenletview is the nil here, maybe its not yet initialized



 // On List item selection
    func screenlet(screenlet: NewsListScreenlet,
        onNewsSelectedEntry entry: NewsListScreenletEntry) {
       
        // open page view controller
        let mainStoryBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let viewController : PageViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("PageViewController") as! PageViewController
        let rows = (screenlet.screenletView as? BaseListView)?.rows
        print("selectedrows" , rows)
        // viewController.rows = rows
        if let rowCount = (screenlet.screenletView as? BaseListView)?.rowCount {
            viewController.rowCount = rowCount
        } else {
            viewController.rowCount = rows?.count ?? 0
        }
        
        viewController.selectedEntry = entry
        viewController.pageType = menuItem.pageType
        viewController.contentType = menuItem.friendlyURL
}
    }



i am using this code in viewController class from where custom screenlet is loaded
thumbnail
Prakash Kumar Singh, modified 6 Years ago.

RE: Getting nil rows from baseListView in ios

Junior Member Posts: 85 Join Date: 1/30/15 Recent Posts
Any Help ??