Forum


Tony,
I'm trying to use the hidecol() method and it's not working. Could you tell me what I'm doing wrong? See Bold code below
var subgrid_table_id;
var rowdata = jQuery("#list").getRowData(row_id);
subgrid_table_id = subgrid_id+"_t";
jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"Users.cfc?method=GetSubCases&q=2&id="+row_id+"&x_object_id="+rowdata.x_object_id,
datatype: "json",
colNames: ['ID','Create D/T','Category','Priority','Status','Part Number','Part Desc','Description',''],
colModel: [
{name:"x_object_id",index:"x_object_id",key:true},
{name:"x_creation_dt",index:"x_creation_dt", align:"left",datefmt:"Y-m-d", sorttype:"date"},
{name:"x_category",index:"x_category",align:"left"},
{name:"x_priority",index:"x_priority",align:"left"},
{name:"x_current_state",index:"x_current_state",align:"left",sortable:false},
{name:"x_part_number",index:"x_part_number",align:"left",sortable:false},
{name:"x_part_description",index:"x_part_description",align:"left",sortable:false},
{name:"x_title",index:"x_title",align:"left",sortable:false},
{name:'mytyp', hidden:true}
],
height: 'auto',
width:675,
afterInsertRow : function(rowid,rowdata,rowelem) {
if (rowdata.mytyp == "PR")
{
$("#subgrid_table_id").hidecol(3);
}
},
rowNum: 10,
//imgpath: 'themes/green/images', //Image path for prev/next etc images,
sortname: 'num',
//The JSON reader. This defines what the JSON data returned from the CFC should look like
jsonReader: {
root: "ROWS",
page: "PAGE",
total: "TOTAL",
records:"RECORDS",
cell: "",
id: "0",
subgrid: {root: "ROWS", repeatitems: true, cell: "",id:"0"}
},
sortorder: "asc"
})
},
TIA, Jim
10:36

Moderators
30/10/2007

Hello,
Java Script is case sensitive use
$(”#subgrid_table_id”).hideCol(3); instead
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
this still doesn't work? See Bold below
var subgrid_table_id;
var rowdata = jQuery("#list").getRowData(row_id);
subgrid_table_id = subgrid_id+"_t";
jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"Users.cfc?method=GetSubCases&q=2&id="+row_id+"&x_object_id="+rowdata.x_object_id,
datatype: "json",
colNames: ['ID','Create D/T','Category','Priority','Status','Part Number','Part Desc','Description',''],
colModel: [
{name:"x_object_id",index:"x_object_id",key:true},
{name:"x_creation_dt",index:"x_creation_dt", align:"left",datefmt:"Y-m-d", sorttype:"date"},
{name:"x_category",index:"x_category",align:"left"},
{name:"x_priority",index:"x_priority",align:"left"},
{name:"x_current_state",index:"x_current_state",align:"left",sortable:false},
{name:"x_part_number",index:"x_part_number",align:"left",sortable:false},
{name:"x_part_description",index:"x_part_description",align:"left",sortable:false},
{name:"x_title",index:"x_title",align:"left",sortable:false},
{name:'mytyp', hidden:true}
],
height: 'auto',
width:675,
afterInsertRow : function(rowid,rowdata,rowelem) {
if (rowdata.mytyp == "PR")
{
$("#subgrid_table_id").hideCol("Status");
}
},
rowNum: 10,
//imgpath: 'themes/green/images', //Image path for prev/next etc images,
sortname: 'num',
//The JSON reader. This defines what the JSON data returned from the CFC should look like
jsonReader: {
root: "ROWS",
page: "PAGE",
total: "TOTAL",
records:"RECORDS",
cell: "",
id: "0",
subgrid: {root: "ROWS", repeatitems: true, cell: "",id:"0"}
},
sortorder: "asc"
})
},
04:26

Moderators
30/10/2007

Hello,
Do you see in the colModel a col with a name 'Status'. You mix col names with col model. In your case this should be:
$(”#subgrid_table_id”).hideCol("x_current_state”);
to x_current_state correspond Status in colNames.
Please read carefully the docs before posting some issue - here is what should be read
..
"Hides a column with a given colname. If the colname is a string, only the specified column is hidden. If the colname is array of type ["name1","name2"] then the columns with names 'name1' and 'name2' will be hidden at the same time. The names in colname must be valid names from the colModel. The width of the grid is changed according to the following rules: if the grid currently has no horizontal scroll bar, the width of the grid is decreased by the width of the hidden column(s). If a scrollbar is visible, the width is adjusted which may or may not change the width of the grid."
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Tony,
That still doesn't work. In fact, I tried that before I posted.
Could this not be working because this is a grid as a Subgrid? I read in the documentation that there are limits on a subgrid, but it didn't think they applied to a grid as a Subgrid.
Or, should I use a different event to tigger the hiding of the column?
Jim
02:43

Moderators
30/10/2007

Hello,
This should work, but I sugest to cal this not in afterInsertRow, since this is executed every time you add row. If possible please use gridComplete event for this purpose.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
09:42

Moderators
30/10/2007

$(”#"+subgrid_table_id).hideCol(“x_current_state”);
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
36 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66