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

Saving data in embedded UX component

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

    Saving data in embedded UX component

    I have a main UX component with multiple UX's attached to a tab control. How can I save the data on the embedded UX's from a single Save button on the main UX?

    I'm really hoping my customers don't have to click save on each tab.

    #2
    Re: Saving data in embedded UX component

    Your embedded UX components are Objects. Once you get a pointer to an object, you can call methods for that object.

    In the code for your main Save button add the code which will get a pointer to each child UX Object... and then call the submit method for each object.

    When you embed a UX you can give that embedded object an Alias... you must do this. You'll find that property in the Embedded Object control.

    Your code will be something like...

    Code:
    var obj = {dialog.Object}.getChildObject('myChildUX');
    obj.submit();

    Comment


      #3
      Re: Saving data in embedded UX component

      I ran across these videos this morning. They cover what David suggests:

      http://www.ajaxvideotutorials.com/V1...AndChild_1.swf
      http://www.ajaxvideotutorials.com/V1...AndChild_2.swf

      {dialog.Object}.getChildObject('alias'[,component_type]) works for both Embedded components and components you may open through other means. There are placeholder objects for objects embedded in a UX (eg, {dialog.embeddedUX_MYUXALIAS}), but they don't work for components opened in new tabs/windows/DIVs/etc.
      Alpha Anywhere latest pre-release

      Comment


        #4
        Re: Saving data in embedded UX component

        Great, thanks for the help, it's working as planned now.
        Now I'd like to know if there's a way to have the 'Submit' button on the main form become active if on the the embedded UX controls are dirty. After that I think I'll be set.

        Comment


          #5
          Re: Saving data in embedded UX component

          Originally posted by CampnJim View Post
          Great, thanks for the help, it's working as planned now.
          Now I'd like to know if there's a way to have the 'Submit' button on the main form become active if on the the embedded UX controls are dirty. After that I think I'll be set.
          You could add code in all the child UX components to call code in the parent UX to enable the submit button. Much like calling submit on all the child items, but you would use the "getParentObject" function instead of the "getChildObject".
          Code:
          // In the child UX:
          var po = {dialog.object}.getParentObject();
          if (po) {
            if ({dialog.object}.isDirty) {
              po.setDisabled('SUBMITBUTTON',false);
            }
          }
          I think you can leverage either the onDataStateChange or onStateChange events in the UX to call your code depending on how you want the Submit button enabled. If the components in your UX are bound to a table, I would recommend using onDataStateChange instead of onStateChange. It will fire only when your data bound control states change, as opposed to any control's state changing. You will still want to check the e.isDirty and/or e.isDataDirty elements as these events will fire when the UX is changed from dirty to clean.

          If you have a reset button, you'll want to put your code in to disable the submit button there. And you probably want to make sure this only happens in the parent UX, however, as you would need to add knowledge of all the child components the parent UX could have to all the children to do this from the children.

          If this was my UX, I would define a function in the parent UX in the onRenderComplete client-side event:
          Code:
          {dialog.object}._functions.enableSubmit = function () {
            var child1 = {dialog.object}.getChildObject('AliasOfCHILD1');
            var child2 = {dialog.object}.getChildObject('AliasOfCHILD2');
            var dlgIsDirty = ((child1)?child1._isDataDirty:false) || ((child2)?child2._isDataDirty:false);
          
            // this is a bit backwards; if any child is dirty, then we should NOT disable the submit button
            {dialog.object}.setDisabled('SUBMITBUTTON', !dlgIsDirty));
          }
          And in the children, I would add this to the on[Data]StateChange event(s) or wherever I deemed it appropriate:
          Code:
          var po = {dialog.object}.getParentObject();
          if (po && typeof (po._functions.enableSubmit) !== undefined) {
            po._functions.enableSubmit();
          }
          Good luck.
          Alpha Anywhere latest pre-release

          Comment


            #6
            Re: Saving data in embedded UX component

            I have multiple embedded UX's in various panels. I've tried a couple different ways to get my child objects to submit but can't seem to get it right. I'm not JS savvy enough and maybe someone could help me out here?

            Here is what I've tried in my submit button...

            Code:
            [COLOR="#FF0000"]Only the very first one saves (objDag)[/COLOR]
            
            var objSub = {dialog.Object}.getChildObject('EMBD_SUBSCRIBERS');
            var objGen = {dialog.Object}.getChildObject('EMBD_GENERAL');
            var objDag = {dialog.object}.getChildObject('EMBD_DIAGCODES');
            
            
            if(objDag) {
            	objDag.submit();
            } else if(objGen) {
            	objGen.submit();
            } else if(objSub){
            	objSub.submit();
            }
            Code:
            [COLOR="#FF0000"]This doesn't work at all...matter-a-fact it breaks all the child components[/COLOR]
            
            var objSub = {dialog.Object}.getChildObject('EMBD_SUBSCRIBERS');
            objSub.submit();
            
            var objGen = {dialog.Object}.getChildObject('EMBD_GENERAL');
            objGen.submit();
            
            var objDag = {dialog.object}.getChildObject('EMBD_DIAGCODES');
            objDag.submit();
            Mike Brown - Contact Me
            Programmatic Technologies, LLC
            Programmatic-Technologies.com
            Independent Developer & Consultant​​

            Comment


              #7
              Re: Saving data in embedded UX component

              does anybody know the solution to mikes issue? I also have multiple child uxs and none of them save using var
              co = {dialog.object}.getChildObject('CHILDALIAS','ux');
              co.submit();
              David Brown

              Comment


                #8
                Re: Saving data in embedded UX component

                Not a lot of information to go on but I've tested this again and all looks ok. I've got a child UX embedded into a parent UX. Both data bound. I make a change to data in the child UX, then click my Parent UX button to submit the child UX using this code...

                Code:
                var cObj = {dialog.Object}.getChildObject('UXCHILDEMBEDDED');
                cObj.submit();
                So... there's probably something else involved that's not being reported in the posts. Posting an example that fails would help. Any Javascript errors? Are the embedded components rendered at the time they're submitted?
                Last edited by Davidk; 12-16-2016, 07:58 PM.

                Comment


                  #9
                  Re: Saving data in embedded UX component

                  Originally posted by David Brown View Post
                  does anybody know the solution to mikes issue? I also have multiple child uxs and none of them save using var
                  co = {dialog.object}.getChildObject('CHILDALIAS','ux');
                  co.submit();
                  I don't remember the circumstances surrounding this but I'm sure it was an error on my part. What David posted works.
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant​​

                  Comment


                    #10
                    Re: Saving data in embedded UX component

                    Thanks for the replys.

                    I got it working. At first I was using {dialog.object}.submit(); before the code which I guess was causing it not to work.
                    My code was:
                    '==================
                    {dialog.object}.submit();
                    co = {dialog.object}.getChildObject('CHILDALIAS','ux');
                    co.submit();
                    '==================

                    To get it to work I move the last two lines to a separate javascript function and set it to run after the save event.
                    David Brown

                    Comment

                    Working...
                    X