add column in dhtmlxgrid

Hello,



I want to hide and show the column using dhtmlx grid



below is my code please tell me wht i do



    



    







    



























var z = new dhtmlXCombo(“combo_zone3”, “alfa3”, 170);

        z.loadXML(“common/test.php?projid=<?php echo $projIDs;?>”);

        z.attachEvent(“onChange”,function() {

        var selected_value=z.getActualValue();

    projReturn(selected_value);

    mygrid = new dhtmlXGridObject(‘gridbox’);

    mygrid.setImagePath(“dhtmlxGrid/codebase/imgs/”);

    mygrid.clearAll(0);

    mygrid.setHeader(“Check,Add,Del,ShotID,Shotstatus,TaskID,Taskref,Task-Note,Alloted Mandays,UserID,TaskStatus,StartDate,EndDate,Task Priority,Actual Mandays,Supervisor”);

    mygrid.attachHeader("#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter, ,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter")

    //mygrid.setInitWidths(“100,*”)

    mygrid.setColSorting(" ,  ,str,str,str,str,str,str,str,str,date,date,int,int,str")

        mygrid.setColTypes(“ch,link,link,ro,ro,ed,ed,txt,ed,ed,ro,dhxCalendarA,dhxCalendarA,ed,ed,ed”);

    mygrid.enableSmartRendering(true)

    mygrid.enableMultiselect(true)

    mygrid.isColumnHidden(1)

    mygrid.init();

    mygrid.loadXML(“conn.php?projid=”+selected_value,calculateFooterValues);

    var dp = new dataProcessor(“conn.php”);

    dp.init(mygrid);

    mygrid.attachEvent(“onEditCell”, calculateFooterValues);

    mygrid.attachEvent(“onCheckbox”,doCheckBox);

    mygrid.attachEvent(“onRowSelect”,function(row_id,column_index){

//alert(column_index);

if(column_index==1)

{



var value1 = this.cells(row_id,3).getValue();

window.open(“newTask.php?shotID=”+value1,“mywindow”,“width=1300,height=290,resizable=1,scrolling=0,top=0”);

}

if(column_index==2)

{



var del_id = row_id;

delete_id(del_id);



}



if(column_index==4)

{



var shotid = this.cells(row_id,3).getValue();

var projid=selected_value;

open_task(shotid,projid);



}



if(column_index==10)

{



var value4 = this.cells(row_id,3).getValue();

var value5 = this.cells(row_id,6).getValue();

var value6 = this.cells(row_id,9).getValue();

open_status(value4,value5,value6);

}





if(column_index==5)

{



var value8 = this.cells(row_id,5).getValue();



if(value8=="")

{

    var shotid = this.cells(row_id,3).getValue();

    var taskref = this.cells(row_id,6).getValue();

    var userid = this.cells(row_id,9).getValue();

    window.open(“task.php?projID=”+projid+"&shotID="+shotid+"&taskref="+taskref+"&userID="+userid,“mywindow8”,“width=250,height=90,resizable=1,scrolling=0,top=460”);

}

else

{

    var shotid = this.cells(row_id,3).getValue();

    var taskid = this.cells(row_id,5).getValue();

    var manday = this.cells(row_id,8).getValue();

    var userid = this.cells(row_id,9).getValue();





    window.open(“split.php?projID=”+projid+"&shotID="+shotid+"&taskID="+taskid+"&manday="+manday+"&userID="+userid,“mywindow4”,“width=1100,height=290,resizable=1,scrolling=0,top=0”);

}

}



if(column_index==9)

{

mygrid.attachEvent(“onTab”, function(mode){

// alert(id);

    var value6 = this.cells(row_id,9).getValue();

    //alert(value6);

validate_user(value6)

});



}})

    

})









<?php

$res=mysql_connect(“localhost”,“root”,"");

    mysql_select_db(“kanibrainnew1”);

    

    require(“dhtmlxConnector_php/codebase/grid_connector.php”);

    

    

    

    $grid = new GridConnector($res);

    $grid->enable_log(“temp.log”,true);

    $grid->dynamic_loading(1000);

    







$grid->dynamic_loading(1000);

$grid->event->attach(“beforeRender”,“my_format”);

function my_format($data){

$value = $data->get_value(“overDue”);

         $new_value = “Add”;

$data->set_value(“overDue”,$new_value);

}





$grid->event->attach(“beforeRender”,“delete”);

function delete($data){

$value = $data->get_value(“difficulty”);

         $new_value = “Del”;

$data->set_value(“difficulty”,$new_value);

}





$grid->sql->attach(“Update”,“Update shotTaskArtist set userID=’{userID}’,taskID=’{taskID}’,TaskREF=’{TaskREF}’,task_note=’{task_note}’,manDays=’{manDays}’,startDate=’{startDate}’,endDate=’{endDate}’,task_priority=’{task_priority}’,supervisorName=’{supervisorName}’,actualMandays=’{actualMandays}’ where shotID_new=’{shotID_new}’ and shot_task_id=’{shot_task_id}’ ORDER BY shotTaskArtist.shotID_new ASC”);



    

    

    $grid->render_sql(“select * from shot,shotTaskArtist where shotTaskArtist.projID=shot.projID and shot.projID=’”.$_REQUEST[‘projid’]."’ and shotTaskArtist.shotID_new=shot.shotID order by shot.shotID asc",“shot_task_id”,“checkEfficiency,overDue,difficulty,shotID_new,shotStatus,taskID,TaskREF,task_note,manDays,userID,taskStatus,startDate,endDate,task_priority,actualMandays,supervisorName”);

    

    

    

    

    

    

    

?>





waiting for reply



regards

Seema

You can hide\show column using setColumnHidden(ind, state) method
dhtmlx.com/docs/products/dht … _menu.html