You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/functions.md
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1311,9 +1311,17 @@ Check the example in our [snippet tool](https://snippet.dhtmlx.com/wux2b35b).
1311
1311
1312
1312
## Getting cell formula
1313
1313
1314
-
Starting with v4.1, you can get the formula applied to a cell via the [getFormula()](api/spreadsheet_getformula_method.md) method. The method takes the id of the cell as a parameter:
1314
+
Starting with v4.1, you can get the formula applied to a cell via the [`getFormula()`](api/spreadsheet_getformula_method.md) method. The method takes the id of the cell as a parameter:
1315
1315
1316
-
```js
1316
+
~~~js
1317
1317
var formula =spreadsheet.getFormula("B2");
1318
1318
// -> "ABS(C2)"
1319
-
```
1319
+
~~~
1320
+
1321
+
## Popup with formula description
1322
+
1323
+
When you enter a formula, a popup with description of the function and its parameters appears.
1324
+
1325
+

1326
+
1327
+
You can modify the default locale for the popup with formula parameters and add a custom locale. Check the details in the [Localization](localization.md/#default-locale-for-formulas) guide.
The i18n locale for the Spreadsheet popup with formulas is contained in the `dhx.i18n.formulas` object. The default locale for formulas is the following:
203
+
204
+
~~~jsx
205
+
consten= {
206
+
SUM: [
207
+
[
208
+
"Number1",
209
+
"Required. The first value to sum."
210
+
],
211
+
[
212
+
"Number2",
213
+
"Optional. The second value to sum."
214
+
],
215
+
[
216
+
"Number3",
217
+
"Optional. The third value to sum."
218
+
]
219
+
],
220
+
AVERAGE: [
221
+
[
222
+
"Number1",
223
+
"Required. A number or cell reference that refers to numeric values."
224
+
],
225
+
[
226
+
"Number2",
227
+
"Optional. A number or cell reference that refers to numeric values."
228
+
]
229
+
],
230
+
// more formulas' descriptions
231
+
};
232
+
~~~
233
+
234
+
You can check the full default locale for formulas in the [HTML tab of the related snippet](https://snippet.dhtmlx.com/yn5hyyim).
235
+
236
+
## Custom locale for formulas
237
+
238
+
To apply a custom locale for Spreadsheet formulas, you need to use the `dhx.i18n.setLocale()` method in the following way:
239
+
240
+
~~~jsx
241
+
dhx.i18n.setLocale(
242
+
"formulas",
243
+
locale: {
244
+
// the structure of the formulas in the locale
245
+
name: [param: string, description: string][]
246
+
}
247
+
):void;
248
+
~~~
249
+
250
+
You should pass the following parameters to the method:
251
+
252
+
<table>
253
+
<tbody>
254
+
<tr>
255
+
<td><b>Parameter</b></td>
256
+
<td align="center"><b>Description</b></td>
257
+
</tr>
258
+
<tr>
259
+
<td>"formulas"</td>
260
+
<td>(*required*) the name of the locale for formulas</td>
261
+
</tr>
262
+
<tr>
263
+
<td>locale</td>
264
+
<td>(*required*) the locale object that contains formulas' descriptions as <i>key:value</i> pairs, where:<ul><li>the <b>key</b> is the name of the function</li><li>the <b>value</b> is an array of parameters the function takes. Each parameter of the function is an array of two elements, where:<ul><li>the first element is the name of the parameter</li><li>the second element is the description of the parameter</li></ul></li></ul></td>
265
+
</tr>
266
+
</tbody>
267
+
</table>
268
+
269
+
Check the example below:
270
+
271
+
~~~jsx
272
+
constde= {
273
+
AVERAGE: [
274
+
["Zahl1", "Erforderlich. Eine Zahl oder Zellreferenz, die sich auf numerische Werte bezieht."],
275
+
["Zahl2", "Optional. Eine Zahl oder Zellreferenz, die auf numerische Werte verweist."]
276
+
],
277
+
// other formulas' descriptions
278
+
};
279
+
280
+
dhx.i18n.setLocale("formulas", de);
281
+
~~~
282
+
283
+
## Example
284
+
285
+
In this snippet you can see how to switch between locales:
0 commit comments