math calculations

Hello.

  1. Where can I find a complete list of possible math calculation operators? Are we stricted by keyboard symbols like +, -, /, *, ^, %?

  2. Is it possible to utilize logical calculations?

Thanks.

Additional question:

  1. Is it enough to include dhtmlx.js for math calc. functionality? If, yes - then my app does not work. Also I have tried to add dhtmlxgrid_math.js, after that console wrote:

Uncaught RangeError: Maximum call stack size exceeded

Included files:

My Application
 <script src='dhtmlx/scheduler/codebase/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
<script src='dhtmlx/scheduler/codebase/ext/dhtmlxscheduler_timeline.js' type="text/javascript" charset="utf-8"></script>
<script src='dhtmlx/scheduler/codebase/ext/dhtmlxscheduler_treetimeline.js' type="text/javascript" charset="utf-8"></script>
 <script src="dhtmlx/scheduler/codebase/ext/dhtmlxscheduler_collision.js"></script>
 <script src="dhtmlx/scheduler/codebase/ext/dhtmlxscheduler_tooltip.js"></script>

<link rel='stylesheet' type='text/css' href='dhtmlx/scheduler/codebase/dhtmlxscheduler.css'>

<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlx.css">
<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<script src="codebase/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<script src="codebase/dhtmlxConnector/codebase/connector.js"></script>
<script src="codebase/pages/desired.js" type="text/javascript"></script>
<script src="dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_math.js"></script>

js:

grid1 = tabMatObjStr.attachGrid();
grid1.setImagePath(“dhtmlx/dhtmlxGrid/codebase/imgs/”);
if (eType!=3) { grid1.setHeader(“№,Наименование,str_id”); grid1.setInitWidths(“45,,”); grid1.setColTypes(“ro,tree,ro”); }
if (eType==3) {
grid1.setHeader(“№,Наименование,str_id,Значение”);
grid1.setInitWidths(“45,,,*”);
grid1.setColTypes(“ro,tree,ro,ed”);
grid1.enableMathEditing(true);
grid1.setColSorting(“int,str,int,int”);
grid1.setMathRound(2)

     }
     grid1.setSkin("dhx_skyblue");
     grid1.enableDragAndDrop(true);
     grid1.enableMercyDrag(true);
     grid1.init();

	 grid1.setColumnHidden(2,true);

     grid1.loadXML("grid" + eType + ".php?str_id=" + eId, function(){
    		 grid1.selectRow(0);
    		 win.setText(eName + ": " + grid1.cellByIndex(0, 1).getValue());
    		 
             if (eType!=3) { loadObjProp(eType, eId); }
     
 });
     var dp_grid1 = new dataProcessor("grid" + eType + ".php?str_id=" + eId); 
     dp_grid1.init(grid1);  
     var loadedTreeId = tree1.getSelectedItemId();

Do not answer 3rd question, I have decided problem, horizontal calculation (c1+c2) works.

But I cannot make vertical calc (please see attachment).


up of unreplied

I apologize for the delay.

math extension supports all basic javaScript math operations: +,-,*,/,%.

For the correct working of your formula in the cell you nned to tell the grid that the column contains math. Please, try to use the following code:
grid1.setHeader(“№,Наименование,str_id,Значение[=]”);

Do you mean this :slight_smile:

grid1.setColTypes(“ro,tree,ro,ed[=]”);

it’s ok

I have another question:

Is it possible:

  1. to store the formalas in database (not resulting values)
  2. show and edit formula when editing cell
  3. show resulting value if user not editing

Do you mean this :slight_smile:
grid1.setColTypes(“ro,tree,ro,ed[=]”);
it’s ok

ahh… silly… :blush: Of course, you’re right. It’s my fault.

  1. to store the formalas in database (not resulting values)
    Unfortunately such feature is not supported. I may suggest you to block the updating operation for the math column on your server-side.

  2. show and edit formula when editing cell

  3. show resulting value if user not editing
    Please, try to use:
    grid.enableMathEditing(true);