Column type "img"

Hi,
Sorry , but after review of forum and doc I can’t understand how to show an image in column cells. I want to do like in this sample : dhtmlx.com/docs/products/dht … extra.html ( “Image” column ) . But also I want to use filter for column ( #connector_select_filter ) . I’m using dinamic grid from database . At this time in php I did showing “Yes/No” - $grid->set_options( “aud_nuras”, array( 0 => “No”, 1 => “Yes” ) );

Please , help in this istuation …

Hi,
Nobody can help ? Please, let me know how to add images ( like in the sample dhtmlx.com/docs/products/dht … extra.html “Image” column ) with dinamic grid . I wanna to show red/green pictures like in sample for false/true values in grid . How can this be done - from php or javascript source ?

With best regards !

Unfortunately you will have to create your own custom exCell type.
Here you can find a tutorial:
docs.dhtmlx.com/doku.php?id=dhtm … l_creation

Sematik,

Thanks for direction . From this documentation I did for mine column type “eXcell_roImg” . Then did that :

function eXcell_roImg( cell )
      {  
         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='image' src='codebase/imgs/" + ( val == 1 ? "green" : "red" ) + ".gif' WIDTH='10' HEIGHT='10'>", val );
         }
      }
      eXcell_roImg.prototype = new eXcell;

But entering into page it return : Error type: Configuration Description: Incorrect cell type: eXcell_roImg . And image in grid , of course, didn’t appears … What that is wrong ?

Please, try to break the following code

  this.isDisabled = function(){ return true; }         this.setValue=function( val )

in two lines

this.isDisabled = function(){ return true; } this.setValue=function( val )

Sorry for posting in wrong . Exastly this lines are in two lines . Simply pasted and removed “// coment” and didn’t noticed , that they stands in one line here . So what can be wrong with that new excelll type ? Maybe it’s informatant place where to describe ? I tried that before grid and after grid .

 var mygrid = mainTab.cells( mainTab.getActiveTab() ).attachGrid();
      mygrid.setImagePath( "codebase/imgs/" );

      mygrid.setColumnIds( slc_fld )
      mygrid.setHeader( grd_hdr );
      mygrid.attachHeader( grd_hfr_filter );
      mygrid.setColTypes( grd_coltypes );
      mygrid.setColSorting( grd_sortTypes );
      mygrid.setInitWidths( grd_widths )
      mygrid.setColAlign( grd_colAlgn )
      mygrid.setColumnsVisibility( grd_colVisib );
      mygrid.setDateFormat( "%Y-%m-%d" );
      mygrid.enableDistributedParsing( true );
      mygrid.enableSmartRendering( true, 250 );
      mygrid.init();
      mygrid.load( cQry );

      myDp = new dataProcessor( cQry );
      myDp.live_updates( "http://127.0.0.1:8008/sync" );
      myDp.enableDataNames( true );
      myDp.setVerificator( mygrid.getColIndexById( "uzsak"         ), iras_val );
      myDp.setVerificator( mygrid.getColIndexById( "preke"         ), dhtmlxValidation.isNotEmpty );
      myDp.setVerificator( mygrid.getColIndexById( "uzs_kiekis"    ), Daug0 );
      myDp.setVerificator( mygrid.getColIndexById( "prilyg_kiekis" ), Daug0 );
      myDp.setVerificator( mygrid.getColIndexById( "kerpa"         ), dhtmlxValidation.isNotEmpty );
      myDp.init( mygrid );

      mygrid.enableMultiselect( true );
      mygrid.enableHeaderMenu();
      mygrid.enableColumnMove( true );
      mygrid.enableUndoRedo();
      mygrid.setAwaitedRowHeight( 22 );
      mygrid.setNumberFormat( "000000", mygrid.getColIndexById( "uzs_kiekis" ) );
      mygrid.setNumberFormat( "000000", mygrid.getColIndexById( "prilyg_kiekis" ) );

Found the reason of error … :slight_smile: Simply I writed full “eXcell_roImg” , it needs only “roImg” . Now it’s working fine ! Thanks for you again !

With best regards !

It leaves only one question . In previuos with that “roImg” type I was using “coro” and in php used $grid->set_options( “aud_nuras”, array( 0 => “No”, 1 => “Yes” ) ); How to do that this column header filter get combobox with “Yes/No” ? Now I’m seeing “1/0” … Return value “Yes/No” ?

With best regards !

Unfortunately the default filters work with cell’s value only.
You will have to create your custom filter or redefine the logic of the default one.
Here is the tutorial:
docs.dhtmlx.com/doku.php?id=dhtm … of_filters

Thanks for your answer , sematik !

Not sure that we are talking about the sames thing … I want to do , that in column header will appears filter values “Yes/No” instead “1/0” . Now the documentation is talking about custom logic for filtering . Something can’t understand ? I’m seeing that the second step for that will be very valuable - convert “Yes/No” value to “1/0” and then to use custom logic . But how to show “Yes/No” in filter combobox ? Please help …

The other way is to populate the custom options in your select using the onCollectValues event:
docs.dhtmlx.com/doku.php?id=dhtm … lectvalues

Filtering process also should be customized using the onFilterStart event:
docs.dhtmlx.com/doku.php?id=dhtm … ilterstart