Combo inside toolbar

Hi to everybody.

A little problem.

I build a toolbar like to the link image:
image

using this code:

abToolbar = layout2.cells(“b”).attachToolbar();

abToolbar.setIconsPath(“icons/”);
abToolbar.loadStruct(“data/abToolbar.xml”, function() {
abToolbar.setIconSize(32);
abToolbar.addText(“combo”, 4, “”);
var comboDIV = abToolbar.objPull[abToolbar.idPrefix+“combo”].obj;
abToolbar.objPull[abToolbar.idPrefix+“combo”].obj.innerHTML = “”;
var combo = new dhtmlXCombo(comboDIV,“alfa”,200);
combo.addOption([[1,“A”],[2,“B”],[3,“C”]]);
});

I’m not able to justiy the vertical alignment of Combo , centered on the toolbar like the images, or add a padding.
i tried to modify some toolbar and combo classes of dhtmlx.css (material) without success .

Can somebody help me ?

Many thanks

Adding something like:

<style>
  .dhx_toolbar_material div.dhx_toolbar_text{
  	padding: 10px
  }
</style>

worked well for me:
http://snippet.dhtmlx.com/5/7d39fb4b9

Thanks. I didn’t think it was a text. so i tried other classes.

Hi Sematik. Another question. I read in some old posts that is possibile build a multiline toolbar, attaching more different toolbar instances to the same layout. I tried and the function .attach seems to run without problem (no errors in console) but when i try the loadstruct this is the answer.

Uncaught TypeError: Cannot read properties of undefined (reading ‘loadStruct’).

Is really possibile to attach more than one toolbar ?

You may place only a single toolbar to a layout cell, but you can use as many layout cells as you need.
So you may include the additional layout cells for your toolbars.
Something like:
http://snippet.dhtmlx.com/5/9fda3c6ec

Thanks. i didn’t think it yet. It’ s easy

Hi Sematik.

Another strange behaviour that i want to show to you.

I’ve a side bar whit some options in it that it’s defined configuring the Sidebar.
at the beginning of application i hide (Sidebar(“item”).hide()) every sigle option. i read a configuration file with the profile of the user and i wanna show only the enabled option for the user using (Sidebar(“item”).show()).
Well the hide functions it’s ok but there is no way to run correctly the show function. It seems ignore it.

Are there problems with this function ?

Thank you

Hi to everybody,

A question about tree.load

i fill an array and then i try this function.

tgrid.load(treeArray,doAfterRefresh,“JSArray”)

the app give an error:
Uncaught TypeError: a.match is not a function
_dhxr http://localhost/sgb/codebase/dhtmlx.js?dev=:9
_call http://localhost/sgb/codebase/dhtmlx.js?dev=:9
get http://localhost/sgb/codebase/dhtmlx.js?dev=:9
load http://localhost/sgb/codebase/dhtmlx.js?dev=:9
onclick http://localhost/sgb/codebase/filters.js?dev=:210
_in_header_select_filter http://localhost/sgb/codebase/filters.js?dev=:63
_createHRow http://localhost/sgb/codebase/dhtmlx.js?dev=:9
attachHeader http://localhost/sgb/codebase/dhtmlx.js?dev=:9
attachHeader http://localhost/sgb/codebase/dhtmlx.js?dev=:9
init http://localhost/sgb/codebase/dhtmlx.js?dev=:9
http://localhost/sgb/sgbapp.html?id=bWF1cmlsZG8=:257
dhtmlxEvent http://localhost/sgb/codebase/dhtmlx.js?dev=:9
http://localhost/sgb/sgbapp.html?id=bWF1cmlsZG8=:139

dhtmlx.js:9:16148

Can you help me ? I dont’know what’t the problem.

Many thanks

Could you please, provide a code snippet or a demo example where your issues could be reconstructed locally?

Thanks but i solved the problem but now there is another more difficult for me.

First of all best wishes for a happy new year to you and your DHMTLX Team.

i have a Grid with select_filters. Inside the onclick event of the select i need to access to the relative grid object properties. Of course “this” is not correct. How can i refer to the grid object starting from: the event for instance.

Thanks.

Thank you. Best wishes for you too.

You may try to use the onFilterStart/onFitlerEnd events with a “this” insode to get the current grid object:
https://docs.dhtmlx.com/api__dhtmlxgrid_onfilterstart_event.html
https://docs.dhtmlx.com/api__dhtmlxgrid_onfilterend_event.html
Like:

myGrid.attachEvent("onFilterStart", function(indexes,values){
    console.log(this.getRowsNum())
    return true;
});

Thank you but i can’t use that method. i need to have the reference to grid inside the onclick method going up the structure of the dom starting from event. For instance “element.parentNode.grid” that is not correct.

Thanks

Unfortunately it is not available to get the grid object from the native JS onclick event.

Hi Sematik. Another strange behaviour but probably i did something wrong.

In my app i’ve two grids binded to the form used to insert/update record throug the data processor.

In the first grid no problem and the php script is always the same in select, insert and update mode whith a render_table. In the second one i use different php scripts for select (render_sql to join fields of another table) and insert/update (render_table of all table fields)
The strange behaviour is this. I insert a blank line on the grid. I fill the form and update the grid with form save. In this case data are saved as updated and all run correctly and if i try to modify the same record again al run correctly . if i exit the app and open again trying to update the records written before there is no way to save data. When i click save on the Form the grid has update but the updates never arrives to mysql DB even if the “onAfterUpdate” event of dataprocessor says updated.

What’s the problem ? i’m using dhtmlx 5 (last available) where shouldn’t be necessary include connector in javascript client side while i include it in the php scripts. Is it correct ?

this is my onBforeUpdate event to change the php script from articoli to articoliIns on the fly.

dpgmag.attachEvent(“onBeforeUpdate”,function(id,type){
if (type == “inserted” || type == “updated”) {
dpgmag.serverProcessor=“data/articoliIns.php”
}
return true;
});

Thank you

Could you please, provide a complete demo, where the problem can be reconstructed locally?

I know Sematik and i will try but this is the message that i receive in the file log:

While there is no edit mode mark, POST parameters similar to edit mode detected. \n Switching to edit mode ( to disable behavior remove POST[ids]

and i’m using the last version of dhtmlx 5 suite so it shouldn’t be necessary include connector.js and dataprocessor.js on client side page (javascript). you confirm this ?.

thiis is code javascript:

var dpgmag = new dataProcessor(“data/articoli.php”);
dpgmag.init(magGrid);

dpgmag.attachEvent(“onBeforeUpdate”,function(id,type){
if (type == “inserted” || type == “updated”) {
alert(“cambio”);
dpgmag.serverProcessor=“data/articoliIns.php”
}
return true;
});

articoli.php

header (“Content-Type: text / html; charset = utf-8”);
require(“…/codebase/connector/grid_connector.php”);
$res= new PDO(“mysql:dbname=db_oratorio;host=localhost”,“root”,“”);
$conn = new GridConnector($res,“PDO”);
$conn->enable_log(“temp.log”);
$conn->render_sql(“Select magazzino.codice, magazzino.descrizione, magazzino.famiglia, magazzino.um, magazzino.nota, saldi.quantita, quantita - qta_prenotata - qta_fuori as qta_disponibile,saldi.qta_prenotata,saldi.qta_fuori from magazzino left join saldi on magazzino.codice = saldi.codice”,“magazzino.id”,“codice,descrizione,famiglia,um,nota,quantita,qta_disponibile, qta_prenotata,qta_fuori”);
?>

articoliIns.php

<?php require("../codebase/connector/grid_connector.php"); $res= new PDO("mysql:dbname=db_oratorio;host=localhost","root",""); $conn = new GridConnector($res,"PDO"); $conn->enable_log("temp.log"); $conn->render_table("magazzino","id","codice,descrizione,famiglia,um,nota"); ?>

Where is the problem ?