In my form i have a grid. The code i have to transform it in a list (editable) is this
grid.wchtmlgen()
LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent
DoDefault(toHTMLgen)
If Thisform.wBSlHTMLgen
This.AddProperty("wcIdBs", This.wcID + "_bs")
This.wcHTML = [<div class="panel-group" id="] + This.wcIdBs + [" role="tablist" aria-multiselectable="true"></div>]
toHTMLgen.cScriptJSadd("FoxInCloud.inputAlwaysBlur=false;")
Endif
grid.refresh_
lparameters void_parameter_reminder_implement_your_Refresh_code_in_this_method
if !(lProperty(this, 'wcIdBs') and ga_Type_IsChar(this.wcIdBs, .T.))
return
endif
Local abSelect, abRecno, abPoint, abSep, cTxtID, cChkID, cHTML, cScript, nTabIndex
cHTML = ''
nTabIndex = 10
If Used("SaldiMag")
abRecno = abRecno('SaldiMag')
abSelect = abSelect('SaldiMag')
abPoint = abSet('point', '')
abSep = abSet('separator', '')
cTxtID = wcID(this.columns(4).txt)
*cChkID = wcID(this.columns(5).chk)
Do While !Eof("SaldiMag")
TEXT to cHTML textmerge additive noshow flags 3
<div class="col-sm-12 panel panel-default" data-rowid="<<Recno("SaldiMag")>>">
<div class="riga" role="tab">
<div class="lead col-sm-3 list-title"><<allTrim(SaldiMag->Cod)>></div>
<div class="lead col-sm-4 list-title"><<allTrim(SaldiMag->Des)>></div>
<div class="lead col-sm-2 list-title" style="text-align:right;"><<alltrim(Transform(SaldiMag->Sum_Cons,"999,999.99"))>></div>
<input type="number" class="lead col-sm-2 list-title border <<m.cTxtID>>" value="<<Ltrim(Transform(SaldiMag->_Qta,'@Z 999,999.99'))>>" step="0.01" tabindex="<<m.nTabIndex>>">
</div>
</div>
EndText
nTabIndex = m.nTabIndex + 2
Skip In SaldiMag
EndDo
Endif
TEXT to cScript textmerge noshow flags 3
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)
I have no problems with this form for a number of times i call it.... Then, without a specific problem, the list is shown empty and i can check that the pronlem is that when refresh_ method is called in the grid there is not the wcIdBs property created in wchtmlgen..
this take the method to be closed without do nothing
the first code executed is this
if !(lProperty(this, 'wcIdBs') and ga_Type_IsChar(this.wcIdBs, .T.))
return
endif
Why i have this problem ?
I have not the problem when i test the app in dev mode, launching it from project manager and vfp ide and i have it while i use the app in file mode running directly the exe file
Ciao Michele,
Try to copy .addproperty()
into .init()
(remind dodefault) and use scan
instead of Do While !Eof("SaldiMag")
Tried both without success.
If i move addproperty in the init probably i have not still wcid assigned....
Here i have an example of my problem... When i enter the grid is empty (but it should be not empty)... when i close the form and open it again i have all data