Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Linked grids - first row on parent will not be selected.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Linked grids - first row on parent will not be selected.

    Hello.
    I have a parent grid which is used to select a new row on a child grid.
    The keys in the linked grids is shown up on the child grid automatically.

    In order to pass a variable value from the parent grid to the child I have coded:
    window['var1']={grid.Object}.getValue('G','KONKURSBONAVN',{Grid.RowNumber});
    var xvar1='';
    if(window['var1']) xvar1=window['var1']
    else xvar1='value not found';
    $('E1').innerHTML=xvar1;
    {grid.Object}.setValue('G','KONKURSBONAVN',-1,xvar1);


    But this does not work if I press the first button or when the page is initialized the first time.
    If I press the second button it works.
    And again press the first button it works.
    Any suggestion much appreciated.
    Thanks.

    alpha1.jpg

    #2
    Re: Linked grids - first row on parent will not be selected.

    This was a little tough until I recalled other problems with timing. The problem here is that the value is being written to the grid and then the grid rows are being fetched. I put a setTimeout function in place to delay the value being written. You can play with the timing to see what works best for you. The last problem with the solution was that the setValue statement has to be parsed out to there are a bunch of escaped single quotes to deal with... but it does work. Hope it's what you're looking for.

    Code:
    window['var1']={grid.Object}.getValue('G','KONKURSBONAVN',{Grid.RowNumber});
    var xvar1='';
    if(window['var1'])
    {
     xvar1=window['var1'];
    }
    else
    {
     xvar1='value not found';
    }
    $('E1').innerHTML=xvar1;
    var t=setTimeout('{grid.Object}.setValue(\'G\',\'KONKURSBONAVN\',-1,\'' + xvar1 + '\');',500);

    Comment


      #3
      Re: Linked grids - first row on parent will not be selected.

      Thanks Davidk for your kind help.
      I tried this, but was unsuccessful in getting it to work.
      Even if I put a delay to be ahead before the whole code it did not work.
      As you can see there needs to be a delay before the xvar1 assignment.
      I have a feeling that this way of doing it might be wrong in spite of Web Application Video number #69.
      The reason is that I can push the first button many times without any luck.

      Alpha five - where is the video which shows the many ways of passing parameters?
      There are so many of us who are new to this and needs it.


      I have been looking at events.
      Parent: OnExistingRowRender e.rv.session.lastname = e.rowData.data("lastname")
      Child: OnGridExecute ????? = e.rv.session.lastname

      Any suggestion welcomed with gladness.
      Thanks.

      Comment


        #4
        Re: Linked grids - first row on parent will not be selected.

        Ok, let's get a bit more detailed because without some basic setup information it's tough to replicate what you're doing.

        You have a grid, and under Properties you are using the Linked Grids/Content section. You've defined a Linked Grid and specified it's location at the Freeform Region, Bottom of your grid. It looks like the "detail" grid you are displaying is a single record, form grid. Is all this correct? If so, then the code should work. The setTimeout is creating a delay of half a second before the setValue is taking place. Change the value of the delay a bit until it's working.

        Video # 69 is completely different from what you're trying to do... in a sense. This video is specifically opening a child grid from a parent grid and so you have lots of other events available. In your case, you're dealing with a linked child grid that is already open and so you're just updating already displayed data.

        I don't think OnGridExecute in the linked child grid will work because it only gets called when the grid is first executed (and on every Ajax callback - which may not apply here). To test this, in the linked child OnGridExecute put e.tmpl.rows=10. Now run your parent grid and you should see 10 rows displayed in the linked child. Now manually change the records per page to 1 in the linked child and then choose another parent record. The linked child grid stays at the records per page you selected - the code doesn't run again, in this case.

        Try the code below... I've modified it a bit to include your assignment to the "E1" div. Again, this must be delayed a bit until the linked child record is done fetching records.

        Code:
        window['var1']={grid.Object}.getValue('G','PRODNAME',{Grid.RowNumber});
        var xvar1='';
        if(window['var1'])
        {
         xvar1=window['var1'];
        }
        else
        {
         xvar1='value not found';
        }
        
        var t=setTimeout('{grid.Object}.setValue(\'G\',\'PRODDETAILS\',-1,\'' + xvar1 + '\'); $(\'E1\').innerHTML=\'' + xvar1 + '\';',500);
        Last edited by Davidk; 06-16-2011, 08:07 AM.

        Comment


          #5
          Re: Linked grids - first row on parent will not be selected.

          Thanks Davidk, I really appreciate your good response and support.
          I think I must have not explained my case good enough.

          The parent is a tabular read only grid where I have defined 2 link fields.
          On the child you can only see one of them as one of them is hidden.
          The two link fields works perfectly.

          The child is a form updateable grid with ADD RECORDS ONLY (only insert is allowed).
          There is no detail part or search part.
          The user select the row from the parent.
          The first time there is no select from the user and the child grid shows the linked fields from the parent but cannot display the passed parameter.

          I tried your suggestion and after that just to make sure used the following parameters:
          var xvar1='';
          if(window['var1']) xvar1=window['var1']
          else xvar1='value not found';
          var t=setTimeout('{grid.Object}.setValue(\'G\',\'KONKURSBONAVN\',-1,\'' + xvar1 + '\'); $(\'E1\').innerHTML=\'' + xvar1 + '\';',2500);
          if(window['var1']) xvar1=window['var1']
          else xvar1='value not found';
          var t=setTimeout('{grid.Object}.setValue(\'G\',\'KONKURSBONAVN\',-1,\'' + xvar1 + '\'); $(\'E1\').innerHTML=\'' + xvar1 + '\';',2500);


          I could feel the delay but had no luck, sorry about that.
          Probably because you expected me having another type of child grid.
          Thanks for your kind help.

          Comment


            #6
            Re: Linked grids - first row on parent will not be selected.

            I don't think your "If" statement is correct. Personally, I don't like the way it looks - hard for me to read, but that's just me. However, your code fails in my grid, until I put a semi-colon at the end of your first if statement.
            I think you need...

            if(window['var1']) xvar1=window['var1'];
            else xvar1='value not found';

            But I like mine a bit better 'cause it's easier for me to read.

            Comment


              #7
              Re: Linked grids - first row on parent will not be selected.

              OK Davidk, I have never taken the time to learn javascript.
              It is time to start learning it.
              However that does not change anything, as you can see from my first post.
              Thanks anyway.

              Comment


                #8
                Re: Linked grids - first row on parent will not be selected.

                Bump.

                Comment


                  #9
                  Re: Linked grids - first row on parent will not be selected.

                  OK, thanks to Davidk the solution.
                  Davidk the Genius, was not aware that he had solved this problem already in february 2011.
                  Also I have learned that I must be much clearer in describing my problem if I want to get help.

                  After reading many posts on this forum, I realize that many questions on this forum remain unanswered.
                  Only to get an answer is a blessing indeed. So it is good that we beginners can try to answer our own problems if we get one. Not everyone is so lucky to get the problem solved by others as I have.

                  The learning videos, samples and documentation seem to avoid these crucial subjects:
                  -The many ways of passing parameters.
                  -Events, when and how to use them.
                  -Xbasic for web

                  The Solution:
                  The parent is a tabular read only grid where I have defined link fields.
                  The child is a single form updateable grid with ADD RECORDS ONLY (only insert is allowed).
                  There is no detail part or search part.
                  The user selects the row from the parent and an extra field is needed to be copied from the parent to child.
                  The parent grid will work with or without a button, but it is always nice for the user to have a button instead of only a small arrow.

                  Javascript child only (no need of parent coding) � System events � OnGridRender
                  var fieldname = "";
                  var po_rowNum = "";
                  var po = {grid.Object}.getParentObject();
                  if (po) po_rowNum = po._selectedRow;
                  if (po) fieldname = po.getValue('G','FIELDNAME', po_rowNum);
                  {grid.Object}.setValue('G','FIELDNAME',-1,fieldname);


                  Important links:
                  If your child grid is different from a single insert row, then see the links below.
                  Maybe you have multiple child rows with read, update etc.

                  http://news.alphasoftware.com/v10preview/videos.htm
                  #69 Did not solve my problem but see it.

                  http://msgboard.alphasoftware.com/al...-child-windows
                  Videos shown by Bob Moore � very valuable

                  http://msgboard.alphasoftware.com/al...-causing-error
                  Davidk with the correct solution.

                  Thanks to Davidk for his kind help.

                  Comment

                  Working...
                  X