I've been working this issue for a while now and I am open to any best practices/advice.
The Example
So I created a sample Core Data application. The application is basically a mimic of the AddressBook application. I have the following Entities: Group, Contact, Address, Phone, Email, Webpage, Dates.
As you probably are guessing, a Group can have multiple Contacts, and a Contact can be in multiple groups. Contacts can also have multiple Addresses, Phones, Emails, Webpages, and Dates.
I basically imported some 600 contacts into this application from AddressBook. The user-interface is relatively simple...a Group/category list on the left and an NSCollectionView or NSTableView on the right that shows the list of contacts depending on the selected Group.(collection view or table view...as I added the ability to display either view, both of which are bound to an NSArrayController)
The Group elements I am pulling in through code as opposed to Interface Builder, becasue I wanted to playaround with a Thing's - like sidebar, and it was far easier to do it this way.
The Problem
One of the categories contains all of the contacts while the other category contains merely 2 contacts. When i select the category that has all the contacts it takes anywhere from 8-10 seconds for the information to populate the collection or tableview. However doing the same thing in AddressBook itself is very speedy, almost instant. I am using the SQLLite store type, and have tried using a number of different approaches including trying to diagnose the problem via Instruments, but nothing has worked.
I've tried setting a predicate to the defaultFetchPredicate of the Contact's array controller as opposed to setting a filter predicate, but that didn't work.
I tried preFetching and faulting but i'm not sure if I'm doing it right, and not really sure how to accomplish it if Interface Builder handles the Contact's NSArrayController.
The Other Example
I've also tried downloading a sample Core Data app...while it has a simpler relationship model than what I did(basically a Molecule has Atom objects and an Atom object has Element objects), I inserted 65,000 records and it performed like a charm.
The Question
I've basically hit a wall and I'm wondering if anyone else knows why this is happening and the best ways to fix/overcome/avoid this type of issue?
Thanks!
It turns out that it was actually the NSCollectionView that was slowing things down. I guess the creation and manipulation of views x number of collection view views adds a significant amount of overhead. IKImageBrowserView could have been used but it wasn't what I was looking for.
I ended up changing the application layout to solve this issue.
Thanks all!
Related
I am developing a Power App using the Teams version. We have two tables in Dataverse acting as the main data sources. There is an inheritance relationship between these two tables, where one holds parent objects and the other child. I have an overview screen which displays a single record and it is important that a user can select both parent and child records from a single combobox and have the data associated to the selected record displayed.
In order to achieve this I have a collection which holds the ID and Parent/Child type of each record to form a full list of records from both tables. Collection is built as follows:
ClearCollect(Collection_RecordSelect,AddColumns(ShowColumns(record_parents,"recordID","recordID_numeric"),"type","parent")); Collect(Collection_RecordSelect, AddColumns(ShowColumns(record_children,"recordID","recordID_numeric"),"type","child"));
When a user selects a record from the combobox, the ID value from the collection is looked up against the respective data source to get the rest of the data for the record.
The issue I have now is, when a user makes a change to a record in another screen, the app returns to this overview screen to show the record they have just changed. To achieve this I used the DefaultSelectedItems property of the combobox which looks at a selectedRecord variable containing the record ID as a string, set after a user changes the record in another screen. As the combobox requires a record, the combobox uses the selectedRecord variable to Lookup into the collection I referenced earlier to get the full record, unless it's blank in which case it default to the first record. Shown below:
If(IsBlank(selectedRecordID),First(Collection_RecordSelect),Lookup(Collection_RecordSelect, recordID = selectedRecordID))
This results in the combobox displaying two instances of the selected record and showing the old version of the record before the user made changes on the overview screen. If you select another record, the duplicate disappears. If you select the other duplicate record in the combobox, the user's changes are then shown on the overview screen.
Screenshot of duplicate record in combobox.
I have tried creating a single collection, containing all records from both tables, however as they are slightly different due to the inheritance field in the child table they don't merge properly and data is missed. Unfortunately, I need the inheritance field on the overview screen so I can't use ShowColumns and remove it.
I have recently re-built the app in Teams as opposed to standard Power Apps. This solution worked fine in the standard Power Apps environment, so I have a suspicion it may be a bug with the Power Apps for Teams combobox? Unless I am making a mistake, I think this is probably true as I've just tested and the "Classic Control" combobox doesn't have the same behavior, shame because it looks rubbish compared to the Teams one!
I have turned off multi-select on the combobox and search and the problem still exists.
Any help would be hugely appreciated!
im a osx-dev noob that is trying to build an application with three table views that will show the content of a core data store entity. But each table view is filtered on the attribute "status" of the entity.
the problem occurs when i also want to show the selected entity in textfields. I'm using three different array controllers with different fetch predicates. But in a textfield i can only bind the value to one array controller.
should i ditch the bindings and do it all programaticly or is there a simple solution to this? :)
here is an screenshot so you can grasp my app description.
Keep bindings to populate the text fields if it satisfies what you want to do with this GUI. I'd add an NSObjectController to control the one entity those fields represent. If you want the user's changes to those fields persisted, bindings are still awesome.
But I think with three tables that might control what's displayed in the text fields, you're going to need to have some sort of non-binding glue code that determines which of the tables wins. You can probably do everything you want by implementing some of the NSTableViewDelegate protocol.
If the text fields should display the last entity that the user clicked in any of the tables, simply have each table call the same tableViewSelectionDidChange delegate function. All three tables could have the same delegate. You can then call setContent on the NSObjectController from that function.
You could also use similar glue code to prevent more than one selection in any of the three tables, by having the same delegate function deselect everything in the other tables either through the view or the controller. But that's up to you and needs consideration of whether you want multiple selection, etc.
For this specific project, my team and I are thinking of leveraging the power of AngularJS directives and use them to build custom elements specific to our project, and use them like they were real HTML components.
For instance...
Say we have this table where each row is composed with a bunch of information that we get from a request, each row will be repeated with ng-repeat. Inside each row we will have multiple custom buttons with the same custom behavior. This button will also be used across different modules/pages on the website and not only on this specific table.
Our first thought was to use 2 directives, one for the table row and one for the button. The idea is that these are custom components/elements with custom attributes to define the custom behavior of the element. This would allow us to have a really nice modular application where each component is developed and unit-tested individually. Our HTML would also be easy to ready and understand.
Does this sound good?
Now, what about performance issues? Could we encounter big issues with this approach if, say we have a table with 100 of those rows and 5 of those buttons per row. Could this be big a problem if those rows/buttons had a couple of bindings to update information each X seconds?
The father of Angular Misko Hevery has this to say about performance and data-binding:
How does data binding work in AngularJS?
But in short like he says as long as you dont have more than 2000 data-bound items per page performance wont be an issue...
I'm attempting to build a FedEx style scheduling board. This would look just like a week view on a calendar but instead of days it would have driver columns. The trips should be able to drag and drop between columns and appear at the correct height for the time.
I'm abstracting to ensure I have the correct logic before tackling the actual code.
So lets say I have a date on the index controller. Selecting a date will load the schedule for that date. The schedule contains drivers and each driver has trips.
What controller do I use to handle the trips? The content is different depending on the column but each column needs to be visible. Also I need to add events to these which presumably uses a view but ember will only ever load a view once. I'm sure I've just missed something fundamental but all the examples of ember apps I've found involve clicking a list item and loading in a view for that.
Am I thinking about my application with the correct mvc setup? Should I be approaching the problem differently?
Ember RC1 introduced a notion of an itemController when iterating through a list in handlebars:
{{each trip in tripList itemController='trips'}}
{{view YourApp.TripView}}
{{/each}}
That way each instance of your trip can have its own trip controller. We're doing something similar, and this actually saved us a lot of work.
I have a section that contains a subform ( containing 3 editable fields for the user ).
Then I have an embedded view categorized having two actions: Add and Trash.
What i want to do: After the user complete the 3 fields and then press Add, the first row in the embedded view will appear. ( This easy thing I did ). But then after the first click on Add, I want that all the 3 fields to be refreshed, all of them to have as their value: "".
After, if the user wants to add another row into the embedded view (with different values), in my case it is overwrited on the 1st row. I want to be separate rows in order.
I tried something with #Command(ViewRefreshFields) into the Add action code but I didn't make it to work. Please help, J. U.
Jazir, I'm guessing that you also go by the names "Florin G Mihalache", "Josh Mitchell" and "Yveniss Ltoreau", and I've been following the development of your application along with many other professional Notes developers.
I really think you need to go back to the very first basics, and work out the difference between forms, subforms, documents, views, embedded views, and other important components of Lotus Notes databases.
I strongly suspect that for a couple of weeks you have been trying to use a form to create other documents, via a subform, to be displayed in an embedded view in that form, when what you should be using is just a view, and documents. Perhaps you might need to use pages, outlines and framesets. It is very important that you understand these basic concepts before confusing the people who have tried to help you, to whom you may have lied.
I have voted your question down, not just because you have shown a lack of research, but because you appear to keep switching ID when people lose patience with you. I will undo that vote if I become convinced that you are not Florin.
The documents displayed in an embedded view are controlled by the view's selection formula. You haven't shown that. You haven't shown your code in the Add button. You haven't shown what properties you have set on the embedded view -- e.g., show single category. So you're not giving us quite enough info to diagnose your problem and help you.
But in general, I think that if you want to control the order of insertion of individual documents into an embedded list, perhaps using an embedded folder would be a better idea than an embedded view.