Page 1 of 1

Generic Service Results not Populating List

Posted: Mon Dec 22, 2014 3:47 am
by Yurii Orishchuk

Hi Dave,

In the following line of code you return string, but pure "object/array" needed.

pre

settings.success(JSON.stringify(ourFinalArray));

/pre

Correct code will be:

pre

settings.success(ourFinalArray);

/pre

Also, don't forget to set correct response parameters. You can do it automatically if you have JSON response from "Test" tab of your service.

Regards.


Generic Service Results not Populating List

Posted: Mon Dec 22, 2014 6:10 am
by DaveVockell

Making that change throws this error:

Uncaught Error: Attempt to access Array by property name : 'type'mapping-impl.js:325 window.mep.getmapping-impl.js:343 window.mep.getmapping-impl.js:310 window.mep.getmapping-impl.js:82 window.entry.Entry.getValuemapping-impl.js:196 window.mapping_unit.MappingUnit.processMappingsmapping-impl.js:127 window.mapping_unit.MappingUnit.processmapping-impl.js:10 processMappingActiongrabdata.js:135 window.listo.Apperyio.datasources.listo.Apperyio.DataSource.onSuccessappery.js:359 Apperyio.DataSource.$a.createClass.__successHandlerjquery-2.1.1.js:513 proxylistgrab.js:36 (anonymous function)

If I switch it back, the error goes away, but still no table built.

In this example, it has the JSON.stringify modifier like I had....

http://devcenter.appery.io/tutorials/...


Generic Service Results not Populating List

Posted: Tue Dec 23, 2014 12:03 am
by Yurii Orishchuk

Hi Dave

it seems you have wrong response parameters.

Please show us your response JSON structure and screen shot from the server response tab.

Regards.


Generic Service Results not Populating List

Posted: Tue Dec 23, 2014 1:48 am
by DaveVockell

This is the response:

Image

Here is what I can see...

If I add in a console.log line as a I generate the response

for (i = 0; i < len; i++) { // for each row
ourFinalArray.push(results.rows.item(i)); // pushing row object to an array
console.log(results.rows.item(i));
}

then it shows what looks like the correct data object:

Image

If I remove any data mapping, no error is thrown, but it does not build an empty table. If I map one of the elements ("short") , it throws the error:

Uncaught Error: Attempt to access Array by property name : 'short'


Generic Service Results not Populating List

Posted: Tue Dec 23, 2014 4:18 am
by Yurii Orishchuk

Dave,

Nope, your response parameters not good...

You have an pure JS array as response.. But in your parameters you specify only one item.

See details about correct response type for your case: http://prntscr.com/5jyuk6/direct

Regards.


Generic Service Results not Populating List

Posted: Tue Dec 23, 2014 7:16 am
by DaveVockell

PERFECTO.

Thanks.


Generic Service Results not Populating List

Posted: Fri Jul 17, 2020 2:15 pm
by DaveVockell

\""desc\"":\""0\""}]'); settings.success('[{\""id\"":\""\""