Problem:- Using button from controller
Solution:- Use the following code in the controller (in view write action:addModify in properties of button whose action is to be defined)
init: function () { this.control({ //addDrug is alias of view & addModify is action given to button in view 'addDrug button[action=addModify]': { click: this.updateUser } }); }, updateUser: function (button) { //write your function here },
Problem:- How to make the nested model
Solution:- You don't need to use association for that just in fiels add {name : "name","model":"model of that field"}, You can see in the following code that the last field instead of using type model is used to make it a nested model.Ext.define('Registration.model.Person', { extend: 'Ext.data.Model', fields: [{ name: 'id', type: 'number' }, { name: 'gender', type: 'string' }, { name: 'age', type: 'string' }, { name: 'uuid', type: 'string' }, { name: 'names', model: 'Registration.model.names' }] });
Problem:- Cannot load local json/resource files using Ajax (XMLHttpRequest cannot load file:///D:/Raxa-JSS/src/doctors.json?_dc=1339103245708. Origin null is not allowed by Access-Control-Allow-Origin.)
Solution:- Due to browser security local files cannot be loaded by Ajax. Different browsers use different flags (add the parameters to your browser launch shortcut icon), but following are some that most Raxa devs use:Chrome: --allow-file-access-from-files Safari: --disable-web-security
Problem:- Unable to give root of a Json file in Sencha Touch 2
Solution:- Use rootProperty instead of root in the store. refer to sencha docs for more information.
Problem:- How to stop some field(like "id") in model to be sent in body of the rest calls?
Solution:- use "persist=false" property while defining the fields. For eg:-fields: [{ name: 'id', //every model have a id field by default and it shouldn't go with post call's body so //we defined it and made the persist property false persist: false },
Problem:- How to change the persist property in controller to change it dynamically according to the data?
Solution:- below is an example in which the age field some time can have value n some times not, as openmrs server don't accept empty fields(gives 500 response status) it was need to change its persist property if empty or not. So, this is how i did it.if (Ext.getCmp('patientAge').isValid()) { jsonperson.data.age = Ext.getCmp('patientAge').value; Registration.model.Person.getFields()[2].persist = true; } else { Registration.model.Person.getFields()[2].persist = false; }
"Registration.model.Person" is the model i am using to create the person, it contain the "age" field at index 2 of fields array of model.
NOTE:- Above solution works just for Extjs and not sencha touch.- Problem: OpenMRS has memory leaks when choosing 'Reload' or 'Stop' and 'Start' in Tomcat
9. View not displayed properly in pop-up panel( especially a list ).
Solution: Try layout: 'fit', as sometimes the view is being displayed but not at the correct place.
10. Tests do not show correct results in raxacore
Solution: As there is some demo data in openmrs for 1.8 & we are using 1.9 version right now, so try making your own data completely independent of openmrs data in moduleTestData file.
11. Raxacore Bug - something like: WARN - ServiceContext.getService(706) |2012-07-03 02:47:23,989| Waiting to get service: interface org.raxa.module.raxacore.PatientListService while the context is being refreshed
Solution: Try this link http://listarchives.openmrs.org/Waiting-to-get-service-interface-org-openmrs-api-AdministrationService-td6010736.html
12. Back end development error: A user context must first be passed to setUserContext()...use Context.openSession() (and closeSession() to prevent memory leaks!) before using the API
Solution: Don't use setUserContext() or Context.authenticate(), you should already be authenticated
13. Raxacore build error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.4:unpack-dependencies (Expand moduleApplicationContext and messages) on project raxacore-omod: Error unpacking file: /Users/adiaz/projects/raxacore/api/target/classes to: /Users/adiaz/projects/raxacore/omod/target/classes [ERROR] org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory. [ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.4:unpack-dependencies (Expand moduleApplicationContext and messages) on project raxacore-omod: Error unpacking file: /Users/adiaz/projects/raxacore/api/target/classes to: /Users/adiaz/projects/raxacore/omod/target/classes org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.
Solution: don't use "mvn compile" – do an "mvn clean" and then "mvn -Dskiptests install"
14. Help! My everything seems to work but none of my POSTs are persisted to the database!
Solution: use @Transactional on your ResourceService.java interface
15. Symbol not found exception when running controller tests:
COMPILATION ERROR : ------------------------------------------------------------- org/raxa/module/raxacore/web/v1_0/controller/RaxaAlertController.java:[116,12] cannot find symbol symbol : method setToLocationId(java.lang.Integer)
Solution: run clean and build on the entire module, then run tests on the controllers. Do not build/test on just the OMOD part of the project until the entire project has been built once.
16. Exception occurred inside setter hibernate.propertyAccessException
Solution: check each setXX() methods in your Java object. Make sure each setter is only access it's own member variable. One setter accessing another's private member may cause this exception.