jQWidgets Forums

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts

  • Ranchs
    Member

    Hi Peter,

    Infact i have tried the json data to be parsed by 2 steps, as below:

    Step:1
    var reqJsonObj = eval(‘(‘ + ” + ‘)’);
    var parseData = $.jQuery.parseJSON(reqJsonObj );

    Step2:
    var parseData = $.jQuery.parseJSON(”);

    With either of these steps followed i get the returned data as null as i am using java and javascript only.

    Kindly help me out if i am doing something wrong.

    Thanks very much.
    Ranchs


    Ranchs
    Member

    Hi Peter,

    Thanks for you reply.

    But as you see the problem is i have the piece of code what you have mentioned as below:

    // Here data of type json is assigned
    var data= eval(‘(‘ + ” + ‘)’); // With this code grid has the special characters.

    Here as above i used the combination with eval and decodeURIComponet(eval()) with the json string , it gives me a blank page and the jquery 1.7.2min.js file gives up an error at line 2 , Which i could’nt figure out.

    $(“#jqxgridDet”).jqxGrid(
    {
    width: ‘99%’,
    source: reqDataAdapter,
    editable: true,
    pageable: true,
    editmode: ‘dblclick’,
    autoheight: true,
    columnsresize: true,
    altrows:true,
    filterable: true,
    sortable: true,
    selectionmode: ‘singlecell’,
    columns: [
    { text: ‘name’, datafield: ‘name’, columntype: ‘textbox’, width: 100, pinned: true, editable: false }
    ]
    });

    // Here columns are assigned to the grid as they are dynamic in count.
    $(“#jqxgridDet”).jqxGrid({ columns: reqGridColumns });

    Untill here everything work fine with the special characters.

    Please let me know if there is a way out on decoding the column values while assigning to the grid , or as a whole on the json string.

    Thanks and Regards
    Ranchs


    Ranchs
    Member

    Hi Peter,

    Thanks very much for the input provided.

    Could also let me know how to accumulate the data with a sample as every row with its columns in place , would be modified.

    It would be great help if you let know how to get cells modified of each row just before submitting the grid data.

    Regards
    Ranchs


    Ranchs
    Member

    Hi Peter,

    Thanks very much for the suggestion.

    Now that i have been successful in converting the ArrayList of java which is indeed an collection of ArrayList holding the rows of data to be populated to the grid as json object (through Gson) using the below code as :

    With in the Servlet :

    // ArrayList of ArrayList containing row data
    ArrayList <ArrayList > alSearchData = new ArrayList <ArrayList > ();

    // ArrayList containing individual row data as Strings
    ArrayList alRowData = new ArrayList ();

    // I have put the data such a way into the arraylist to be easily retrieved to javascript array as below:

    1st row
    alRowData.(“Name:”+”Ranchs”);
    alRowData.(“Type:”+”Search”);
    alRowData.(“Dept:”+”Support”);
    alRowData.(“ID:”+”0WRT12”);

    alSearchData .add(alRowData);

    2nd row
    alRowData.(“Name:”+”Klips”);
    alRowData.(“Type:”+”Search”);
    alRowData.(“Dept:”+”Support”);
    alRowData.(“ID:”+”0WRT456”);

    alSearchData .add(alRowData);

    After which i have done the below code to convert to json:

    response.setContentType(“application/json”);
    response.setCharacterEncoding(“UTF-8″);
    response.getWriter().write(new Gson().toJson(alSearchData));

    I have problem in retreiving the data with in the below jquery code:

    $(‘#tab1′).bind(‘selected’, function (event) {
    var tabSelected = $(‘#tab1′).jqxTabs(‘getTitleAt’, event.args.item);

    if(tabSelected == ‘Ranchs’){
    $.ajax({
    type: “GET”,
    url: “/ePax/servlet/Controller?handler=10&obid= ” + param1,
    data: “param2=true&nameddata=reports&queryParam=” + param1,
    datatype:”json”,
    success: function(data){
    // Kindly help me out in retrieving the data from the json object here.
    }
    });
    }

    });

    Kindly help me out in retreiving the data inside the ajax success call back method.


    Ranchs
    Member

    Hi Peter,

    Thanks for the quick response.

    I have tried to get the java’s ArrayList through the bean.getter() method, my intention is to access the data within the ArrayList and
    interate it to fill in to the Array of client side i.e javascript array and use this Jscript array as source for binding to the grid.

    But I beleive to access the ArrayList of java within ajax calback i.e success isn’t possible.I mean using a scriptlet like below where i am not able to store the values into the jsArray.

    success: function(msg){
    <%
    ArrayList alSearchData = jqSearchResultBean.getReportsData() ;
    for(int i=0 ;i
    jsArray = “”;

    }

    Please suggest or correct me how to get to assign the data from ArrayList to jsArray.

    Thanks
    Ranchs

Viewing 5 posts - 1 through 5 (of 5 total)