Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 13
Registered: ‎02-11-2013
My Device: Simulator :D
My Carrier: Plus GSM

DataModels contradiction

Hello,

I wrote a simple application using XmlDataModel, the database has been placed in the data / base.xml. When I tested it in the simulator BlackBerry Simulator 10 Dev Alpha BB10_0_10.261  all worked fine. However, during testing on BlackBerry  Simulator 10 Dev Alpha BB10_1_X.338 list does not display ... So I changed the data model to GroupDataModel using DataSource. Then my app began to work on BlackBerry  Simulator 10 Dev Alpha BB10_1_X.338 but list is not display on BlackBerry Simulator 10 Dev Alpha BB10_0_10.261. Can you tell me what is wrong? Or on wchich simulator schould I test my app to work good on phisical BB10 device?

Greetings,

Mat

Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

[ Edited ]

I have not met this situation before. May you be able to show some relative source code snippet?

 

or can you have a try to put base.xml into the root folder of assets to have a try?




p(^_^)q
Good good study, day day up
New Developer
Posts: 13
Registered: ‎02-11-2013
My Device: Simulator :D
My Carrier: Plus GSM

Re: DataModels contradiction

When I put xml file in assets folder it works. But I need to modify content of my database so I must put file in data folder. And I am wondering why it works on one simulator and not on another...

Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

I think that you have a mistake with the subfolder reference. May you attach your source code about how did you set up the data source?




p(^_^)q
Good good study, day day up
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

Just found another developer's post : http://supportforums.blackberry.com/t5/Cascades-Development/Bug-Report-qmldir-file-not-working-in-ND...

 

Is it a bug of that version of SDK? I have not updated into that version yet.




p(^_^)q
Good good study, day day up
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

But I still don't understand with your statement "I need to modify content of my database so I must put file in data folder", why it must be put into data folder? Does your database refer to QSqlDatabase?




p(^_^)q
Good good study, day day up
New Developer
Posts: 13
Registered: ‎02-11-2013
My Device: Simulator :D
My Carrier: Plus GSM

Re: DataModels contradiction

I dont use SQLDataBase only XML file as database, and in documentation I read that I can not write in assets folder. This is code of my ListView and function which returns path to file.

 

                                  ListView {
                                       dataModel: XmlDataModel {
                                            source: mainObj.sciezka()
                                        }
                                        listItemComponents: [
                                            ListItemComponent {
                                                type: "listItem"
                                                Container {
                                                    layout: StackLayout {
                                                    }
                                                    Container {
                                                        layout: StackLayout {
                                                            orientation: LayoutOrientation.LeftToRight
                                                        }
                                                        topPadding: 20
                                                        leftPadding: 100.0
                                                        bottomPadding: 20
                                                        ImageView {
                                                            imageSource: "asset:///images/checked.png"
                                                        }
                                                        Label {
                                                            horizontalAlignment: HorizontalAlignment.Fill
                                                            text: "   " + ListItemData.task
                                                            textStyle {
                                                                base: SystemDefaults.TextStyles.TitleText
                                                                fontWeight: FontWeight.Bold
                                                                fontStyle: FontStyle.Italic
                                                            }
                                                        }
                                                    }
                                                    Container {
                                                        background: Color.DarkGreen
                                                        Divider {
                                                            opacity: 0.0
                                                        }
                                                    }
                                                }
                                            }
                                        ]
                                    }

 and content of sciezka() function

QString ApplicationUI::sciezka() {
	return (QDir::homePath()+"/items.xml");
}

 

Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

You can use QDebug with "QDir::homePath()" to see what it is on different simulator.

 

Or you can have a try with a hard coding string "data" since your datafeed xml is always put into data folder.

 

 




p(^_^)q
Good good study, day day up
Developer
Posts: 313
Registered: ‎05-31-2010
My Device: Alpha 10, Bold 9900, Storm 9530, Tour 9630, Curve 9320, Curve 8900
My Carrier: All

Re: DataModels contradiction

[ Edited ]

I have readed the sample application of "dombookmarks", it can read and write to the xml files which are under assets folder without any problem.  Can you have a try with that sample application on your two simulators to see whether it has the same issue or not?

 

Sorry, confirmed with dombookmarks source code again, it saved into tmp folder. Sorry. But you can have a try with this sample application on the latest version of SDK.




p(^_^)q
Good good study, day day up
New Developer
Posts: 13
Registered: ‎02-11-2013
My Device: Simulator :D
My Carrier: Plus GSM

Re: DataModels contradiction

It ispossible that you understood me wrong. In second simulator (this one on which XMLDataModel does not work) is created all database. I can check it in Target Navigator File System. Problem is that these data are not displayed in the list, and the same code works on another simulator..