How to call this function?

hi, im new to javascript and i’m applying this new datagrid. I have here a javascript/jquery function:

function viewHeader(celDiv,id)
{
$(celDiv).addClass(“pointer”);
$(celDiv).click(function(){
$(‘.toolbar a[title=Header]’).trigger(‘click’);
viewdb(id);
});
}

how can i call this function?
i tried this:
ondblClickRow: function(id){
alert (id);
viewHeader(id);
}, // i was prompted by the right id but i cant still used the viewHeader function?

any response would be a great help to me

thanks

How is the function supposed to know what celDiv means?

When you do viewHeader(id) - this is what the viewHeader function gets:

celDiv = id (that was passed in)
id = undefined (you didn’t pass in a value for this parameter)

You need to pass the function meaningful values for it to work as intended.

The viewHeader function accepts two arguments, both of which must be supplied to work.

What is celDiv supposed to be?

thanks for the reply pmw57

btw - celDiv is the row. When a row been clicked the details/info of that row will be displayed. Also what’s the differences with these two: viewHeader; or viewHeader(id);.

Do you know about the jquery jqgrid? This is what im doing but got stuck to this :frowning:

thanks

im using jquery jqgrid and i tried to modify it to this:

function viewHeader(cellvalue,id)
{
	$(cellvalue).addClass("pointer");
	$(cellvalue).click(function(){
		$('.toolbar a[title=Header]').trigger('click');				
		viewdb(id);		
	});
} 

how do i pass this? and how can i call this?

Hi,

Can you post a complete example, with a table, jquery plugin and your script in a sample page?

Have you kept your script separate to the jQuery plugin?