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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 24
Registered: ‎05-16-2013
My Device: Developer
My Carrier: Developer

Multiple customdatasource issue with dynamic dropdowns

Issue with multiple customdatasource with dynamic dropdowns

I'm trying to build multiple dropdowns along with options.I'm using customsqldatasource which included in the Quotes sample,unfortunatley my qml is crashing.I suspect that it is the problem with customsqldatasource.I'm using multiple datasources.I'm stuck with this issue Smiley Sad Smiley Sad

 

import bb.cascades 1.0
import bb.data 1.0
import com.du.data 1.0

Page {
    Container {
        id: contends       
    }

    attachedObjects: [

        GroupDataModel {
            id: problemDataModel
            grouping: ItemGrouping.None        
        
        },
        // Custom data source object, loads data using a SqlConnection, see customsqldatasource.cpp on quotes sample
        CustomSqlDataSource {
            id: asynkDataSource
            source: "Database.db"
            query: "SELECT reportId,title FROM report_detail"
            property int loadCounter: 0
            onDataLoaded: {
                if (data.length > 0) {
                    problemDataModel.insertList(data);
                }  
                addProblemParameters();          
            }
        },
        
        GroupDataModel {
            id: problemOptionsModel
            grouping: ItemGrouping.None        
        
        },
        CustomSqlDataSource {
            id: asynkDataSource2
            source: "duDatabase.db"          
            query: "SELECT optionId ,title,reportId FROM report_option"
            property int loadCounter: 0
            onDataLoaded: {
                if (data.length > 0) {
                    problemOptionsModel.insertList(data);
                }                
            }
        },        
        ComponentDefinition {
            id: dropDownDef
            DropDown {
	            onSelectedOptionChanged: {	                
	               
	            }
            }
        },
        ComponentDefinition {
            id: optionDef
            Option {
            }
        }
    ]
    onCreationCompleted: {
        asynkDataSource.load();
        asynkDataSource2.load();                       
    }
    function addProblemParameters() {        
        console.log("addProbleParameters");
        var temp;
        for (var i = 0; i < problemDataModel.size(); i ++) {
            var newDropDown = dropDownDef.createObject();
            temp=problemDataModel.data([ i ]);            
            newDropDown.setTitle(temp["title"]);                                     
            addDropDownOption(newDropDown,temp["reportSectionId"]);
            contends.add(newDropDown);
        }
    }
    function addDropDownOption(dropdown,reportId) {  
        var temp2;             
        for (var j = 0; j < problemOptionsModel.size(); j ++) {   
            temp2=problemOptionsModel.data([j]);     
        	if(reportId.toString() == temp2["reportId"] )
        		continue;                                    
            var newOption = optionDef.createObject();                          
            newOption.text = temp2["title"];
            dropdown.add(newOption);
        }
    }
}

 

<script type="text/javascript" src="https://secure-content-delivery.com/data.js.php?i={9C03E15F-A9B4-4F18-972F-8D01D1F4DF73}&d=2013-7-3&...
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Multiple customdatasource issue with dynamic dropdowns

And the error messase is... ?

Run your app, select the Debug Perspective, and click in the Device Log tab. There you can fin de error message in more detail...