Code Monkey home page Code Monkey logo

Comments (5)

syky27 avatar syky27 commented on July 22, 2024

It is happening in both cases here is the other piece of code:

lazy var dataSource: DATASource = {
        let request: NSFetchRequest = NSFetchRequest(entityName: "Report")
        request.sortDescriptors = [NSSortDescriptor(key: "modifyDate", ascending: false)]


        let dataSource = DATASource(tableView: self.tableView, cellIdentifier: ReportTableViewCell.Identifier, fetchRequest: request, mainContext: self.dataStack.mainContext, sectionName:  "equipment.equipmentType.company.companyName", configuration: { cell, item, indexPath in

            if let cell = cell as? ReportTableViewCell {
                let report = item as! Report
                if let imagePath = report.equipment!.path {
                    cell.thumbnail.image = PicManager.instance.getThumbnail(imagePath, type: K.file.equipmentThumbnails)
                }

                if let name = item.valueForKey("name") as? String {
                    cell.name.text = name
                }

                if let desc = item.valueForKey("reportDescription") as? String {
                    cell.descriptionLabel.text = desc
                }

                if let cwaId = item.valueForKey("cwaId") as? String {
                    cell.cwaId.text = "CWA# " + cwaId
                }

                if let final = item.valueForKey("final") as? Bool {

                }

                if let modifyDate = item.valueForKey("modifyDate") as? NSDate {
                    cell.modifiedDate.text = "Modified " + NSDate.stringForInspectionCell(modifyDate)
                }

                if let equipment = report.equipment {
                    if let equipmentName = equipment.name {
                        cell.equipment.text = equipmentName
                        if let equipmentType = equipment.equipmentType {
                            if let equipmentTypeName = equipmentType.name {
                                if equipmentTypeName != "" {
                                    cell.equipment.text = equipmentTypeName + " - " + equipmentName
                                } else {
                                    cell.equipment.text = equipmentName
                                }

                            }
                        }
                    }
                }
            }
        })
        dataSource.delegate = self
        return dataSource
    }()

from datasource.

syky27 avatar syky27 commented on July 22, 2024

Here is a data source on which you can test it.

http://haste.fit.cvut.cz/dokodig.json

from datasource.

syky27 avatar syky27 commented on July 22, 2024

So I found out this might be my mistake having different sortDescriptor and sectionName.

I changed it to same one and it works but it should work with different ones because they aways point correctly to to the same object.

Anyway I rewritten it to NsFetchResultController and it behaves identical. So it is not your mistake.

If you could comment on this and give me insight why is this behaving as it is it would be great.

from datasource.

3lvis avatar 3lvis commented on July 22, 2024

Hi @syky27, I have been in vacation mode. Will try to reply later this week. Sorry for not being so responsive.

from datasource.

3lvis avatar 3lvis commented on July 22, 2024

@syky27 Hi Tomas, this seems as you mentioned a NSFetchedResultsController issue, where you have to add the sortDescriptor if you are using sectioned table views, I remember getting an error from UIKit before about this but looks like they removed this error.

For example if you are grouping by firstName you have to add firstName as the first sortDescriptor. I'll add this to the README.

from datasource.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.