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

external javascript and grid.object

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

    external javascript and grid.object

    I have a javascript function set in a grid's Javascript Function Declaration. Because I want to use these js functions on several grids, I want to pull it out of Grid Properties and place it in my own js file to be available to all grids. But when moved to a javascript library it complains about the {Grid.object} and {Grid.componentname} syntax, like:

    {Grid.object}._setRowState(1,true); or '{Grid.ComponentName}.V.R1.'+fieldname+''

    Now I am pretty sure I can fix this by passing the {grid.object} and {grid.componentname} in the function call from the grid, like this:

    myjsfunctioncall({Grid.object},{Grid.componentname})

    But I would rather not have to do that. Does anyone know why an externally loaded js library would act different than the same code set in the grid's Javascript Function Declaration? Is there some low-level javascript I can use to replace {Grid.object} and {Grid.componentName} in my script that would work from the external library without me having to pass it in the function call?
    Steve Wood
    See my profile on IADN


    #2
    Re: external javascript and grid.object

    I wonder if you could load the library after the grid is initialized from the grid when {Grid.object} and {Grid.componentname} have been defined.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

    Comment


      #3
      Re: external javascript and grid.object

      That's a good idea. I need to see where Alpha puts the js reference. If it is above their grid code, this may be the cause.
      Steve Wood
      See my profile on IADN

      Comment


        #4
        Re: external javascript and grid.object

        Hi Steve,

        Your original comment about passing the {grid.object} and {grid.componentname} in the function call makes the most sense to me. But rather that pass individual parameters, why don't you create a blank object, then add whatever properties are relevant. I believe this is quite a well-accepted and universal approach in Javascript.

        myObj= {}; //new object
        myObj.object={grid.object};
        myObj.componentname={grid.componentname};

        myjsfunctioncall(myObj);

        Hope this generic approach is useful,
        Andy.

        Comment


          #5
          Re: external javascript and grid.object

          I went through a lot of Alpha's own external javascript libraries, and where a grid object is required, they all take that as part of the function call. So you don't see {grid.object} in any external library, instead you see myfunction(gridobject,parentobject,childobject), etc. where the object name is passed in as text. So that is what I will do.
          Steve Wood
          See my profile on IADN

          Comment


            #6
            Re: external javascript and grid.object

            Sounds good to me Steve.
            Andy.

            Comment


              #7
              Re: external javascript and grid.object

              Sending '{Grid.ComponentName}' in the function call is working, but I still don't understand why I cannot use '{Grid.ComponentName}' in the external js library.

              If I place this in OnGridRender, it pops up an alert with the Component Name, as expected.

              alert('{grid.componentName}');

              If instead, I place this in OnGridRender

              {grid.Object}.loadJavascriptFile('mylibrary.js');
              myfunction();


              Where mylibrary.js has this:

              myfunction() {
              alert('{grid.componentName}');
              }


              Why does that fail?

              I would like to find a way to load an external javascript library in to a grid so the functions would work the same as if I had typed them in to the Grid's Javascript Functions area.
              Steve Wood
              See my profile on IADN

              Comment


                #8
                Re: external javascript and grid.object

                Steve,

                I think the loadJavascriptFile method is not loading your library; load a non existent file and you get the same error.
                Why don't you use the linked javascript file property in the grid? I tried quickly but I keep getting an error (missing ';')
                Frank

                Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                Comment


                  #9
                  Re: external javascript and grid.object

                  Could be some asynchronous issue as well, if the library is not loaded yet then your function call will fail. From the wiki:

                  or the Linked JavaScript Files property, 'file1.js' and 'file2.js' will load simultaneously. This may be fine for your needs, but if there is code in 'file2.js' that can only work if 'file1.js' has already been loaded, then the asynchronous way in which the Javascript is loaded will present a problem.

                  NOTE: The Grid, Dialog and CustomComponent all have an {object}.loadJavascriptFile() method to load a Javascript file into the DOM. This method now takes an optional second parameter - the name of a Javascript function to call once the Javascript file has been loaded. When you specify Javascript files to load using the 'Linked Javascript Files' property, this method is used to load the Javascript.

                  To solve this problem, the components allow you to specify the name of a Javascript function to call when the component has been loaded. When you specify the name of the Javascript file, you can follow the filename with an optional '|' chracter and then the name of a Javascript function.
                  Frank

                  Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                  Comment


                    #10
                    Re: external javascript and grid.object

                    It is loading the library, I left out that I tested that with an alert() in the library. I want to use an external library because I need to share the same functions across a random number of both grids and dialogs, and dont want to have to repeat the same code in each Javascript property area.
                    Steve Wood
                    See my profile on IADN

                    Comment


                      #11
                      Re: external javascript and grid.object

                      Frank,

                      I will try the second parameter as you suggest.
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #12
                        Re: external javascript and grid.object

                        Steve I mean this:

                        ljs.png
                        Frank

                        Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                        Comment


                          #13
                          Re: external javascript and grid.object

                          I have mylibrary.js containing:

                          function myfunction() {
                          alert('test');
                          }

                          If I put this in Javascript Linked Files: mylibrary.js|myfunction

                          myfunction does not get called; I have to put the function in the Grid's javascript function declarations: that is not what the wiki says.
                          If I put it in the grid's function declarations then it executes twice
                          Last edited by Clipper87; 02-04-2012, 07:30 AM.
                          Frank

                          Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                          Comment


                            #14
                            Re: external javascript and grid.object

                            Originally posted by Clipper87 View Post
                            Steve I mean this:

                            [ATTACH=CONFIG]30776[/ATTACH]
                            in your picture you show

                            Code:
                            mylibrary.js|myFunction()
                            this is wrong. it should be:

                            Code:
                            mylibrary.js|myFunction

                            Comment


                              #15
                              Re: external javascript and grid.object

                              I know but it does not work either
                              Frank

                              Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                              Comment

                              Working...
                              X