FoxInCloud
Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
Gravatar is a globally recognized avatar based on your email address. Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  All
  Jul 18, 2019 @ 10:00pm

Hi,

On the 21st of June I had a form with a grid on it working correctly, using FoxInCloud 2.30.0-beta.1 (it was repositioning properly when the form was resized, as per the fix in beta.1).
I then did no further work with FiC until the 4th of July when I installed beta.2 - all I did was install beta.2, I did not test anything after that or change any code.

After an absence of two weeks I have returned to working on FiC and I have found that the form no longer works. The form is rendered in the browser, except for the grid; at this point the form has not resized to the correct dimensions and the form does not respond to any events, I have not yet looked but I assume there is no javascript attached to it (the .js for the form is generated though).
If I remove the grid from the form, the form starts working again.

So, it seems that something in beta.2 has caused a problem.
I uninstalled beta.2 and reinstalled beta.1, but the problem persists. Perhaps some file or other change from beta.2 still remains?

Any ideas?

Thanks
Paul

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 19, 2019 @ 02:40am

Looks like a JavaScript error

Please post the browser dev tools' console panel when starting the form. It should show some read lines meaning a JavaScript error.

In this case, please expand the error node up to the xxx.js or FoxInCloud.js instruction causing the error. If you have the line number, the source code would be a great help.

Among all browsers, Chrome provides more helpful details.

TIA

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  FoxInCloud Support - Thierry N.
  Jul 21, 2019 @ 10:17pm

FoxInCloud.js, line 1414 :

DOMreadyUpdate: function (loIntuiCat, location, newWindow, locDelayS){ // Modifie les propiétés des objets de l'écran

    var success = true
    , script;

    // Si des scripts sont à exécuter AVANT les modifications du DOM
    script = this.oDOMEltChild(loIntuiCat, 'script');
    if (script && script.firstChild){
//    script = jQuery('<div/>').html(script.firstChild.nodeValue).text(); // https://stackoverflow.com/questions/1912501/unescape-html-entities-in-javascript
      script = script.firstChild.nodeValue;
      this.focusSet = this.focusSet || script.indexOf('.focus(') > -1;
      if (script) eval(script); // ***** this line has an error --> SyntaxError: unexpected token: identifier *****
    }

It is evaluating the contents of the form's .js file - I will remove all of my js changes (which were working previously) and see if it makes a difference.

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 21, 2019 @ 11:46pm

The error lies in the Javascript embedded in the Ajax response.

You can play with the exception handling in the browser dev tools until you break on all exceptions. Then code should stop on the offending instruction inside the eval(). (again Chrome should do the best job)

Otherwise, when execution stops on the eval() Line, you can just type “script” in the console, enter, copy and paste the script here.

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  FoxInCloud Support - Thierry N.
  Jul 22, 2019 @ 01:48am

A syntax validator shows that this line in the js produces the error :

oGrid.see awHTMLgen.getHTML_grd_AW_cScript__() > case m.llGrd and InList(m.lcProp, 'Left', 'Top');

Foxpro code from awHTML.prg inside js??? Weird...

Here is a snippet from the js that shows the js around it :

(function(){
	var dStart = new Date();
	var grd = document.getElementById('stockcontrolcheckarea-onhandgrid');
	if (grd){
		jQuery.extend(grd, {oGrid: new AW.UI.Grid, oTable: new AW.XML.Table});
		var oGrid = grd.oGrid, oTable = grd.oTable, oTempl;
		oGrid.defineCellProperty('CurrentControl', null);
		oGrid.defineControlProperty('DataUpdate', false);
		oGrid.setTabIndex("3");
		oGrid.setSelectorWidth(10);
		oGrid.getSelectorTemplate().setStyle('font-weight','bold');
		oGrid.setRowCount(0);
		oGrid.setCellEditable(true);
		oGrid.setCurrentColumn(-1);
		oGrid.setCellSelected(false, oGrid.getCurrentColumn(), oGrid.getCurrentRow());
		oGrid.setSelectionMode('single-row');
		oGrid.setSelectedRows([-1]);
		oGrid.setSelectedRows([parseInt(oGrid.getCurrentRow(), 10)]);
		oGrid.clearColumnModel();
		oGrid.setColumnCount(1);
		oGrid.setStyle('font-weight','bold');
		oGrid.setStyle('font-family','Tahoma');
		oGrid.setStyle('font-size','18pt');
		oGrid.setHeaderHeight(0);
		oGrid.setSize(undefined, 312);
		jQuery(grd)[FoxInCloud.posDimEffect ? "animate" : "css"]({"left": "84px"});
		oGrid.setRowHeight(33);
		oGrid.onScrollBarsChanging = function(e){return false};
		oGrid.setScrollBars('none');
		oGrid.onScrollBarsChanging = function(e){return true};
		oGrid.defineControlProperty('Statusbartext');
		oGrid.setControlStatusbartext('');
		jQuery(grd)[FoxInCloud.posDimEffect ? "animate" : "css"]({"top": "84px"});
		oGrid.setSize(708,undefined);
		oGrid.see awHTMLgen.getHTML_grd_AW_cScript__() > case m.llGrd and InList(m.lcProp, 'Left', 'Top');
		oGrid.setColumnIndices([0]);
		oGrid.setCellEditable(true, 0);
		oGrid.setColumnResizable(true, 0);
		oGrid.setColumnWidth(75+1, 0);
Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 22, 2019 @ 04:18am

OK, thanks, probably a nasty comment, will dig into that this evening , maybe you can figure it out in awHTML.prg

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  FoxInCloud Support - Thierry N.
  Jul 22, 2019 @ 05:49pm

The loop in awHTMLgen.getHTML_grd_AW_cScript__() goes through the DOM members for the grid :

Note that top and left are in the members twice, once upper case and once lower.

This line (recent code) does not capture the lower case members :

case m.llGrd and InList(m.lcProp, 'Left', 'Top') && 2019-06-18 thn -- {FiC V 2.30.0-beta.1} {en} added BEFORE awGrd.awMethod below
				oJS.grdProperties = m.oJS.grdProperties + Textmerge('jQuery(grd)[FoxInCloud.posDimEffect ? "animate" : "css"]({"<<Lower(m.lcProp)>>": "<<m.luProp>>px"});') + CRLF

Instead, this case is executed :

case varSet(@m.lcScript, Textmerge(Iif(m.lcProp == 'AllowCellSelection';
				, ''; && longer than V(254) chars
				+ "<<iif(m.luProp, 'setSelectedRows([])', 'setCellSelected(false, oGrid.getCurrentColumn(), oGrid.getCurrentRow())')>>;";
				+ [setSelectionMode('<<Iif(m.luProp, "single-cell", "single-row")>>');];
				+ "<<iif(m.luProp, '', 'setSelectedRows([-1]);setSelectedRows([parseInt(oGrid.getCurrentRow(), 10)])')>>";
				, Trim(awGrd.awMethod, ' ', ';');
				), .T.)) and Empty(m.lcScript) && Empty(awGrd.awMethod)

and awGrd.awMethod for Top and Left contain that comment you see in the js output.

Please advise what fix I can put in place; for the moment I'll simply remove the comment from awgrd.

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 23, 2019 @ 01:36am

Not sure how left and top can show up in this properties list obtained by loading the grid properties XML into the MSXML parser, this XML being build by scanning the awGrd table where all properties are mixed cased.

However you can try to:

modi comm awHTML.prg

&& replace
case m.llGrd and InList(m.lcProp, 'Left', 'Top')

&& by
case m.llGrd and InList(Proper(m.lcProp), 'Left', 'Top')
Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  FoxInCloud Support - Thierry N.
  Jul 23, 2019 @ 03:40pm

I will add this code instead so that the js is not doubled up, until you can discover why the lower case properties are there :

case m.llGrd and InList(m.lcProp, 'left', 'top') && 4T, 2019-07-24, PSE; these lower case properties are spurious and should be ignored
*** ignore
Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 24, 2019 @ 01:51am

Hi Paul,

While I can't reproduce your use case, this fix should solve the issue:

case lProperty(m.toObj, 'wcPropSave') and ALines(laProp, m.toObj.wcPropSave, 5, ',', ';') > 0
	for each lcProp in m.laProp
		if !Indexseek(m.lcBaseClass+"."+Proper(m.lcProp), .F., 'awGrd', 'awGrd') && ADD THIS LINE
			luProp = GetPem(m.toObj, m.lcProp)
			tcResult = m.tcResult + m.lcIndent;
				+ '<' + m.lcProp + '>';
				+ cEscaped_XML(Iif(Vartype(m.luProp) = 'C';
					, this.getHTML_grd_AW_cXML_cPropVal(m.luProp);
					, Transform(m.luProp);
					));
				+ '</' + m.lcProp + '>';
				+ CRLF
		endif && ADD THIS LINE
	endfor
endcase

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  FoxInCloud Support - Thierry N.
  Paul
  Jul 27, 2019 @ 02:53am

Hi Paul,

Any update on this issue? TIA

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid (since FoxInCloud 2.30.0-beta.2 ?)
  Paul
  FoxInCloud Support - Thierry N.
  Jul 28, 2019 @ 04:46pm

That fixed the problem, thanks.

© 1996-2024