yellowduckbear

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • in reply to: jqGrid not being populated with JSON data from Java Servlet #99181
    yellowduckbear
    Participant

    I'Hi!

    In jqGrid:

    jQuery(“#campTimetable”).jqGrid({

    url:'/admin/getTimetable',

    datatype: 'json',

    In JavaServlet:

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    // TODO Auto-generated method stub

    logger.info(“TimetableServlet doGet”);

    HttpSession session = request.getSession(true);

    try

    {

    timetableList = getListFromSomeWhere …

    JSONObject responcedata=new JSONObject();

    net.sf.json.JSONArray cell=new net.sf.json.JSONArray();

    net.sf.json.JSONArray cellarray=new net.sf.json.JSONArray();

    net.sf.json.JSONObject cellobj=new net.sf.json.JSONObject();

    responcedata.put(“page”, Long.parseLong(“1”));

    Iterator itr = timetableList.iterator();

    while(itr.hasNext()){

    Timetable t = itr.next();

    cellobj.put(“id”, t.getId());

    cell.add(t.field0().toString());

    cell.add( StringUtil.StringToTime( t.field1()));

    cell.add( StringUtil.StringToTime( t.field2()));

    cellobj.put(“cell”, cell);

    cell.clear();

    cellarray.add(cellobj);

    }

    responcedata.put(“rows”, cellarray);

    response.setContentType(“applisation/json”);

    PrintWriter out = response.getWriter();

    out.print(responcedata);

    out.flush();

    }

    catch(Exception e)

    {

    logger.error(“Error TimetableServlet goGet: ” + e.toString());

    }

    }

    It's work for me.

    KiT

    in reply to: jgGrid customized add new form #99180
    yellowduckbear
    Participant

    Try the recreateForm and beforeShowForm in pager add section …

    recreateForm: true,

    beforeShowForm: function(form){

    $(“#field0 from colModel”, form).attr('value', '3');

    $(“#field1 from colModel”, form).attr('hidden', 'true');

    etc

    },

    KiT

Viewing 2 replies - 1 through 2 (of 2 total)

Stay connected with us in your favorite flavor!