Hi,
I am trying to use the cell value from other columns in the same row when I format one particular column in the grid. I could not get it to work. I have posted the relevant part of the code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
//set column models: $model = array( array("name"=>"uid","width"=>40, "editable"=>false), array("name"=>"chr","width"=>40, "editable"=>false), array("name"=>"pos","width"=>80, "editable"=>false, "formatter"=>"js:igv_link"), array("name"=>"cosmicID","width"=>80, "editable"=>false, "formatter"=>"js:cosmic_link", "unformat"=>"js:unformat_cosmic"), array("name"=>"cosmicLookup","width"=>30, "editable"=>false), array("name"=>"ref","width"=>30, "editable"=>false), array("name"=>"alt","width"=>30, "editable"=>false), array("name"=>"genotype","width"=>60, "editable"=>false), array("name"=>"depth","width"=>30, "editable"=>false), array("name"=>"altCount","width"=>30, "editable"=>false), array("name"=>"frequency","width"=>60, "editable"=>false), array("name"=>"report_no", "width"=>30, "editable"=>false), array("name"=>"barcode","width"=>30, "editable"=>false), array("name"=>"cDNA","width"=>60, "editable"=>false), array("name"=>"protein","width"=>100, "editable"=>false), array("name"=>"coding","width"=>100, "editable"=>false), array("name"=>"gene","width"=>60, "editable"=>false), array("name"=>"dbsnp","width"=>60, "editable"=>false, "formatter"=>"js:dbSNP_link", "unformat"=>"js:unformat_dbSNP"), array("name"=>"dbSNP_property","width"=>60, "editable"=>false), array("name"=>"lastName","width"=>30, "editable"=>false), array("name"=>"firstName","width"=>30, "editable"=>false), array("name"=>"occurance_count","width"=>30, "editable"=>false), array("name"=>"pathology_no","width"=>30, "editable"=>false), array("name"=>"order_no","width"=>30, "editable"=>false)); $grid->setColModel($model); //custom formatter $custom = <<<CUSTOM //This function works which only needs value for the column being formatted function cosmic_link(cellValue) { return "<a href='http://cancer.sanger.ac.uk/cosmic/search?q="+cellValue+"'>"+cellValue+"</a>"; } function unformat_cosmic(cellValue, options, cell) { return $(cell).text(); } //This function does not work //the report_no variable shows up to be "undefined" function igv_link(cellValue,rowData) { var report_no = rowData.report_no; var url = "http://www.broadinstitute.org/igv/projects/current/igv.php?sessionURL="+report_no+"&locus=locu"; return "<a href="+url+">"+cellValue+"</a>"; } CUSTOM; $grid->setJSCode($custom); |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top