PDA

View Full Version : focus and focusNode in dataview are not worked as desired



janardhan pasumarthi
5 Jun 2013, 4:55 AM
Hello All,

I've a dataview, under which i'm loading data from store. When i click on add button, i'm adding new record to store, which is getting appended at last in the dataview, which is fine. But, what i want is, to focus the added record. When i add a new record, scrollbar should automatically scrolls down and focus the record.

For that, i've tried with focus and focusNode methods. But, no change in the behavior. Please suggest me way to achieve focusing record.


Thanks

janardhan pasumarthi
6 Jun 2013, 4:31 AM
Hello All,

I've decided to go with scrollBy of the panel instead of spending much time on focusNode as internally focusNode is also doing scrollBy. Here is how i got the solution.

First, getting the node in the dataview based on record.


var node = dataview.getNode( record );

then, getting the node element's region and storing bottom value of region.


var regionValue = Ext.get(node).getRegion().bottom;

once i got the new item region, i'm scrolling the panel to the region bottom value.


panel.scrollBy(0,regionValue,true);


Thanks

rahul.sood
22 Jan 2014, 9:40 AM
hi
How did you do the record selection...i tried on callback after reload and it does not select