PDA

View Full Version : Uncaught TypeError: Cannot read property 'viewIndex' of null



marogalli
3 Apr 2012, 5:30 AM
Using dataview everything works fine, the store is loaded and the template is rendered.

After the store is load, I focus in an element of dataview (in this case an HTML5).



<input id="slider-hora" style="width : 100%;" type="range" min="0" max="8" value="0" step="0.5" onchange="sliderHoraUpdate(this.value)">)


I did this focus because I want the user to navigate through keyboard. The focus works. When I press "right-key" the slider does not responde at the first click. After the second "right-key" pressed the slider works and moves in the bar. The problem is I got a erro in the tille.

Despite the error the app is working as expected.

Tks

marogalli
3 Apr 2012, 11:12 AM
The solution was create a KeyNav listener for the slider-element that is inside dataview to handle it not depending on other components.



var nav = new Ext.util.KeyNav('slider-hora', {
"left" : function(e){
var moveOneLeft = parseFloat($('#slider-hora').val()) - parseFloat(0.5);
$('#slider-hora').val(moveOneLeft);
$('#hora_input').text(moveOneLeft);
}
setPrazo();
},

marogalli
3 Apr 2012, 11:34 AM
Despite the work around above, I think there is a bug in it. When the store is loaded it focus on the slider and the keys on this slider is working as expected(due the NavEvent I created). If I click the dataview, the slider is deselected. Then if I press the key the errors appers again.

It should be nice disable the kevnav when its needed. I had no success doing it using removeListerner or something like that.