Alpha Video Training
Results 1 to 12 of 12

Thread: Dynamic template

  1. #1
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Dynamic template

    Hi Everyone,

    I am new and had been focusing on the SIMPLE-LIST-CONTROL
    to utilize , DYNAMIC-TEMPLATE to display the results.

    Its unfortunate, I found very limited example or video.
    or perhaps its so simple that I had missed.

    Enclosed a very simple example ..

    with two group of LISTS control./

    group one using the basic ..
    layout type = Column

    Group two using
    layout type = freedom
    where i need help to find a way to dynamically
    coded it so that the number of Column is to be programmable.

    so if the source of data has 4 fields...
    i want it to behave as its a 4-columns layout

    while, if the source now has 7 fields...
    the end result would show 7 columns.

    Please refer to my test UX and picture
    to illustrate my wish

    thansking everyone in advance

    NicholasDYNAMIC_template_sample.a5wcmpdynamic.PNG

  2. #2
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    More explanation ...

    Based on the picture .. I have
    ALPHA/BETA/CHARLIE/DELTA

    its a 4-fields ...columns.

    However, in the freedom layout
    i had to specified all the fields....

    it there a way to coded it with javascript/function

    so that it only produce a 4 column layout ?

  3. #3
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    340

    Default Re: Dynamic template

    I don't know if you had found these (I've had to bookmark them because I can't seem to ever find the right search terms on the documentation site to find them again):

    Client-side Templating Syntax:
    https://documentation.alphasoftware....ates/index.xml
    Client-side Templates overview:
    https://documentation.alphasoftware....0Templates.xml

    That being said, I wonder if you might want to look into going the "setListColumnsAndPopulate" method route:
    https://documentation.alphasoftware....e%20Method.xml

    Also, maybe look at the listbox setDisplay method:
    https://documentation.alphasoftware....y%20Method.xml
    Last edited by jgrannis; 01-07-2019 at 02:55 PM.

  4. #4
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    Thank you Jeff for the link and directions ...

    I have now able to produce DYNAMIC-COLUMN

    enclosed a working sample ..

    However, despite requesting x columns to show
    like first-4 columns , the List-Control would show an extra 3 unrelated columns at the end.

    What Have I done wrong ???

    appreciate help from the community.

    dyna.PNGDYNAMIC_template_sample.a5wcmp

  5. #5
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    Trust this sample-dynamic column exercise would benefit many ...
    dont believe i have seen any working example or video related to such
    good feature and functionality ...

    I thanks all of you .. Please help me !

    Once I get this done ... i would like to see this feature for
    "FREEFORM" layout type ... can this be done ?

  6. #6
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    //populate the List with the first 3 columns in data
    var ops = {columnCount: 3};
    {dialog.object}.setListColumnsAndPopulate('list',data,ops);

    I would like to know if my sample above not been impleted with the correct parameters ??
    i confirmed that my code would produce the proper column-count to show

    however, the final LIST-TEMPLATE would include three extra columns

  7. #7
    "Certified" Alphaholic
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    1,010

    Default Re: Dynamic template

    Have you seen Selwyn's video titled, "Dynamically Populating a List Columns and Data - Generic SQL Table Viewer" ?
    You can find it here:
    https://www.viddler.com/embed/13e2dc..._responsive=0#

  8. #8
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    Quote Originally Posted by RichCPT View Post
    Have you seen Selwyn's video titled, "Dynamically Populating a List Columns and Data - Generic SQL Table Viewer" ?
    You can find it here:
    https://www.viddler.com/embed/13e2dc..._responsive=0#
    Yes I had ... this is a client-sided , believe the video is about server-sided with xbasic.

    i am merely doing what the documents that Jeff suggested ...

    i rely strictly on this javascript function :
    //populate the List with the first 3 columns in data
    var ops = {columnCount: 3};
    {dialog.object}.setListColumnsAndPopulate('list',data,ops);

    i asked for 3 columns, i got three
    i asked for 7 columns, i got seven

    all working BUT ... additonal 3 columns added UN WANTED

    has anyone out there ever used such ?
    i just eventually want this to be self-supported stand-alone phonegapped android app
    no ajax call back ... just rely on static datas and local storage and munipulate everything
    using javascript

    appreciate help from experienced alpha-er

  9. #9
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    hmm speak too soon, perhaps the Selwyn's video indeed has something
    let me watch that video today ... However, its the Javascript that i am asking.

    the Sample UX enclosed should give you a real look at the issues i am facing
    while i dont expect a fix from you, but would appreciate a suggestion or direction
    to solve this issues ....

    I could perhaps add something in HTML to hide the last 3 columns (unwanted 3)
    with display:none; ?

    best to see it works as specified by Alpha's documentation :

    //populate the List with the first 3 columns in data
    var ops = {columnCount: 3};
    {dialog.object}.setListColumnsAndPopulate('list',data,ops);

  10. #10
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    340

    Default Re: Dynamic template

    Instead of getting _data from the list object, a better starting place would probably to use the dialog object's getListData method.
    It will give you the data without the "*" keys.

    They are showing those 3 extra columns because you leave them in there when you create your listData array.

    The below is what I would use for this particular case ...even though it wouldn't work well for more complex data pivoting requirements.
    The below could replace all your "click" event code for the GENERATE button:

    Code:
    var sourceData = {dialog.Object}.getListData('source1');
    var sourceDataLength = sourceData.length;
    var destinationData = [];
    var rowData = {};
    var i;
    for(i=0; i<sourceDataLength; i++){
    	rowData[i+1] = sourceData[i].title;
    }
    destinationData.push(rowData);
    console.log('destinationData: '+JSON.stringify(destinationData));
    var ops = {columnCount: sourceDataLength};
    {dialog.object}.setListColumnsAndPopulate('destination1',destinationData,ops);

  11. #11
    "Certified" Alphaholic
    Real Name
    Rich Fulham
    Join Date
    May 2011
    Location
    Portland, OR
    Posts
    1,010

    Default Re: Dynamic template

    BTW, at about 7 minutues 45 seconds into Selwyn's video he shows the JavaScript (which he creates in xbasic as a string to send back to the browser) to populate the LIST control. That is the piece of code I was trying to point you to. Notice that that Selwyn uses the same AA JavaScript method to populate the LIST as Jeff did - {dialog.object}.setListColumnsAndPopulate(…).

    Jeff uses the "ops" parameter, Selwyn does not. I'd use Jeff's code.

  12. #12
    Member
    Real Name
    Nocholas Gan
    Join Date
    Dec 2018
    Posts
    34

    Default Re: Dynamic template

    Thanks Jeff & Rich

    I now realize where those * coming from .

    enclosed an updated version
    Attached Files Attached Files

Similar Threads

  1. Dynamic Template in list control issue
    By Peter.Greulich in forum Mobile & Browser Applications
    Replies: 10
    Last Post: 05-09-2018, 12:11 PM
  2. Dynamic string building template
    By TheDuke in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 11-07-2017, 06:49 PM
  3. UI suggestions for dynamic lists, dynamic controls and immediate editing.
    By Steve Workings in forum Mobile & Browser Applications
    Replies: 50
    Last Post: 02-07-2017, 09:34 PM
  4. Replies: 2
    Last Post: 08-26-2016, 11:27 AM
  5. template
    By GGandhi in forum Application Server Version 10 - Web/Browser Applications
    Replies: 3
    Last Post: 12-30-2010, 01:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •