javascriptcordovaextjssencha-touchsencha-touch-2.1

Is document .getElementById.innerHTML full compatible on all sencha applications?


var orari='[{"data":"2016-02-26T00:00:00","apertura1":15.5,"chiusura1":19.5,"apertura2":8.90,"chiusura2":12.5}]';
var obj=Ext.JSON.decode(orari);
                var data=new Date();
                var startDate=Ext.Date.parse(obj[0].data,'Y-m-d\TH:i:s');

console.log('oggi: '+data);
console.log('startDate preclear: '+startDate);

startDate=Ext.Date.clearTime(startDate);

console.log('startDate clear: '+startDate);

                var start1=Ext.Date.add(startDate,Ext.Date.MINUTE,obj[0].apertura1*60);
                var start2=Ext.Date.add(startDate,Ext.Date.MINUTE,obj[0].apertura2*60);
                var close1=Ext.Date.add(startDate,Ext.Date.MINUTE,obj[0].chiusura1*60);
                var close2=Ext.Date.add(startDate,Ext.Date.MINUTE,obj[0].chiusura2*60);

console.log('start1:' +start1);
console.log('close1:' +close1);
console.log('start2:' +start2);
console.log('close2:' +close2);


                if(Ext.Date.between(data,start1,close1)||Ext.Date.between(data,start2,close2)){
                     //document.getElementById('id'+values.id).innerHTML='<img class="isopen" src="resources/icons/ico-aperto.svg"/>';

                    return true;
                }else{
                    return false;
                }

I need this function on a sencha touch application to print in a specific point of the tpl an img, the code works fine, and the commented code in the final if is what i'm going to do on a sencha touch application.

To print the new html code in my tpl I used a div with a specific code to find it and print on it the img. So my question is, does sencha really can make that function fully compatible with all browsers and devices? or there are other instruments, maybe with sencha frame that can make me sure it will work fine also on the future?


Solution

  • Yes this will work for all Browser.

    And you can try Ext.getDom('id') instead of document.getElementById // id is id config of that component.