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
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Creating a listview

[ Edited ]
[
	{ 	
        "firstName" : "Mike",
		"lastName" : "Chepesky",
		"employeeNumber" : 01840192
	},
	{
		"firstName" : "Westlee",
		"lastName" : "Barichak",
		"employeeNumber" : 47901927
	},
	{ 	
        "firstName" : "Jamie",
		"lastName" : "Lambier",
		"employeeNumber" : 51239657
	},
	{ 	
        "firstName" : "Denise",
		"lastName" : "Marshall",
		"employeeNumber" : 41239520
	},
	{ 	
        "firstName" : "Matthew",
		"lastName" : "Taylor",
		"employeeNumber" : 01963597
	},
	{ 	
        "firstName" : "Mark",
		"lastName" : "Tiegs",
		"employeeNumber" : 65321951
	},
	{ 	
        "firstName" : "Karla",
		"lastName" : "Tetzel",
		"employeeNumber" : 03266987
	},
	{ 	
        "firstName" : "Ian",
		"lastName" : "Dundas",
		"employeeNumber" : 29472012
	},
	{ 	
        "firstName" : "Marco",
		"lastName" : "Cacciacarro",
		"employeeNumber" : 56446691
	}
]

 

 

thats my json file

 

i do this

 

	ListView *listView = root->findChild<ListView*>("listIt");
		GroupDataModel *model = new GroupDataModel(
				QStringList() << "firstName" << "lastName");

		// Create a JsonDataAccess object and load the .json file. The
		// QDir::currentPath() function returns the current working
		// directory for the app.
		JsonDataAccess jda;
		QVariant list = jda.load(QDir::currentPath() +
		    	                         "/app/native/assets/employees.json");
		model->insertList(list.value<QVariantList>());

		// Set the data model for the list view
		listView->setDataModel(model);

 

 

why does it get sorted , and employee number shows up in each line?

 

How can I create the table from that json file..with first name/last name besides each other

 

Plus, how can I on click of item component pull a move?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Creating a listview

GroupDataModel is a sorted data model...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__groupdatamodel.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Creating a listview

There's some examples here on how to work with JSON...

 

http://developer.blackberry.com/native/reference/cascades/bb__data__jsondataaccess.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.