2 columns SPH1 and SPH2 I need to know which cell is selected

Questions2 columns SPH1 and SPH2 I need to know which cell is selected
Cristian Engelmann asked 2 years ago

I know to use

var sph1 = jQuery(‘#list1’).jqGrid(‘getCell’, id,’Sph1′);
jQuery(“#span_extra”).html(sph1);
var sph2 = jQuery(‘#list1’).jqGrid(‘getCell’, id,’Sph2′);
jQuery(“#span_extra”).html(sph2);

But I need to know where press user click on cell.

SPH1 or SPH2.

Thank you

4 Answers
Abu Ghufran Staff answered 2 years ago

If you are using celledit mode (excel view), then you can use event like:

$opt[“onCellSelect”] = “function(row,col,html,e) { }”;

$g->set_options($opt);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Cristian Engelmann answered 2 years ago

Thank you Abu.

But I don’t know how to connect ‘col’ variable.

$opt[“onCellSelect”] = “function(row,col,html,e){alert(col);}”;

….

function do_onselect(id)
{
if(col == 1)
var sph = jQuery(‘#list1’).jqGrid(‘getCell’, id,’Sph1′); // where invdate is column name
if(col == 2)
var sph = jQuery(‘#list1’).jqGrid(‘getCell’, id,’Sph2′); // where invdate is column name
jQuery(‘#span_extra’).html(sph);

llenaceldalentes(sph);
}

Thank you again!

Abu Ghufran Staff answered 2 years ago

It should be like:

$opt[“onCellSelect”] = “function(row,col,html,e){do_onselect(row,col,html,e);}”;

….

function do_onselect(row,col,html,e)

{

}

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Cristian Engelmann answered 2 years ago

Does work!

Thank you a lot of

Your Answer

3 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?