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
passing cell content as parameters
18/02/2009
08:33
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

I'm building a grid as a subgrid and trying to pass the contents of the first column to the program as a parameter.  From the examples, I've seen how to pass the row number, but I need to retrieve the first cell contents.  Is there currently a way to do this?

19/02/2009
09:34
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

You can use the beforeSubmit event to do that. For example:

 beforeSubmit: function() {
                 var sr = jQuery("#list").getGridParam('selrow');
                 var rowData = jQuery("#list").getRowData(sr);
           
                  this.editData = {"NU_RIF_EMPRESA" : rowData['NU_RIF_EMPRESA']};
                  retarr = {"NU_RIF_EMPRESA" : rowData['NU_RIF_EMPRESA']};
                  return retarr;
  }

Here I take the field NU:RIF_Empresa and add it to my QueryString data..

HTH

19/02/2009
14:47
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

I'm not sure that I understand.  Where in my code would I put the beforeSubmit function?  within the subGridRowExpanded function?

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

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

Hello,

I think there must be better explanation of your problem

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:08
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

I have a JQGrid that produces a table with eight columns (not including the one reserved for the plus/minus signs).  When I click the plus sign, I would like to pass the contents of the selected row's first column as a parameter to the server-side program. 

For instance, if the first column is "Customer Number," and I click the plus sign on the row that has a customer number of "0001," then, I would like for the program call to appear something like "svrpgm?custNum=0001".

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

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

Hello,

Since you use the subGridRowExpanded as of documentation:

This event is raised when the subgrid is enabled and is executed when the user clicks on the plus icon of the grid. Can be used to put custom data in the subgrid.

  • pID is the unique id of the div element where we can put contents when subgrid is enabled,
  • id is the id of the row

If you have the id then you can $("#mygrid").getRowData( id ) - this retun all the values from the current clicked row and before constructing the grid you can pass what you want from this array

Regards

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
10:07
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

Okay.  I got the JQGrid to assign an id to the row that's equivalent to the data in fhe first column of each row.  I have the returned JSON string in the correct format.  However, I'm unsure as to what kind of variables I need to pass in the beginning.  For instance, right now, I have

{"rows":[{"divisionNumber":..........}]}

Do I need to specify more things than just "rows"?  Because although the JSON string is correct, the subgrid is not being populated.

24/02/2009
07:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Why do not see the examples in the docs? They speak quite.

One possible solution (from demo site):

{"rows":[{"id":"1","cell":["1","item 1","2.00","100.00","200.00"]},{"id":"2","cell":["2","item 2","3
.00","50.00","150.00"]},{"id":"3","cell":["3","item 3","1.00","50.00","50.00"]},{"id":"4","cell":["4"
,"item 4","1.00","200.00","200.00"]}]}

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.

24/02/2009
09:02
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

Hi.  I'm not sure that you understood my question.  I have tried the exact format of the string you suggested from the demo site.  However, it still doesn't work when applying it to the subgrid.  So, it appears to me as though either I need to include more parameters like “rows” or something is wrong with my JQuery code which is as follows:

subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id)
{
  var subgrid_table_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:”inv0003?id=”+row_id,
    datatype: “json”,
    //mtype: GET,
    colNames: ['Division<br />Number','Name','On Hand<br />Weight','% of<br />Total','Per Lb<br />Cost','Avg Monthly<br />Sales','Months<br />Supply','Turnover<br />Rate'],
    colModel:
    [
      {name:"divisionNumber",index:"divNum",width:80,key:true},
      {name:"divisionName",index:"divName",width:130},
      {name:"onHandWeight",index:"ohWeight",width:80,align:"right"},
   {name:"percentOfTotal",index:"pctOfTotal",width:80,align:"right"},          
 {name:"perLbCost",index:"perLbCost",width:100,align:"right",sortable:false},
 {name:"avgMonthlyWeight",index:"avgMonthlySales",width:80,align:"right",sortable:true},
 {name:"monthsSupply",index:"monthsSupply",width:80,align:"right",sortable:true},
 {name:"turnoverRate",index:"turnRate",width:80,align:"center",sortable:true},
      ],
      height: 100,
      rowNum:20,
      imgpath: “../javascript/JQGrid/themes/green/images”,
      sortname: 'divisionNumber',
      sortorder: “asc”
    });
  },

24/02/2009
09:17
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

In your case grid as subgrid - the subgrid is simple grid - so the json format should be the same as those of the main grid.

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.

03/03/2009
07:53
Avatar
violinssoundcool
Member
Members
Forum Posts: 35
Member Since:
05/02/2009
sp_UserOfflineSmall Offline

So, you're saying that the returned JSON string for the grid as a subgrid needs to include rows, page, total, records, etc.?  Because it looks like in the docs that I only need to include "rows." 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
43 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