How to know when NSTableView is done (re)loading its contents? - macos

I have a UI that looks similar to the mail app. A table view along the left with a single column of items. When one of the those items on the left is selected, details about that item are shown on the right.
When some event occurs in my app that requires the data in the left table view to be reloaded, the current selection is lost and then the right detail view and left master view get out of sync.
The way i hoped to solve this problem was, when it was time to reload the table data, I would:
1. Save the current selected item
2. reload the table data
3. Handle a delegate method or notification that let me know when the reloading was done.
4. Re-select the proper item by finding it in the new list of items in the table.
Unfortunately I cannot find any way to determine when the table is done reloading. Is there a. any way to figure this out, or b. a more elegant solution to this problem?
thanks.
update: In case my problem was unclear, imagine you are in the mail app and you have some message selected. That summary cell is shown as selected on the left, and the details of the message are shown on the right. Suppose new mail comes in which appear as new cells at the top of the table. How is the message you are currently viewing preserved, and not de-selected?

reloadData is something of a sledgehammer. 10.7 offers a better solution.
Instead of using reloadData, when you have new rows to add, use insertRowsAtIndexes:withAnimation: . When you have rows to delete, use removeRowsAtIndexes:withAnimation: . And, of course, if an existing row has changed, there's reloadDataForRowIndexes:columnIndexes.
These should remember the selection for you (at least, the equivalents on iOS do).
If you can't target 10.7, some of the other suggestions will probably help out. noteNumberOfRowsChanged may also be helpful but I've not actually used it.

You can save selection on tableView(_:shouldSelectRow:) then select the row right after you create the cell in tableView(_:viewFor:row:) using selectRowIndexes(_:byExtendingSelection:).
It is pretty reliable no matter how / when / how many times you reload the table.

Related

MS Access trying to link a record with a page tab

I've been searching for a few days and doing every word combination I can think of to try to find the answer to my issue. I'm hoping someone can help me.
Before I begin I'd also like to say I'm very new to Access and admittedly not great with it. I'm still learning so this could be a very easy fix or I may have messed up beyond belief.
The issue I'm having is I've setup several page tab on a form and entered all the information for my records. However I cannot get the page tabs to pull up the corresponding records. Instead I have to either search through the records which doesn't always work or I have to arrow to the right record after selecting the tab I want. I'd like it so that when I click the tab it brings up the proper record automatically. If someone can point out where I'm going wrong and how to fix it I would greatly appreciate it. See below for some pics of what I mean.
As you can see in the first image. The tab name "Auto PLUS" doesn't bring up the proper record. instead I have to manually change the record using the arrows at the bottom of the form (see the arrow at the bottom of the image) in order to change the record. I need the record and the tab to match. Any help would be so greatly appreciated.
Thanks in advance for any help!!
-Deke
Assuming your form is bound (if in design mode your fields do NOT say "Unbound" then your form is bound), you simply need to add some VBA code to each tab's OnClick event.
Enter design mode and select the first tab "Claims Other". Open the properties pane, click the event tab, and click the ellipsis at the end of the OnClick line. When prompted, select "Code Builder" and it should launch the Visual Basic Editor.
It will put your cursor automatically in the correct position. Copy/Paste:
DoCmd.GoToRecord acDataForm, Form1, acGoTo, 1
The 1 should correspond to "Claims Other's" proper record in your table. Use the row number, not the ID number to determine what it should be.
Go back to Form View and click on the "Claims Other's" tab. The data should show the corresponding record in your table.
Repeat the steps of adding events to each tab, finding the relevant record in your table, and replacing the 1 from the above code.

Can't update default views' definitions permanently

I've created a subgrid showing a custom entity Blopp. It shows, the records are viewed as supposed to (related ones only) but I was unhappy with the columns' order and size.
So I went to the solution and made the changes. To my surprise, I discovered that they are not shown when I load the Contact form.
Before anybody jumps up with joy - the save is done, the publish all is done, it's the correct view set in the subgrid and when I pick a different view in the subgrid and then go back to the manipulated one, it shows as supposed to!
What's up with that? The way we're handling it now, we need to remove the subgrid and recreate it again.
What can be the cause and how do I kill it?

Issue with Kendo MVVM Cascading drop down

I am working on developing a cascading drop down with Kendo MVVM. The issue is that when the drop down loads the child drop down initially displays "undefined". This disappears though when I select some data in the parent drop down.
Alternatively I also require a Reset button in place. On click of this button I need to reset the cascade so that we get back to the initial phase(i.e. the child drop down should be disabled and no data should be selected in the parent).
Please find a JSBin that I created for the issue here
Thanks in advance for the help.
You should be using IDs as values, not strings. I think you can play around with data-primitive-value but why? Just use proper structure to begin with. For the clear, just dropdownlist.select(0) or dropdownlist.select("") if you managed to make it work with the primitive value thing.
http://dojo.telerik.com/ePIDO

Set data validation for column including new rows

I have a column in a Google spreadsheet with data validation, that makes a drop down menu available when editing existing rows. Occasionally though contributors create new rows at the bottom of the doc and this validation is lost.
I would like to keep this validatation in the column even in newly created rows (excluding the header row).
I have seen much of this discussion throughout stackoverflow and google help forums, but still cannot find a clear answer.
My hunch is that this would involve Google Apps Acript using an onEdit trigger and then either paint formatting or a combination of the confusing class DataValidationBuilder. (https://developers.google.com/apps-script/reference/spreadsheet/data-validation-builder) but I'm not sure beyond that.
While not necessarily elegant I found the following to work:
create your validation on the entire column
once that's done click the cell(s) that represent the heading, select data / validation, and then click on 'remove validation' on that single cell.
This way any newly inserted rows will inherit the validation set up on the entire column and you don't have to always be reminded that your heading isn't a valid value.
onEdit trigger which uses Range.getDataValidation() and Range.setDataValidation() to copy the rule from an existing row to the new row
While in the data validation dialog screen you can manually enter the range as "Sheet1!A:A" to apply the formula to all of column A.
This also includes new rows added afterwards
I'm not sure if this is a new feature but this worked. Set the validation as list from interval and interval as:
'sheet'!C2:C
This includes all new rows excluding title(first row)

extjs 4 How to change ordering of shown column dropdown on grid

Using extjs 4.1.1
I have a grid with lots of columns >20.
Initially, most of these columns are hidden.
If a user wants to unhide the column, they select the menu on any column, then select the "columns" choice, this expands another dropdown/dropout which shows all of the columns. Those with checkboxes next to them are shown.
My issue is this:
The columns in the dropdown are shown in the order in which they are defined/displayed in the grid. The order in which they are displayed in the grid has been chosen for a good reason( e.g. id as the first column). However, when a user wants to display one of the hidden columns, it is hard for them to find it in the list. This is because the list is sorted in the order the columns are defined. I want to sort the column dropdown/dropout list in alphabetical order, without effecting the order of the columns in the grid.
How can this done?
I think I found the solution to your question.
First of all I don't have the Ext JS 4.1.1. framework on my current PC. So I tried to figure out you problem reading the Ext JS 4.1.3. documentation available on Sencha's site. But I don't think that they have made drastical changes in this part of the framework between the two minor releases so my solution should work in your case too.
I have tried out my solution using JSFiddle. Unfortunately they did not have the 4.1.1. ext-all.css file, so I have linked manually the 4.0.2 file available at Sencha, so the menu is looking a bit missplaced.
The header menu and it's submenus are managed by the Ext.grid.header.Container class. The column submenu is constructed by the getColumnMenu method. The whole menu is purged and reconstructed on every drag and drop or other event which should affect the grid view. As a result it is enough to overwrite this method in order to solve the problem. Because the headercontainer class is too deep in the framework it is hard to extend it, so you have to make use of the Ext.base.override method.
The column submenu's menu items are created from the result of the
items = headerContainer.query('>gridcolumn[hideable]')
query. So you have to first sort alphabetically the result, before creating the menu items. I have added to the class the sortColumns method which does all the sorting stuff.
So here is what I did: link to my solution.
I hope that this is what you were looking for.

Resources