FoxInCloud
Problem showing a grid in bootstrap
Gravatar is a globally recognized avatar based on your email address. Problem showing a grid in bootstrap
  Michele
  All
  Dec 23, 2021 @ 08:58am

I have this code in grid.refresh_

Local abSelect, abRecno, abPoint, abSep, cTxtID, cChkID, cHTML, cScript, nTabIndex

cHTML = ''
nTabIndex = 10
If Used("tCosop")
	Select tCosop
	Go Top
	abRecno  = abRecno('tCosop') && restores recno() automatically
	abSelect = abSelect('tCosop') && restores select() automatically
	abPoint = abSet('point', '')
	abSep = abSet('separator', '')
	cTxtID = wcID(this.column7.txt)
	
	Scan && always starts at BOF(); you can use SCAN FOR to filter
		TEXT to cHTML textmerge additive noshow flags 3
			<div class="col-sm-12 panel panel-default" data-rowid="<<Recno("tCosop")>>">
				<div class="riga" role="tab">
	                <div class="col-sm-1 btn-group btn-group-main-apps " data-rowid="<<Recno("tCosop")>>">
                        <button class="btn btn-default btn-list-select" id="<<wcId(This.Column8._CommandButton1)>>">
                        <span class="fa fa-minus-circle fa-1x" aria-hidden="true"></span>
                        </button>
					</div>
	                <div class="col-sm-1 btn-group btn-group-main-apps " data-rowid="<<Recno("tCosop")>>">
                        <button class="btn btn-default btn-list-select bt2_class" id="<<wcId(This.Column4._CommandButton1)>>">
                        <span class="fa fa-search fa-1x" aria-hidden="true"></span>
                        </button>
					</div>
					<div class="lead col-sm-3 list-title"><<allTrim(tCosop->Des1)>></div>
					<div class="lead col-sm-3 list-title"><<allTrim(tCosop->Ddip)>></div>							
					<div class="lead col-sm-2 list-title" style="text-align:right;"><<tCosop->Qta>></div>
					<input type="number" step="1.00" class="lead col-sm-2 list-title border <<m.cTxtID>>" value="<<tCosop->N_ore>>" step="1.00" tabindex="<<m.nTabIndex>>">
				</div>
			</div>
		EndText
		nTabIndex = m.nTabIndex + 2

	EndScan
Endif

TEXT to cScript textmerge noshow flags 3
	jQuery("button.bt2_class").on('click', function() {
				let rowId = jQuery(this).parent().attr("data-rowid");
				jQuery.proxy(FoxInCloud.DOMEvent,FoxInCloud)(rowId,false,event);
			});

	jQuery("#<<This.wcIdBs>>").html(<<cLitteralJS(m.cHTML)>>)
	var EventRequest = jQuery.proxy(FoxInCloud.EventRequest, FoxInCloud);
	jQuery("#<<This.wcIdBs>> div.panel").each(function(idx, elem){elem.addEventListener('click', function(event) {EventRequest(
			  "DOMEvent"
		  , event
		  , this
		  , jQuery(this).data("rowid")
		  , "<<this.wcID>>"
			)}, true);});

	var mousedown = false;
	jQuery("#<<This.wcIdBs>> .<<m.cTxtID>>")
		.mousedown(function(){
    	mousedown = true;
		})
		.focus(function(event) {var row = this.parentElement.parentElement; !mousedown && EventRequest(
			  "DOMEvent"
		  , 'click'
		  , row
		  , jQuery(row).data('rowid')
		  , "<<this.wcID>>"
			);
			mousedown=false;
			})
		.blur(function(event) {EventRequest(
			  "DOMEvent"
		  , event
		  , this
		  , jQuery(this).val()
		  , "<<m.cTxtID>>"
			);});
ENDTEXT

thisForm.wcScriptJSadd(m.cScript)

Data are shown correctly. I can edit values in the edit box.... But no event is linked to the buttons

Is like the code

	jQuery("button.bt2_class").on('click', function() {
				let rowId = jQuery(this).parent().attr("data-rowid");
				jQuery.proxy(FoxInCloud.DOMEvent,FoxInCloud)(rowId,false,event);
			});

is not read... If i cut & paste this code in the browser console then the buttons begin to work

Why ?

Thanks

Gravatar is a globally recognized avatar based on your email address. re: Problem showing a grid in bootstrap
  FoxInCloud Support - Thierry N.
  Michele
  Dec 24, 2021 @ 03:16am

Event implementation (eg. jQuery("button.bt2_class").on('click', function(){…}) must ALWAYS run AFTER setting the HTML (eg. jQuery("#<<This.wcIdBs>>").html(<<cLitteralJS(m.cHTML)>>))

Gravatar is a globally recognized avatar based on your email address. re: Problem showing a grid in bootstrap
  Michele
  FoxInCloud Support - Thierry N.
  Dec 24, 2021 @ 06:30am

Now it works. Thanks for suggest

© 1996-2025