Ext JS 6.5.2 Comobobox and ArrayStore load issues - javascript

Here is an example of what I'm trying to do with Sencha Ext JS 6.5.2 Modern:
https://fiddle.sencha.com/#view/editor&fiddle/2b2i
I am trying to use an ArrayStore to load some values into the combobox. When I click on the drop down arrow, or search, I get an error stating that:
Cannot read property 'getFilters' of null
The problems seems that it is not loading the data correctly, and 'me.getStore()' returns null.
Am I not using the 'store' properly?

After some digging into the API and trying to find numerous examples across the web, I believe I figured it out.
I was setting the 'store' key as a string. slap head, instead of a config object. I changed that from:store: 'states' to store: { type: 'states' }
I also had the wrong field specified in the model: displayAS vs displayAs.
once I did this, everything worked as expected.

Please check the docs to find that ExtJS stores have no alias config. You may want to change your store identification from alias to storeId.
Also, check the store config of the combobox to find that ExtJS takes "either a Store instance, configuration object or store ID", but does not instantiate a new store by alias.
So you have to instantiate a new states store instance before your combobox is rendered. For the instantiation of stores of which only one instance should exist throughout the app, I can recommend adding them to the stores config of the Application.

Related

Load multiple i18n properties into an array possible? (JavaScript)

I have to load multiple I18N-properties that have the same sharing content into an array. I've tried
arrayIDs = oBundle.getText().includes(".id.");
It said that it can't read the property 'includes' of undefined. Most likely because there isn't anything in getText(). But this has to be variable. This method is made for one property, is there something where I can get multiple properties?
edit: nvm I solved it... If you have the same problem: I discovered
oBundle.aPropertyFiles[0].getKeys();
for myself and this gets all the keys of the I18N properties you need. After that you can make oBundle.getText(key) to get the according text and implement your own filtering logic.

How to change Model name to leverage different property in Forge Viewer

I have a .stp file that has random integer name values for model names in the Model Browser but a valid (ie. human readable) Component Name. I would like to replace the default name with the Component Name in the Model Browser for these cases.
I've looked at a couple similar posts on SO but nothing has worked for me as yet (here and here). I'm using version 6.3.1 of the viewer.
In my investigation into where the data is stored, I've found a strings array in the InstanceTree as well as a PropDbLoader (in the ViewerPropertyPanel). The strings array seems to get populated with the name data (in an interesting ASCII array look-up setup) and the PropDbLoader has properties for the models. The name for the model in the Model Browser popup looks to come from within the ModelStructureTreeDelegate class (InstanceTree.getNodeName). I'd like to be able to extend or override the getNodeName and populate it with Component Name but I have (as of yet) not found a way to get at this data in the model tree.
Any insight or direction would be greatly appreciated
Basically you will need to extend/override the default DIV creation behaviour for model tree nodes here and customize to your needs:
ModelStructureTreeDelegate.prototype.createTreeNode
See here for code sample.

How can I use vue-logger in the vuex store?

I cannot get vue-logger to work in my Vuex store file(s)
I would like to use vue-logger in my Vuex store file (and modules). However, I keep getting the error: "TypeError: Cannot read property 'info' of undefined" when I execute a statement like "Vue.log.info(....)".
I had a similar problem with using "this.$http.get" in the store file, but that works now by using the "Vue.http.get" (as explained in this StackOverflow Answer).
However, "this.$log.info" does not work (for reasons obvious to me now, as in the store I am outside of the vue instance), but neither does "Vue.log.info".
How can I use vue-logger in the store?
Try to use Vue.$log.info.
Notice the extra $ before log.

How to read values from properties file in ExtJs

I want to read values from config.properties and use these values in my ExtJs ComboBox. I do not want to read from JSON file.
Where should I place the config.properties file? Should I place it in the webcontent directly? I do not want to hard code the path/ or at least reduce it.
And how can I access property values through JavaScript.?
Thanks
This is not ExtJS specific but in general rather applicable to javascript as a whole.
Best bet would be to either include it in a global file that gets included in your app and is namespaced appropriately to your app so as to minimise chance of collisions with any other potential variables
MyApp = {
config:{
property1:'something',
property2:'something2'
}
}
// Then you can access this anywhere you like
myProperty1 = MyApp.config.property1; // assigns the string "something" to variable myProperty1
You can load the properties file into a data store, this way you can have the key-value pairs in the your properties file mapped to a simple model with fields
key and value.
And to enable your proxy to load data from the properties file and be converted into the corresponding model you'll have to create a reader that'll read the data from the properties file and convert to the desired record.
This custom package for i18n will give you some idea how to do that.

ExtJS 4 Problem with MVC concept

i'm trying to use the new MVC concept and therefore started witht the AccountManager Example (examples/simple). Everything works fine as far as I stick to the tutorial, but I tried to extend it a bit.
I define a border layout in 'Viewport.js' and assign a header component (views/Header.js) to 'north'
and a tab-Panel (views/MainPanel.js) which contains the 'views/user/List.js' as a tab.
Until now everything is ok.
But now i added another store (Profiles.js) and model (Profile.js),
changed the references in code to use profile-store instead of user-store.
I also updated the column-definition, imports ('requires') and everything es that is relevant(at least i think so...).
When i run my app i get a js-error in Observable.js -> addManagedListener-> 'item is undefined' when he tries to invoce the on-method of 'item'.
At first i tried hard to find the mistake i made in the code but I could not find anything,
so i started to play around a little bit and found out,
that it works as soon as I rename the folder 'user' in views/ to 'profile' (of course i had to fix some references in code too).
Is this behavior a bug or is it volitional?
If so can anybody please tell me how this is exactly working?
Thank you very much!
ExtJS looks for the Javascript files based on your model/view/controller declarations.
i.e. if in your tell your controller that you have a store called Profile (via the stores attribute) by default, it is going to look for a file at app_name/stores/Profile.js
The problem was that i had to give my controller a reference to the store and the model.
I didn't do that from the beginning, after my controller had a reference to the view, the view had a reference to the store and the store had a reference to the model.
So I assumed everything is ok.
But it seems to be mandatory to provide this information redundant as far as understand and i can live with that...

Categories

Resources