V2 Picker Failing when working with Cordova
This is a (multiple allowed):
-
[x] bug
-
[ ] enhancement
-
[ ] feature-discussion (RFC)
-
Framework7 Version: V2 Beta 17.
-
Platform and Target: Cordova
What you did
When running in Atom or browsers etc. the picker works absolutley fine however once I moved the code into Cordova (Visual Studio) and run the app the picker will not display
It is so strange that outside of this it does not have an error so wondering if the Cordova process is causing a failure in the script??
###The Error is:
framework7.js:17654 Uncaught TypeError: Cannot read property 'router' of undefined
at Picker.open (framework7.js:17654)
at HTMLInputElement.onInputClick (framework7.js:17280)
at HTMLInputElement.handleEvent (framework7.js:966)
I am defining the picker as a global after the framework dec
// Init App
var priceApp = new Framework7({
root: '#app',
theme: theme,
routes: routes,
data: function() {
// Return root data object
return {
results: {
promo: '',
retail: '',
save: '',
imageLink: '',
},
};
},
});
// Brand Device picker
priceApp.pickerBrand = priceApp.picker.create({
inputEl: '#brand-picker',
renderToolbar: function () {
return '<div class="toolbar priceAppov">' +
'<div class="toolbar-inner">' +
'<div class="left">' +
'</div>' +
'<div class="right">' +
'<a href="#" class="link sheet-close popover-close">Select Brand</a>' +
'</div>' +
'</div>' +
'</div>';
},
cols: [{
textAlign: 'center',
values: ['Brand1', 'Brand2', 'Brand3', 'Brand4', 'Brand5']
}]
});
The HTML picker is defined as
<li class="item-content item-input item-input-with-info">
<div class="item-inner">
<div class="item-title item-label whitetext">Brand</div>
<div class="item-input-wrap">
<input class="whitetext" type="text" placeholder="Select a Brand" readonly="readonly" id="brand-picker" />
<span class="input-clear-button"></span>
<div class="item-input-info whitetext">Select a Brand</div>
</div>
</div>
</li>
and my scripts are set as
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/routes.js"></script>
<script type="text/javascript" src="scripts/framework7.js"></script>
<script type="text/javascript" src="scripts/welcomescreen.js"></script>
<script type="text/javascript" src="scripts/JsBarcode.all.min.js"></script>
<script type="text/javascript" src="scripts/app.js"></script>
Just thought I would run without the cordova.js file and it works so definitely something to do with working with Cordova. let me know if I can provide or do anything to assist with this.
Try the latest beta 19 it must be fixed there
Will give that a red hot go, just to check from reading the release we now place the all the folders from dist in the project i.e. components etc. and have the framework7.esm.js etc in the root of the project?
If you use esm file then you just import it from node modules. Otherwise you just need js and css folders
@nolimits4web, Ok still had the issue however I after an after thought I set the framework7 to be loaded before the cordova.js it now works, not sure why but its a work around 👍
<script type="text/javascript" src="scripts/framework7.js"></script>
<script type="text/javascript" src="cordova.js"></script>
I'll close this issue since it may have nothing to do with V2 and if you have the time to look further or need anymore information let me know
Ta
Mitch
@nolimits4web ok have run into a hurdle now, building out it iOS with cordova and frameworkv2 works but the app fails to read any code after the device ready process, set my project back to V1.6.5 and adjusted the code of framework7 v2 back to v1 requirements and all works. not sure what the GO is but I am thinking that a class or something is interfering with it.
Edit: have also checked the latest build of V2 you released today (Non Beta)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.