Question

I can't send this params to server using jqTreeGrid and Java with Struts2:

  • level
  • parent
  • isLeaf
  • expanded

I have created a jqGrid TreeGrid using this documentation treegrid

This is my code:

jQuery("#treegrid2").jqGrid({
 treeGrid: true,
            treeGridModel : 'adjacency',
            ExpandColumn : 'name',
            url: './getTaskManagement.action',
            editurl:'./sendActions.action',
            datatype: "json",
            jsonReader: {root: "listTask", repeatitems: false},
            mtype: "POST",
            colNames:["id","Task Division","PM", "Risk", "Duration","Start Date","End Date","NR","Comments","Parent","isLeaf","Level","Expanded"],
            colModel:[
                    {name:'id',index:'id', width:1,hidden:true,key:true,editable:true},
                {name:'name',index:'name', width:420,editable:true},
                {name:'pm',index:'pm', width:80, align:"center",editable:true},
                {name:'risk',index:'risk', width:60, align:"center",editable:true},
                {name:'duration',index:'duration', width:80, align:"right",editable:true},      
                {name:'begin',index:'begin', width:80,align:"right",editable:true}, 
                {name:'end',index:'end', width:80,align:"right",editable:true},
                {name:'nr',index:'nr', width:80,align:"right",editable:true},   
                {name:'comments',index:'comments', width:170,align:"center",editable:true},
                {name:'parent',index:'parent',hidden:true,editable:true},
                {name:'isLeaf',index:'isLeaf',hidden:true,editable:true},
                {name:'level',index:'level',hidden:true,editable:true},
                {name:'expanded',index:'expanded',hidden:true,editable:true}

            ],
            height:'auto',
            viewrecords : true,
            multiselect : true,
            multiboxonly : true,
            pager : "#ptreegrid2",
            caption: "Example TreeGrid"

});

and this is the json result from server:

{
"actions": "success",
"rows": [
    {
        "begin": "2014-01-27",
        "comments": "Some comments",
        "duration": 20,
        "end": "2014-02-17",
        "expanded": "false",
        "id": 1,
        "isLeaf": "false",
        "level": "0",
        "name": "<b>A.Project Launch</b>",
        "nr": "Some NR",
        "parent": "",
        "pm": "Some pm",
        "risk": "Some risk"
    },
    {
        "begin": "2014-01-27",
        "comments": "Some comments",
        "duration": 2,
        "end": "2014-01-29",
        "expanded": "false",
        "id": 2,
        "isLeaf": "true",
        "level": "1",
        "name": "Reverse SAMIR (if necessary): review what is in production",
        "nr": "Some NR",
        "parent": "1",
        "pm": "Some pm",
        "risk": "Some risk"
    }
]

}

When I Try to edit a record using jqGrid pager I can send all params from colModel, except level, parent, isLeaf and expanded.

Request Header Form data:

  id:1
    name:A.Project Launch
    pm:Some pm
    risk:Some risk
    duration:20
    begin:2014-01-27
    end:2014-02-17
    nr:Some NR
    comments:Some comments
    oper:edit

and when I try to add new record send these params to server:

id:
name:a
pm:b
risk:c
duration:1
begin:e
end:f
nr:g
comments:h
parent:
oper:add

However never sends the other params (level,isLeaf,Expnaded), I need the params beacause I want to save an object with Java in database. so If these params are null obviusly in database are null too.

When I Try to retrieve the json data again (level,isLeaf,Expnaded,parent) are null and jqGrid TreeGrid don't respect the format because need these params for build correctly the Tree Grid.

Does somebody have an idea to solve this?

thanks and regards!!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top