Added field_loop to output of Thingy's www_getThingViaAjax method
This commit is contained in:
parent
4bcf12da02
commit
1378ab0d41
2 changed files with 10 additions and 0 deletions
|
|
@ -2308,6 +2308,15 @@ sub www_getThingViaAjax {
|
|||
return $session->privilege->insufficient() unless $self->canViewThing($thingId,
|
||||
$thingProperties->{groupIdView});
|
||||
|
||||
my @field_loop;
|
||||
my $fields = $session->db->read('select * from Thingy_fields where assetId=? and thingId=? order by sequenceNumber'
|
||||
,[$self->getId,$thingId]);
|
||||
while (my $field = $fields->hashRef) {
|
||||
$field->{formElement} = $self->getFormElement($field);
|
||||
push(@field_loop,$field);
|
||||
}
|
||||
$thingProperties->{field_loop} = \@field_loop;
|
||||
|
||||
$session->http->setMimeType("application/json");
|
||||
return JSON->new->utf8->encode($thingProperties);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ cmp_deeply(
|
|||
onEditWorkflowId=>undef,
|
||||
onDeleteWorkflowId=>undef,
|
||||
sortBy=>undef,
|
||||
field_loop=>[],
|
||||
},
|
||||
'Getting newly added thing as JSON: www_getThingViaAjax returns correct data as JSON.'
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue