views:

15

answers:

1

I'm currently using the flexigrid.js plugin and there is a button that I wish to enable/disable depending on whether a certain cell in the currently selected row is equal to a certain value.

Here is where I am currently at: I thought to add the following to the list of callback functions but am stuck as to what to put in the if statement if that is even a valid check.

'onRowClick': function(row,grid){
                        var content = $(row).attr('content');
                        if ($content == 'target'){

                        }

This callback function does not register though, the 'onDblClick':function... does work however.

A: 

I received an answer from Marc Borgers from the Flexigrid for jQuery google group copied it here for reference

In the colModel parameter of flexigrid, you can pass a callback function with name process. In that function you can hook on a function that is called when a row is clicked. I know it sounds difficult. An example will make more clear. Here it is:

function procMe(celDiv,id) { 
        $(celDiv).click( 
                function () {alert(this.innerHTML + " " + id); } 
        ); 
}; 

function postFlexigrid() 
{ 
        $("#flex1").flexigrid 
                        ( 
                        { 
                        url: 'yourURL', 
                        dataType: 'json', 
                        colModel : [ 
                                {display: 'Name', name : 'xxx', width : 200, sortable : false, 
align: 'left', process: procMe} 
                                ], 
                        usepager: false, 
                        singleSelect: true, 
                        title: 'x', 
                        useRp: false, 
                        showTableToggleBtn: true, 
                        height: 150 
                        } 
                        ); 
} 

$(document).ready(function() { 
        postFlexigrid(); 
}); 

procMe will be called and if you click on a row, an alert is shown. Hope this helps.
Regards, Marc

Soldier.moth