8.0.2 calendar does not work when dhtmlx 5 and 8 is used on same page

Hi,

not sure if it is foreseen to use dhtmlx5 and 8 on the same page but i was happy to see that it seems to basically work now - this allows me a slow and smooth upgrade.
Anyway, not everything works tough, when i use datepicker form item in a dhx8 form, it is drawn, i can work with it but when a value is selected, the field stays empty.

To make it work, in suite.js line 23878 i needed to comment the line
dateFormat: window && window.dhx && window.dhx.dateFormat,

Maybe my message leads to 8.0.3 being even more backward compatible :smiley:

Hello.

Unfortunately the usage of the dhtmlxSuite 5 and 8 together in parallel is not a scenario I can recommend.
In this case the better solution will be to include the sources of the dhtmlxSuite 5 as a vanillaJS while the dhtmlxSuite 8 sources import as an UMD package to isolate these two builds.

@sematik
thank you for that impressive recommendation, i did not know about this simplistic umd stuff until now, this is really nice.

For future readers, this is what i do when using dhx5 and 8 on the same page.

  1. in the folder where suite.js relies, create a new file named suite.umd.js, content:
(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
      // RequireJS
      define(['exports'], factory);
    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
      // Nodejs
      factory(exports);
    } else {
      // browser js
      global = root || self;
      factory(global.dhx8 = {});
    }
  }(this, function (exports) {
    "use strict";
/* start of dhtmlx suite.min.js code */

!!!...insert the complete contents of dhx 8 file suite.min.js  here...!!!

/* 
  end of dhtmlx suite.min.js 
  usage example: dhx8.dhx.Window 
*/

}));

Then of course instead of loading the suite.min.js script file on my page, i load the newly created suite.umd.js file (and the old dhtmlx script too of course).

<script src="../../dependencies/dhtmlx/5/dhtmlx.js"></script>
<script src="../../dependencies/dhtmlx/8.0.0/suite.umd.js"></script>

The css imports remain unchanged, the old and new css dont seem to interfere.

This allows to use dhtmlx5 and new dhtmlx on the same page.

While access to dhx5 stuff remains unchanged on the existing page, i can access dhx8 functions by prefixing dhx8, e.g.:
dhx8.dhx.Window(....

It is really nice to see dhx5 and 8 working together, here an example where i use dhx8 form but dhx5 windows, layouts and everything else.

1 Like