Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nikita on Oct 14, 2008 12:43
open dhtmlx forum
Math cells, drag and drop, format, sort.


I have created a simple math column: edn[= c10*c11]
with format of ("$0,000.00");

Calculation and formatting appear correctly on the load and manipulation of columns 10 and 11.
When I drag a math column, and although the value is correct, formatting does not stick with the column once the change is done to column 10 or column 11.
There is also a problem with sorting. When the math column is attempted to be sorted after it was dragged, the java error occurs. Sorting should not be allowed.

Any thought on these issues?

Thank you very much.


Answer posted by Support on Oct 15, 2008 02:07
>>When I drag a math column, and although the value is correct, formatting does not stick with the column once the change is done
Are you using d-n-d in same grid or between grids?
In case of d-n-d between grids, the column formating settings will be taken from the target grid, and if they differ from source grid - formatting may be different. 

Also, which version of grid you are using? The problem can't be reconstructed with dhtmlxgrid 2.0 ( sample sent by email )
If you are using dhtmlxgrid 1.6 - please try to update dhtmlxgrid_math.js extension to latest version. ( sent by email as well ) 
Answer posted by Nikita on Oct 15, 2008 09:20
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:19