Hi Thushara,

As I understood, what you want to do is that remove a record from the table
on a button click.

So to do that, you should understand the way that Jaggary works. Simply,
Jaggary is not a client side scripting API. Jaggary executes in server side
live JSP. So we have to send a request to the server which contain the
jaggary code. As you can see in the tutorial you have followed, you have to
write separate methods to add, remove employees. and you should have a way
to find the relevant method to execute. (Hint: using an additional
parameter to identify the function). In add remove methods you should
update the employees.json file as described in the tutorial.






On Tue, Aug 19, 2014 at 3:24 PM, Buddhima Wijeweera <[email protected]>
wrote:

> Hi,
>
> Hope following example will give you the answer:
>
> <%
>  var e = {
>  "employees": [
>   {
>    "id": "1",
>    "name": "Kasun",
>    "age": "25",
>    "town": "Galle",
>    "salary": "40000"
>   },
>   {
>    "id": "3",
>    "name": "Sunil",
>    "age": "29",
>    "town": "Colombo",
>    "salary": "20000"
>   },
>   {
>    "id": "4",
>    "name": "Rani",
>    "age": "32",
>    "town": "Kandy",
>    "salary": "60000"
>   }
>
>  ]
>
> }; // Initial array
>
> delete e.employees[0] // Delete first element
>
> print(e); // Print array
>
> %>
>
> Which results:
> {"employees" : [{"id" : "3", "name" : "Sunil", "age" : "29", "town" :
> "Colombo", "salary" : "20000"}, {"id" : "4", "name" : "Rani", "age" : "32",
> "town" : "Kandy", "salary" : "60000"}]}
>
>
>
>
> On Tue, Aug 19, 2014 at 2:57 PM, Thushara Ranawaka <[email protected]>
> wrote:
>
>>
>>
>> ---------- Forwarded message ----------
>> From: Thushara Ranawaka <[email protected]>
>> Date: Tue, Aug 19, 2014 at 2:56 PM
>> Subject: How to delete json element using Jaggery?
>> To: WSO2 Training Group <[email protected]>, Waruna De Silva <
>> [email protected]>, [email protected]
>>
>>
>> Hi,
>> As per the fast track training for the new employees in the 6.a.ii we
>> need to develop a jaggery app, that deal with JSON data formats. Therefore
>> I found this article[1] and followed it. Now I need to add a new feature
>> which is to delete this json elements one by one. I logged a question in
>> stackoverflow[2] as well but no one is answering it. Could some one help me
>> on this.
>>
>> Kindly refer the stackoverflow question for more information.
>>
>>    1.
>>
>>   [1]
>> http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html
>> <http://www.google.com/url?q=http%3A%2F%2Fblog.lasindu.com%2F2014%2F05%2Fhow-to-write-wso2-jaggery-application.html&sa=D&sntz=1&usg=AFQjCNHkm7jAgXBGXMs_wTQv6x7lpmhrUw>
>> [2]
>> http://stackoverflow.com/questions/25304255/how-to-delete-json-element-using-jaggery
>>
>>
>> <http://www.google.com/url?q=http%3A%2F%2Fblog.lasindu.com%2F2014%2F05%2Fhow-to-write-wso2-jaggery-application.html&sa=D&sntz=1&usg=AFQjCNHkm7jAgXBGXMs_wTQv6x7lpmhrUw>
>> --
>> Thushara Kasun Ranawaka
>> Software Engineer
>> WSO2 Inc.; <http://wso2.com/>
>> lean.enterprise.middleware
>> Mobile : *+94 (0) 773438949*
>> *[email protected] <[email protected]>*
>>
>>
>>
>> --
>> Thushara Kasun Ranawaka
>> Software Engineer
>> WSO2 Inc.; <http://wso2.com/>
>> lean.enterprise.middleware
>> Mobile : *+94 (0) 773438949*
>> *[email protected] <[email protected]>*
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Buddhima Wijeweera
> Software Engineer; WSO2 Inc.; http://wso2.com ,
>
> Email: [email protected]
> Blog:   https://buddhimawijeweera.wordpress.com
> GitHub Profile: https://github.com/Buddhima
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Thank you.

*Dinesh J. Weerakkody*
Software Engineer
WSO2 Inc.
lean | enterprise | middleware
M : +94 727 361788 | E : [email protected] | W : www.wso2.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to