Dear Rodrigo
I tired your tip, but my response is:
{json:[{value:Paddyfield Warbler,label:Paddyfield
Warbler,id:Acrocephalus agricola}]}
and -of course- there is no any suggest. :(
I thought that Catalyst::View::JSON translate perl datastructures to
corresponding JSON data structure ( hash
Looks like you need to set
expose_stash = 'json'
in your config.
Hetényi Csaba wrote:
Dear Rodrigo
I tired your tip, but my response is:
{json:[{value:Paddyfield Warbler,label:Paddyfield
Warbler,id:Acrocephalus agricola}]}
and -of course- there is no any suggest. :(
I thought that
Dear Ben van Staveren
Thank You, now it is working, but in this case, i don't know
why to use Catalyst::View::JSON, it is just a text formatting.
Later I'd like to use DBIx datasource to feed autocomplete plugin,
in this case i must manually build a special JSON formatted string.
Is there exist
Ahh!
That was the trick :)))
(expose_stash = 'json')
Now it is correctly translate the perl arrayref datastructure to JSON
array ( [ ... ] )
my @aoh = (
{
value = 1,
label = betty,
},
{
value = 2,
label= jane,
},
{
value = 3,
Probably not the most pretty one but:
Given you have a resultset obtained with, say,
my $result_set = $c-model('DB::Somedata')-search_rs({...}, {...});
$c-stash-{json} = [
map { id = $_-id, label = $_-name } ($result_set-all)
];
Or a bit more verbose:
foreach my $result ($result_set-all) {
On Mon, 26 Apr 2010 16:33:31 +0700
Ben van Staveren benvanstave...@gmail.com wrote:
Probably not the most pretty one but:
Given you have a resultset obtained with, say,
my $result_set = $c-model('DB::Somedata')-search_rs({...}, {...});
$c-stash-{json} = [
map { id = $_-id, label =
Used it but at the same time, doing my $hashref = { $row-get_columns }
got me more or less the same effect for a lot less hassle :)
I actually do this for most my DB objects that get serialised to JSON,
quite simple case of $c-stash-{json} = [ map { $_-get_columns }
$rs-all ];
In a similar
HRI will return prefetched rels too, get_columns won't.
--
Best regards, Alex
Am Montag, den 26.04.2010, 17:23 +0200 schrieb Ben van Staveren:
Used it but at the same time, doing my $hashref =
{ $row-get_columns } got me more or less the same effect for a lot
less hassle :)
I actually do
Dear All
Is there anyone, who has success with this combination?
I have no idea, how to use this.
On the Jquery Autocomplete demo page, i 'd like to do as you can see in
the second demo
(Remote datasource), but not working.
If examine the original demo response with firebug, i see, that the
I noticed, the Autocomplete plugin waits for String-Array or Object-Array,
(which
starts and ends with [ ...] ) but my code always starts and ends with {
... } (JSON object type).
I tried many perl data-structure, but always starts with { ...
Original working response (with HTML header):
10 matches
Mail list logo