Page 1 of 1

Create programmatically

PostPosted: 08 Sep 2018 23:25
by cyracks
Hello,

I am trying to create JQMMobiScroll2 from code but it somehow does not work as expected (when edit is selected no date box popup)

Code is:
Code: Select all
var MFilterDate: TIWCGJQMMobiScroll2;

    MFilterDate := TIWCGJQMMobiScroll2.Create(WebApplication);
    with MFilterDate do begin
        Name := 'MFilter_'+nID;
        Parent := WinControl;
        TabOrder := TabOrder;
        Tag := StrToInt(nID);
        JQMCoreOptions.Mode := jqmsmMixed;
        JQMCoreOptions.Theme := jqmstJQM;
        Preset := jqmspDate;
    end;


Probably some part of the code is missing ?

Regards,
Tomaž

Re: Create programmatically

PostPosted: 10 Sep 2018 10:49
by Alexander Bulei
Hi cyracks,

When you call that code?

Best Regards.

Re: Create programmatically

PostPosted: 10 Sep 2018 12:39
by cyracks
The event is set on CGJQMListItem.onVClick and after objects (JQMMobiScroll2) are added to Accordion ajaxRender is called.

1) Items of CGJQMListView are added on form Create event, event CGJQMListItem.onVClick is added like:
Code: Select all
with CGJQMListItem do begin
    if Assigned(OnClick) then begin
        Events.OnVClick.OnEvent := OnClick;
        if Assigned(LockIndicator)
            then Events.OnVClick.Indicator := LockIndicator;
    end;


2) Procedure onVClick adds objects to accordion and calls AjaxReRender
Code: Select all
procedure Form.MListViewVClick( Sender: TObject; AParams: TStringList);
begin
    MFilterDate := TIWCGJQMMobiScroll2.Create(WebApplication);
    with MFilterDate do begin
        Name := 'MFilter_'+nID;

        Parent := WinControl;
        TabOrder := TabOrder;
        Tag := StrToInt(nID);
        // JQMEditOptions.PlaceHolder := cPlaceHolder;
        JQMCoreOptions.Mode := jqmsmMixed;
        JQMCoreOptions.Theme := jqmstJQM;
        Preset := jqmspDate;
    end;

    Accordion.AjaxReRender();
end;


After that I can see object JQMMobiScroll2, it just does not work after it is clicked.

Re: Create programmatically

PostPosted: 11 Sep 2018 11:43
by Alexander Bulei
Hi cyracks,

For the fast support, can you provide the simple testcase with your structure?

Best Regards.

Re: Create programmatically

PostPosted: 11 Sep 2018 23:21
by cyracks
Hello Aleksander,

after trying to repeat the error on a simple project I found the problem was in my code (code written above was not even executed)

Thank you for your help.

Regards,
Tomaž

Re: Create programmatically

PostPosted: 12 Sep 2018 18:17
by Alexander Bulei
Hi cyracks,

Ok, I'm glad that you have found the problem :)

Best Regards.