Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by haritha on Sep 21, 2008 23:25
open dhtmlx forum
Radio Buttons

Hi,


I want to display two radio buttons in single column along with some values beside them for example: for gender column i want to get 2 radio buttons with male and female. On selecting the radio buttons i need to get the selected value male or female...

can you please help me..

thanks in advance
haritha


Answer posted on Sep 22, 2008 02:45

You can create your own eXcell for this. MOre details can be found here: http://www.dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_excell_creation.html#grid_cexc

Or you can use slightly modified acheck type instead (see example here: http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/cell_types/pro_excell_extra.html?un=1222076141000). It has two states represented by two different images and text labels. Changing text (for example) from "Yes" to "Male" and "No" to "Femail" in the code you can get what you need. acheck type is defined in /codebase/excells/dhtmlxgrid_excell_acheck.js file.

Or, you can use existing radibuttons type (ra) in two columns. These two columns can be joint under one header if you use colspan (#cspan) in grid header.

Answer posted by haritha on Sep 22, 2008 03:02
Hi,

Thanks for you support.
I am displaying check boxes in a column. By default they are getting checked and check box is also not getting displayed. So i wrote the following function:

function doAfterInit()
    {
        myGrid.setImagePath("codebase/imgs/");
         myGrid.forEachRow(function(id){
       
           if (myGrid.cells(id,0).getValue()==1)
        {
            myGrid.cells(id,0).setValue(0);
        }
    });
  }

Is there any API method to make the checkboxes unchecked by default.

Thanks
haritha

Answer posted on Sep 23, 2008 00:57
When you create row in grid you can set value for checkbox - 1 - checked, 0 - not checked.  This should work irregardless to the way you create row - script, xml or any other.