Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Help with hidecol() method
17/02/2009
10:13
Avatar
Jim P
Member
Members
Forum Posts: 102
Member Since:
29/01/2009
sp_UserOfflineSmall Offline

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

17/02/2009
10:36
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

17/02/2009
15:29
Avatar
Jim P
Member
Members
Forum Posts: 102
Member Since:
29/01/2009
sp_UserOfflineSmall Offline

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"
           })
       },

18/02/2009
04:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

18/02/2009
08:04
Avatar
Jim P
Member
Members
Forum Posts: 102
Member Since:
29/01/2009
sp_UserOfflineSmall Offline

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

20/02/2009
02:43
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

20/02/2009
09:16
Avatar
Jim P
Member
Members
Forum Posts: 102
Member Since:
29/01/2009
sp_UserOfflineSmall Offline

Tony,

There is a field in the sub grid row that determines what column to hide.  If I use loadComplete,  how would I know the value of that field in the sub grid row?

20/02/2009
09:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

$(”#"+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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information