Hi Dakshika,
I followed your example (see [1]) and implemented my solution. Here is my
code. Here updateTableColumns function is called when the AJAX call is
completed successfully.
/**
* Updates table cells using Caramel engine.
* @param assetData {Object} asset
* @param statusTd {jQuery} table cell to be updated in the STATUS column
* @param actionsTd {jQuery} table cell to be updated in the ACTIONS column
*/
function updateTableColumns(assetData, statusTd, actionsTd){
console.log(assetData);
caramel.render ('list-assets.status', assetData, function(info,
content){
console.log(content);
statusTd.find('span').html(content);
});
caramel.render ('list-assets.lc-actions', assetData, function(info,
content){
console.log(content);
actionsTd.find('span').html(content);
});
}
But now I get a "*Uncaught ReferenceError: async is not defined*" error in
the browser console. This error is thrown from the
'caramel.handlebars.client.js' file (line 107 [2]). How can I resolve this
issue?
PS: 'handlebars.js', 'caramel.handlebars.client.js', 'caramel-client.js'
scripts are included in the web page in this order.
[1]
https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js#L85
[2]
https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js#L107
Thanks.
On Fri, Aug 7, 2015 at 2:12 PM, Dakshika Jayathilaka <[email protected]>
wrote:
> Hi Sajith,
>
> If your want to see real implementation check below code carbon store
> publisher app.[1] search for caramel.render
>
> [1]
> https://github.com/wso2/carbon-store/blob/master/apps/publisher/themes/default/js/list_assets_pagging.js
>
> Regards,
>
> *Dakshika Jayathilaka*
> PMC Member & Committer of Apache Stratos
> Senior Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
> 0771100911
>
> On Fri, Aug 7, 2015 at 12:36 PM, Rajith Roshan <[email protected]> wrote:
>
>> Hi Sajith,
>>
>> You can write a new partial hbs file (for ex: update.hbs) inside the
>> publisher/themes/appm/partials with the content you want to display. The
>> display content should be set to a variable (for ex : output) with the
>> content you have in your JSON object. Then add these values to caramel
>> renderer as follows.
>>
>> caramel.render(output);
>>
>> Then in the main hbs file you can refer the partial page as follows.
>>
>> {{>update }}
>>
>>
>> Please refer the following doc [1] for the additional information. (Read
>> "Overriding part of a view")
>>
>> [1] -
>> https://docs.google.com/a/wso2.com/document/d/1_blb4u8aFn-6jTpHx6fynTgohAI4KQgUaEE-so5IxSg/edit?usp=sharing
>>
>>
>> Thanks,
>>
>> Rajith
>>
>>
>>
>> On Fri, Aug 7, 2015 at 8:19 AM, Sajith Ariyarathna <[email protected]>
>> wrote:
>>
>>> Hi All,
>>>
>>> I want to update a portion of the web page using Caramel. Necessary data
>>> (JSON) is obtained through an AJAX call. How do I accomplish this task? Any
>>> examples will be very helpful.
>>>
>>> PS: caramel.handlebars.client.js [1] and handlebars-1.1.2.js [2]
>>> acripts are included in the page.
>>>
>>> Thanks.
>>>
>>> [1]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/mobileapp/js/caramel.handlebars.client.js
>>> [2]
>>> https://github.com/wso2/carbon-appmgt/blob/master/features/appmgt/org.wso2.carbon.appmgt.publisher.feature/src/main/resources/publisher/themes/appm/js/handlebars-1.1.2.js
>>> --
>>> Sajith Ariyarathna
>>> Software Engineer; WSO2, Inc.; http://wso2.com/
>>> mobile: +94 77 6602284, +94 71 3951048
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Rajith Roshan
>> Software Engineer, WSO2 Inc.
>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
--
Sajith Ariyarathna
Software Engineer; WSO2, Inc.; http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev