Button Column

Hello,

can somebody point me to a tutorial on how to create a special button column?

I would like to add a column to the grid with custom options like ‘edit’, ‘delete’, etc.

Tried this, but doesn’t seem to work, I still get an empty column:

eXcell_button.prototype = new eXcell;
	function eXcell_button(cell) {
		var val="hitme";
		if (cell) {
			this.cell = cell;
			this.grid = this.cell.parentNode.grid;
		}
		this.edit = function() {};
		this.isDisabled = function() {return true;};
		this.setValue = function(val) {
			this.setCValue("<input type='button' value='"+val+"'>",val);
		}
	}

	mygrid.insertColumn(4,'action',"button",63);

Thanks!

Hello, ppplease help?

what method should I use?

Should I fill the cells with HTML (like … <input type=“button”… etc.>) in the Dataprocessor??
I would prefer to fill the cells with the button’s code inside the page. So far I don’t know how to do it either way. So far I just get a empty column displayed, thanks to

myGrid.insertColumn(2,'action','ed',63);

here is my page source:

[code]<?php
require_once $_SERVER[“DOCUMENT_ROOT”]."/include/globals.php";
?>

<?php echo _translate("partner"); ?>

[/code]

my grid connector source:

[code]<?php

require_once $_SERVER["DOCUMENT_ROOT"]."/include/globals.php";

require $_SERVER["DOCUMENT_ROOT"]."/lib/php/dhtmlxConnector/grid_connector.php";
require $_SERVER["DOCUMENT_ROOT"]."/lib/php/dhtmlxConnector/db_mysqli.php";

$myGC = new GridConnector($db,"MySQLi");
$myGC->render_table("partner","PAR_ID","PAR_company,PAR_city");
$myGC->event->attach("beforeProcessing","check_data");

function check_data($action){
	$action->invalid();
}

?>[/code]

got one solution for this, but this can’t be the way it’s meant to be… that’s just far to ugly :laughing: , there has to be a proper way to do it on on the client side… please help!

$myGC = new GridConnector($db,"MySQLi"); $myGC->render_sql("SELECT PAR_company,PAR_city, CONCAT('<input type=\"button\" value=\"edit\" onClick=\"alert(', PAR_ID, ')\"/>') as action FROM partner", "PAR_ID","PAR_company,PAR_city,action");

GOT IT! eXcell_button.prototype works perfectly and for this.

Sorry, I must have made some stupid case typo mistake (something like myGrid instead of mygrid)…

Somebody know how to accesss rowId - either inside the function eXcell_button(cell) {…} or the corresponding event handler?

cheers!

Please, try to use:

var row_id=this.cell.parentNode.idd;