Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nikita on Oct 15, 2008 11:22
open dhtmlx forum
Yes, I am using grid v.2.0 build 81009Your example sent, does not have drag and drop functionality activated.  ...

Yes, I am using grid v.2.0 build 81009

Your example sent, does not have drag and drop functionality activated.     
(file : 1224062593.zip) .

I am not sure what is going on, but as per your suggestion, mygrid.enableDragAndDrop(true) does not actiavete drag and drop.
Since enableColumnMove(true) does activate Drag and Drop, I am using mygrid.enableColumnMove(true); which is a dhtmlxGrid/codebase/ext/dhtmlxgrid_mcol.js file instead of  mygrid.enableDragAndDrop(true) dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js as you suggest..  But enableColumnMove(true) breaks formatting and sorting functionality.

I am using IE7 on XP machine.


I am using a single grid. dnd math cell in a single grid, different spots.

Here is the init function. Total - last column is calculated. But it looses functionality after DnD.


function init() {
    var r=sendXMLHTTP("POST","mydata.aspx?t="+(new Date()).getTime(),false,setup); if(r==null) return;
    if(r.indexOf("var w=window;")!=0) {ordergrid.innerHTML=r; alert(ordergrid.innerText); return;}
    eval(r);
    ordergrid.innerHTML=""; grid1 = new dhtmlXGridObject("ordergrid");
    grid1.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/");
    grid1.setHeader("TIM #,Description,Start Date,End Date,AE,Client,Client ID,Agency,Agency ID,Order #,Spots,Gross $,Traffic Order #,Contract Type,Status,Est. EDI Code,AA Status,TIM#,Total");
    grid1.setInitWidths("40,150,75,100,100,100,75,100,75,100,50,75,100,100,150,100,50,100,99");
    grid1.setColAlign("right,left,center,center,left,left,left,left,left,right,right,right,left,left,left,left,center,center,right");

    grid1.setColTypes("ro,ro,dhxCalendar,dhxCalendarA,ro,ro,ro,ro,ro,ro,edn,ron,ro,ro,ro,ro,ro,ro,edn[=c10*c11]");
    grid1.setColSorting("int,str,date,date,str,str,str,str,str,str,int,int,str,str,str,str,sortAAstatus,int");
    grid1.minWidths="40,150,60,60,0,0,0,0,0,0,0,0,0,0,0,0,50,0".split(","); grid1.setColumnMinWidth(grid1.minWidths.join(","));
    grid1.enableColumnMove(true);
    grid1.setNumberFormat("0,000",10);
    grid1.setNumberFormat("$0,000.00",11);
    grid1.setNumberFormat("$0,000.00",18);
    grid1.setDateFormat("%d.%m.%Y",2);
   
    grid1.enableMultiselect(true);
    grid1.attachEvent("onSelectStateChanged",showschedule);
    grid1.attachEvent("onAfterCMove",colmoved);

    grid1.init();
    //grid1.splitAt(2);
    grid1.enableSmartRendering(true);
    grid1.setAwaitedRowHeight(17);
    grid1.setEditable(true);
    grid1.parse(orders,"json");
}


my includes:

<script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
     
   
    <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_mcol.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_splt.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_math.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_sub_row.js"></script>
    <script src="dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js"></script>
    <!--script src="dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_calendar.js"></script-->
    <script src="dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
  

thank you very much for your time.

Nikita
Answer posted by Support on Oct 16, 2008 07:12
Sorry for inconvenience, incorrect sample was sent by email. 

>>enableColumnMove(true) 
This functionality enables column draging, not row draging ( enableDragAndDrop allows moving of rows )
There was an issue with column moving in dhtmlxgrid 1.6 , it really can lost column formatting and custom sorting functionality after changing column position, but this problem fixed in dhtmlxgrid 2.0

The problem with "edn[=c10*c11]" math in case of movable column - is a known issue. The math based on column indexes will not work correctly if columns will be moved. 
You can use 
      grid.setColumnIds("first","second",...
and later in math formulas 
    =[r1,:first]*[r1,:second]
column IDs not related to column order so such math will work in case of movable columns. (it is require a row ID as part of formula , so can't be set for whole column and need to be specified for each cell in necessary column ) 

>>Here is the init function. Total - last column is calculated. But it looses functionality after DnD.
Except of math functionality - other aspects correctly preserved. 

Answer posted by Nikita on Oct 16, 2008 07:41
Is it possible to have column Ids be passed with JSON structure from the server? Or does it only work with setColumnIds function on client side?
Answer posted by Support on Oct 16, 2008 09:30
The columns need to be defined as part of grid configuration. It can be done by grid.setColumnIds command, or in case of init from XML, by column@id attribute.
Current version doesn't support structure configuration from JSON, so there is no way to set column Ids from json