Alpha Video Training
Results 1 to 6 of 6

Thread: How to get dialog repeating section row count to populate controls inside.

  1. #1
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default How to get dialog repeating section row count to populate controls inside.

    Hi all,

    I've got a dialog with two repeating sections. The dialog is initally loaded with data from 3 tables based on the unique_id of the record you'd like to edti. What I want to do is to "look up and fill in fields" on some controls in one of the reapeating sections. I can't bind the controls because the info I'm looking up comes from a different connection string than the data bindings.

    I looked at the text for the lookup and fill in fields function after I created it and I have this:

    Code:
    var rowNum = 1;
    {dialog.Object}.ajaxCallback('',rowNum,'__system__58d3d54a9ffd4706b19ab71135010731');
    What I need to do is find out how many rows are currently being used so I can do something like this:

    Code:
    var rowNum = *****what do I put here to get the current number of rows in a container?*****
    ;
    for rowNum
    { 
    {dialog.Object}.ajaxCallback('',rowNum,'__system__58d3d54a9ffd4706b19ab71135010731');
     }
    My javascript may be off above....I haven't done a "for loop" before but anyway...

    I found a method to set the number of rows but not get the current number of rows when the dialog is populated from a table.

    Any help would be appreciated.

    Thanks

  2. #2
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: How to get dialog repeating section row count to populate controls inside.

    I got the "for loop" working but kept getting an error so I tried a "while loop". I get the same error anyway.

    I harvested the repeating sections to get the string of values and then got the number of commas in there so I know how many row numbers there are. I threw in the alert just for debugging purposes. Here it is:
    Code:
    var tools ={dialog.Object}.harvestRepeatingSectionColumn('TOOL');
    var count =(tools.split(",").length);
    var rowNum ={dialog.Object}.getRepeatingSectionActiveRow('CONTAINER_2');
    //window.alert(tools+' '+count+' '+rowNum);
    while (rowNum<count)
    {
    {dialog.Object}.ajaxCallback('',rowNum,'__system__7630c5cf29494e0d8b877cae14b5619d');
    rowNum = rowNum + 1;
    }
    The error I keep getting is a "Script Error" that says:
    An error has occured in the script on this page.
    Line: 11779
    Char: 5
    Error: Unable to get value of the property 'i': object is null or undefined
    Code: 0
    URL: a5res:javascript/a5.js

    I don't know what the heck the 'i' property is? Also, when I click "continue running scripts on this page" it successfully inserts the values into the first row but stops after that and won't insert any values into subsequent rows.

    Any ideas?

  3. #3
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: How to get dialog repeating section row count to populate controls inside.

    Nuthin'?

    I'd also be happy to do this in the onDialogInitialize event if anyone knows how to do it.

  4. #4
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: How to get dialog repeating section row count to populate controls inside.

    Bump again...

    BTW, I was thinking about signing up to get a "mentor" at alpha to help with my sporadic issues.....does anyone there EVER return phone calls?

  5. #5
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: How to get dialog repeating section row count to populate controls inside.

    Well,
    3 days and a couple hours later; with a bunch of documentation searching and video watching, I finally have something that works. I figured I may as well post the code here since no one came up with an answer for me.

    Code:
    //If the DESC field is in a Repeating Section with 3 rows, this method will return (for example) 'Product1,Product2,Product2'
    var tools ={dialog.Object}.harvestRepeatingSectionColumn('TOOL');
    //This finds out how many instances there are of commas in the tools variable which will tell me how many times to repeat the loop
    var count =(tools.split(",").length);
    //Gets the active row....this could probably just be set to 1 again like it was initially but if it ain't broke.....
    var rowNum ={dialog.Object}.getRepeatingSectionActiveRow('CONTAINER_2');
    var instNum = 1;
    //window.alert(tools+' '+count+' '+rowNum);
    for (; instNum<count; instNum++)
    {
    {dialog.Object}.ajaxCallback('',rowNum,'__system__7630c5cf29494e0d8b877cae14b5619d','','_repeatingSectionActiveRow=' + instNum);
    }
    Adding the ----_repeatingSectionActiveRow=' + instNum---- was the key to getting this to work and although video D67 wasn't doing the same thing with it, that's where I got the information.

    Now I'm going to see if I can set this in the onDialogInitialize event so users don't need to click a button.

  6. #6
    Member -Jinx-'s Avatar
    Real Name
    Jinx
    Join Date
    Jul 2012
    Location
    Wisconsin
    Posts
    963

    Default Re: How to get dialog repeating section row count to populate controls inside.

    Added it to the onRenderComplete Client-Side Event. Seems to work properly there.

Similar Threads

  1. How do I get the repeating section row number in dialog2 component?
    By LukeS in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 05-26-2012, 03:19 AM
  2. Dialog - relative row number in repeating section
    By Jay Talbott in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 04-12-2012, 12:55 AM
  3. Repopulate Repeating Row Section in Dialog2
    By Dfred in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-09-2012, 12:09 PM
  4. Delete Row Prompt in Repeating Section (Dialog2)
    By Dfred in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 03-07-2012, 12:06 PM
  5. How to left-align dialog's repeating section Add Row/Delete Row icons?
    By WindForce in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 01-11-2012, 02:54 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
  •