I have an ons-list which contains a lot of ons-list-item, by clicking on each item I show detail page, when the user taps on back button the detail page is pop and it gets back to the page which contains the list but the current position is top of the list, since there are many of items user needs to scroll down to find the last item.
Is there any way to scroll the page to the last position it was or jump to a specific item?
That behavior depends solely on the browser itself. Some of them will remember the last position and others will not. If you want to force it to show a specific position, you can use the OnsenUI's postPop event and manage there the scroll with, for instance, Angular's $anchorScroll. Hope it helps!
Related
I have a problem with a view/window that has a tree view on the left then a list style view on the right which displays "stuff" corresponding to the tree node selected on the right. Very similar to how windows explorer looks and works.
The "stuff" can be displayed as a list, large icons or small icons or information.
The problem I have is that if one of the tree nodes selected is a 'placeholder' node, then 'select all' is run from the Edit menu, then after that the 'delete' option in the Edit menu is greyed out even though all the items in the RHS view are marked as selected and can in fact be deleted safely.
This can be fixed by selecting away from the tree node to another node, selecting back to the same tree node, then selecting a different view: List, large icon, small icon, or info view than was originally selected.
Trace statements show me that in the second working, scenario, the items in the right hand view are being passed to a "can I delete" function whereas when things dont work it is the name of the tree view node that gets passed to the "can I delete" function. when the "can I delete" function returns true, the 'delete' option is enabled in the Edit menu and when false it isnt.
Is there a way I can force the 'focus' for want of a better word to the right hand list, info, etc view when 'select all' is selected from the Edit menu to make this work ok all the time?
I think the problem is that the Edit menu is different (context sensitive) depending on which view ('it' thinks) is active and somewhere wires are crossed and the Edit menu is being displayed for the tree view when it should be for the RHS node list view. It is figuring out how to fix this i am struggling with.
Thanks
You have problems with the MFC command routing.
Check where you placed the handler for the commands.
A command handler is searched in this sequence:
Active view
Document
Document template
Frame window
Application.
I suppose you have handler in the views, and the focus (active view ) changes
You can change the command routing i.E. in the frame and ask all views attached to the document to handle a command... you have to overwrite OnCmdMsg for this.
See more details here
I'm working on an application that has a listing of events and each event has its own detailed show page. Everything seems fine, but one complaint I've received is that we're not maintaining the scroll position when going from the detail page back to the index listing.
For an example of the ideal behavior, go to http://discuss.emberjs.com/, scroll down the page a ways, click a link, then click the back button. You're brought to same place you were previously at, somewhere further down the page.
With our app, if you try to do this, you're brought back to the top of the page while the results are reloaded from the API. Then when the results load, your position is lost.
Is there a way to achieve what Discourse does while using query params?
We have a list that uses a custom renderer containing a label, a checkbox and two icons (which have click events). This list needs to be made WCAG 2.0 compliant and in order to do that we need the list to be keyboard navigable.
The problem is with being able to move from one list item to the next and have the focus move to the label for the next/previous list item. Specifically, when the user enters the list using TAB button, the label for the first list item receives focus (highlighted box around text) and the entire row in the list is highlighted as the selected item.
However, when the user then presses the down arrow key to move to the next list item, the next row becomes highlighted (is now the selected item) but the focus remains on the label of the previous row (highlight still shown around label for row 1). The only way to get the focus to move to the newly selected row is to tab through the checkbox and two icons. This isn't a big deal if there are only a couple list items but would be a pain if there are 20+ rows in the list.
Is there a way to get the focus to move to the label of the newly selected row as soon as the user moves (using up/down cursor keys) to the new list item? I know a picture would help but I don't have anyway of posting a screenshot online. Any help would be greatly appreciated.
You're going to have to dig into how focus works in Flex. This is not a complete answer, but hopefully you can put together a solution that works for you. I did this about 4-5 years ago in Flex 3, but it should be similar in Flex 4.
How Focus Works in Flex
The main things to know are the FocusManager singleton class and the IFocusManagerComponent interface.
The FocusManager moves the focus around the UI based on user interactions (mouse clicks, keyboard navigation, etc.).
If a component implements the IFocusManagerComponent interface, then the FocusManager will include it in the "tab" loop and allow the component to be focused via keyboard navigation.
How Focus Works With Flex List Components
You've already stumbled onto the peculiarities of how focus works with the List component and item renderers. The Flex List components implement IFocusMangerComponent and so when you tab through the UI the FocusManager sends the focus to the list.
The List may or may not focus the item renderers. In Flex 3 you had to be using editable item renderers for this to happen, it may or may not be the same in Flex 4.
Some Ideas for Solutions to Your Problem
I think there are numerous ways to solve this. Use some combination of these techniques:
override the protected keyDownHandler() method of the List component. I don't have the code handy, but if you look at it's implementation in the List class you should be able to make your overridden version set the focus on the next renderer.
use methods of the FocusManager to find components in the tab loop: getNextFocusManagerComponent(), findFocusManagerComponent(). Check the docs there are others that will be useful. For example, when the user presses the down arrow, you can let the next item renderer get selected, then use findFocusManagerComponent() (passing in the newly selected renderer) and then tell the FocusManager to focus it with the setFocus() method. This is probably not exactly the right approach ;)
By the way, the FocusManger is a Flex singleton object, every UIComponent in Flex has a focusManager property you can use to get a reference to it.
consider disabling focus on objects that don't need to receive focus (like the Label in your item renderer). There are numerous properties to do this: focusEnabled, hasFocusableChildren, mouseFocusEnabled, tabEnabled, tabChildren etc.
consider disabling focus on the List component, but then making your item renderers implement the IFocusManagerComponent interface. Implementing the interface is simple, you just declare it in your class (there's no actual methods to implement). The tricky part will be now your item renderers need to have key down handlers (just override the protected keyDownHandler() method that all UIComponent objects have).
I think there are other techniques you can use, it's just been too long since I did this. I'd be happy to provide more help if you get stuck somehwere...
I want to developed a list, <ul><li></li>...<ul>, that shows every <li>element separately, and user must have to swipe from right to left to see next element.
Photoswipe do the that, but I need to show images with maps areas instead of <a href...><img ... /> </a>.
Do you know how can make a list where every list element is shown in one page, and user must have to swipe an element to see the next one?
You can use iScroll to do this. It makes it possible to scroll horizontally, as it is shown here. It also works with jQuery Mobile (here is an example for that).
Beyond this, you can take a look at iScroll's website and their code and examples at GitHub.
I have two CListCtrl objects in my form. I want selected list in both of them be same.
How I can do it.
I want duplicate the message that sent to a ClistCtrl and send to other one.
How I can do it?
if this is a good way?
thanks herzl
So, essentially what you're saying is that you want the lists to be synchronized.
You can easily achieve that by adding an event handler to catch the user's selection inside you list control, by adding: ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemChangedList1) to your dialog/window's message-map.
Inside OnItemChangedList1(), get the index of the currently selected item by calling GetFirstSelectedItemPosition(), and set that as the current index in your second list by calling SetSelectionMark().
This way, whenever the user will click on the 2nd item, for example, in List_A, the 2nd item in List_B will be selected as well.
There ought to be a function that brings that row into view, if it's not in view already, but I can't find it.
I hope that raps it up, ListView's have changed a lot since I've used them, but feel free to ask more if anything is unclear.