json array listview in blackberry cascades - blackberry

1.Array Type
{"DATA":
[
{"CategoryID":"3","CategoryName":"News","CountryID":"1","Result":"OK"},
{"CategoryID":"4","CategoryName":"Daily Paper","CountryID":"1","Result":"OK"},
{"CategoryID":"5","CategoryName":"Thanthi","CountryID":"1","Result":"OK"},
{"CategoryID":"1","CategoryName":"Newspaper","CountryID":"1","Result":"OK"},
{"CategoryID":"2","CategoryName":"Magazine","CountryID":"1","Result":"OK"}
]
}
2.Direct Type
[
{"CategoryID":"3","CategoryName":"News","CountryID":"1","Result":"OK"},
{"CategoryID":"4","CategoryName":"Daily Paper","CountryID":"1","Result":"OK"},
{"CategoryID":"5","CategoryName":"Thanthi","CountryID":"1","Result":"OK"},
{"CategoryID":"1","CategoryName":"Newspaper","CountryID":"1","Result":"OK"},
{"CategoryID":"2","CategoryName":"Magazine","CountryID":"1","Result":"OK"}
]
for direct type declaration --->
ListItemComponent {
type: "listItem"
StandardListItem {
title: ListItemData.CategoryName
}
}
my question is how to declare title: ListItemData.??????? for first json array model

try this
ListItemComponent {
type: "listItem"
StandardListItem {
title: ListItemData.DATA[0].CategoryName
}
}

Related

how to define multiple object times in map object in Open api yml

I am newbie to openapi . I need some help in writing open api yml 3.0
for below response format
{
“Details”: {
“detail1”: [
{
"id": “idvalue”1,
“Info”: {
“Testinfo1”: "1.0.0",
“Testinfo2”: "2.0.0"
}
}
],
“Detail2”: [
{
"id": “idvalue2”,
“Info”: {
“Testinfo3”: "1.0.0",
“Testinfo4”: "2.0.0" }
}
],
"Detail3”: [
{
“First name”: “firstName,
“Lastname: “last”Name,
“Address”: “address”,
“Dependents”: []
}
]
},
"links": {
"self": {
"href": “some url”
}
}
}
detail1, detail2, detail3 could be different object types or same object types
and there can be any no of details .
I am struck at below points
how can i represent map open api
how to represent multiple object types with in map.
Check this below YAML snap
DetailsSchemaElement:
type: object
properties:
Details:
type: object
properties:
detail1:
type: array
items:
properties:
id:
type: string
Info:
type: object
properties:
Testinfo1:
type: string
Testinfo2:
type: string
Detail2:
type: array
items:
properties:
id:
type: string
Info:
type: object
properties:
Testinfo4:
type: string
Testinfo3:
type: string
Detail3:
type: array
items:
properties:
First-name:
type: string
Address:
type: string
Dependents:
type: array
items:
type: string
Lastname:
type: string
links:
type: object
properties:
self:
type: object
properties:
href:
type: string

How do I correctly populate a JQuery datatable using array of objects?

The table is generated properly with the right number of rows and columns but the cells are empty. Source of data is an array of objects.
The code I used:
$('#myTable').DataTable( {
data:ar3,
"columns": [
{ title: "balance" },
{ title: "employeedetails" },
{ title: "position" },
{ title: "salaryamt" },
{ title: "startingdate" }
]
} );
`

format swagger document text style solution

I have a swagger fragment like this
responses: { '200': { description: 'Agent data', schema: { type: object, properties: { agentRecord: { type: object, properties: { username: { type: string }, vpnname: { type: string }, google_id: { type: string } } }, googleRecord: { type: object }, agentACLs: { type: object } } } }, default: { description: 'Unexpected error', schema: { $ref: '#/definitions/Error' } } }
but I want it to be like
"responses": {
"200": {
"description": "Successful response",
"schema": {
"$ref": "#/definitions/Success"
}
},
How to convert text style from (1) to (2)? I couldn't find any solution in the internet.
UPDATE
I am not developing a program I just want to eliminate handy work and convert one text style to text with another style.
Paste your YAML into http://editor.swagger.io and then select the menu item Edit > Convert to YAML. This will pretty-print your YAML.

How do I view the JSON behind a Google Slide?

I want to know what elements of a slide can be changed programmatically; one way to understand what's going on would be to look at the JSON behind slides. I have the slides ID but haven't figured out how to look at it in any way except the standard wysiwyg editor.
For the whole presentation, you can check this documentation.
JSON representation
{
"presentationId": string,
"pageSize": {
object(Size)
},
"slides": [
{
object(Page)
}
],
"title": string,
"masters": [
{
object(Page)
}
],
"layouts": [
{
object(Page)
}
],
"locale": string,
"revisionId": string,
"notesMaster": {
object(Page)
},
}
And for each page, you can refer to REST Resource: presentations.pages.
JSON representation
{
"objectId": string,
"pageType": enum(PageType),
"pageElements": [
{
object(PageElement)
}
],
"revisionId": string,
"pageProperties": {
object(PageProperties)
},
// Union field properties can be only one of the following:
"slideProperties": {
object(SlideProperties)
},
"layoutProperties": {
object(LayoutProperties)
},
"notesProperties": {
object(NotesProperties)
},
"masterProperties": {
object(MasterProperties)
},
// End of list of possible types for union field properties.
}

How to load kendo observable data array from MVC controller?

I have the following kendo observable object:
var observable = kendo.observable({
people: [
{ name: "John Doe" },
{ name: "Jane Doe" },
{ name: "Jimmy Doe" }
],
products: [
{ name: "Table" },
{ name: "Chair" },
{ name: "Tomato" }
],
animals: [
{ name: "Dog" },
{ name: "Cat" },
{ name: "Monkey" }
]
});
Can i make the inner collections load Json data directly from seperate controllers?
Yes. You need to create a controller that returns a Json result. Make an ajax call to the controllers route and stuff the response into a variable. Then refer to that in your observable. It might look something like this on the front end:
$.ajax("mysite/getstuff").done(
function(data){
var observable = kendo.observable(data);
});
In this case the getstuff method on the controller needs to return a JSON object containing all of the properties and arrays you need like this:
{
people: [array of people],
products: [array of products],
animals: [array pf animals] //etc
}

Resources