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

State variables not work

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

    State variables not work

    Hi,
    I have a problem with state variables. I want to set e._state.myvar = val on OnGridExecute server side event. Debugging I can see that myvar get the value of val. When I try to retrieve the value of myvar with e.__si2.myvar (in ajax callback function) always I find the first value.

    Thanks.

    #2
    Re: State variables not work

    Any idea, please?

    Comment


      #3
      Re: State variables not work

      If I understand this correctly, you're trying to get something from the e object in javascript? The e object is on the server side - not the client side.

      To get the value of a state variable in javascript, use other functions.
      Code:
      //Get the state info as a string of name value pairs
      var stateData = {dialog.object}.getStateInfo();
      
      //Read the 'myvar1' property from the state info object
      var x = {dialog.object}.stateInfo['myvar1'];
      
      //You can also set a property in the state info object directly. 
      {dialog.object}.stateInfo['myvar1'] = 'alpha';
      -Steve
      sigpic

      Comment


        #4
        Re: State variables not work

        In fact the problem is the follow:

        I have a grid with 2 columns "id_parent" and "name". This grid has a linking grid related by parent.id_parent = child.id_parent
        Child grid execute 2 actions:
        1. Edit records - (opens a dialog to edit record) - it's working good because child grid has id_parent column
        2. Create new record - it's not working because I don't have the id_parent

        I try to use a session variable, that I initialize it on child grid on onGridExecute server side event

        if variable_exists("e.tmpl.linkDefinition") then
        dim tmp as c = e.tmpl.linkDefinition
        tmp = stritran(tmp, ")")
        tmp = word(tmp,3,"|")
        e._state.IdDevizObiect = tmp
        end if


        Every time that grid parent row changes initialize e._state.IdDevizObiect variable.
        The child grid has a button to create the new record. When I click it I call the following javascript function to show the edit form. This function receive a parameter that override the session variable that I retrieve on edit form

        window['CreazaDevizNou'] = function(objEle, IdDeviz) {

        var rowNum = {grid.object}._selectedRow;
        var rowId = $u.s.tran(rowNum,'-','_');


        var rowNum = {grid.object}._selectedRow;
        var rowId = $u.s.tran(rowNum,'-','_');

        var windowName = 'WINDOW_fba3672e_b3a0_4b4b_986f_3e02a6baafc8';
        var currWindow = {Grid.object}.getWindow(windowName);
        var go = new Object();
        go.objectId = objEle.id;
        go.dialog2Name = 'deviz_reabilitare_termica_atribute';
        go.type = 'dialog2';
        go.alias = 'DEVIZ_REABILITARE_TERMICA_ATRIBUTE';
        go.submitCurrentFieldValues = true;
        go.sourceGridPart = 'G';
        go.sourceGridRowNumber = rowNum;
        go.workingMessage = '<img src=\'CSS/A5System/images/wait.gif\' />Asteapta...';
        go.placeholderValues = '';
        go.argumentBinding = '';

        go._thisGridAlias = {grid.object}.gridId;
        if(typeof {grid.object}.gridId != 'undefined') go._thisGridAlias = {grid.object}.gridId;
        if(typeof {grid.object}.dialogId != 'undefined') {
        go._thisGridAlias = {grid.object}.dialogId;
        }

        go._thisGridGUID = {grid.object}.componentGUID;
        go._gridCurrentFilter = {grid.object}._gridFilter;

        go._gridCurrentOrder = {grid.object}._gridOrder;
        go._gridCurrentArguments = {grid.object}._gridArguments;
        go._gridCurrentDBType = {grid.object}._gridDBType;
        alert(IdDeviz);
        go.overrideSettings = 'Style_name = `{Grid.style}`||Style_name = `{Grid.style}`'+'||a5SetSessionVar(`ID_DEVIZ_OBIECT`, `'+IdDeviz+'`)';
        go.a5_default_path = '{grid.defaultPath}';
        go.windowName = windowName;

        go.showWindowParameters = '\'center\'';

        if(!currWindow) {
        currWindow = {Grid.object}.createWindow(windowName,'modal-resizable',
        {
        body: {
        content: {
        type: 'blank',
        elementId: '~'
        }
        },
        height: '4in',
        width: '3in',
        title: {
        html: 'Deviz reabilitare termica<span id="DevizId"></span>',
        location: 'top',
        direction: 'ltr',
        show: true
        },
        disableMove: false,
        theme: '{Grid.style}',
        onBeforeHide: function() {
        var isDirty = window['DEVIZ_REABILITARE_TERMICA_ATRIBUTE_DlgObj']._isDirty;
        if(isDirty) {
        window['DEVIZ_REABILITARE_TERMICA_ATRIBUTE_DlgObj']._confirmAction();
        return false;
        } else return true;
        },
        onHide: function() {{grid.object}.refresh();}
        }
        );
        go.dialog2Div = currWindow.getWindowId('body');
        A5.component.runGenericComponent(go)
        setTimeout(function() { {grid.object}.blur();},100);
        currWindow.show('center');

        } else {

        var ele = 'DEVIZ_REABILITARE_TERMICA_ATRIBUTE.GRID_PART.FORM_CONTAINER_DIV';
        var pele = $(ele);
        if(pele) pele.innerHTML = '<img src=\'CSS/A5System/images/wait.gif\' /> Asteapta...';
        go.dialog2Div = currWindow.getWindowId('body');
        go.parentGridId = '{grid.componentname}';
        go.windowPositionArg1 = 'center';
        go.windowPositionArg2 = '';

        A5.component.runGenericComponent(go)
        currWindow.show('center');
        setTimeout(function() { {grid.object}.blur();},100);
        };
        }


        This is the callback function
        function CreazaDevizNou as c (e as p)
        if variable_exists("e.__si2.IdDevizObiect") then
        CreazaDevizNou = "CreazaDevizNou(this, " + e.__si2.IdDevizObiect + ");"
        end if
        end function


        On edit form on onDialogInitialize always I have the first value saved in session variable Session.ID_DEVIZ_OBIECT
        if variable_exists("Session.ID_DEVIZ_OBIECT") then
        e.control.IdDevizObiect = Session.ID_DEVIZ_OBIECT
        end if


        Is there any way to have the id_parent on edit form?

        Thanks.

        Comment


          #5
          Re: State variables not work

          A picture is worth a thousand words

          1.png

          Comment


            #6
            Re: State variables not work

            The 'Edit Form' there is it a UX?

            Comment


              #7
              Re: State variables not work

              Yes, it is.

              Comment


                #8
                Re: State variables not work

                1. Edit records - (opens a dialog to edit record) - it's working good because child grid has id_parent column
                2. Create new record - it's not working because I don't have the id_parent
                that is the way it is.
                how can you have a child record before a parent record?
                are you trying to create a child record for a non existing parent using your state info?

                I did not read the long code you posted, I want to make sure before I go ahead and look into the problem.
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: State variables not work

                  Catalin i use this method in all my grids/UX for editing / adding:

                  - for editing in my grid the key field (id) is a link, in the onClick of that link i add the action javascript "Open a UX component to add/edit a record in grid". In the action properties, i just select "edit mode" in the first property, and change the window title or size if needed

                  - for adding, i add a toolbar button to the grid, and in the onClick of that button i add the same action as above ( open ux component to add/edit..." but in the first property i select "add new record mode"

                  In my db, the ID field is int autoincrement.

                  In the UX, i set the ID field to readonly with <Auto> in the watermark so when adding people know that the id will be generated.

                  That's it...

                  Jaime

                  Comment


                    #10
                    Re: State variables not work

                    gandhi - the parent must exist. I select a parent without children and I want to create a new child. To make that I click a toolbar action button and I open the UX form to insert the data, but I don't have the id_parent

                    Bellow I put the tables:
                    Parent table:
                    CREATE TABLE `kleverdev`.`tdeviz_obiect` (
                    `IdDevizObiect` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The primary key',
                    `LogicalDelete` tinyint(1) NOT NULL DEFAULT '0',
                    `DenumireObiect` varchar(250) NOT NULL,
                    `CursValutar` double NOT NULL DEFAULT '0',
                    `TVA` double NOT NULL DEFAULT '0',
                    `DataCreare` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    `IdDevizDet` bigint(20) unsigned DEFAULT NULL,
                    PRIMARY KEY (`IdDevizObiect`)
                    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


                    Child table:
                    CREATE TABLE `kleverdev`.`tdeviz_reabilitari_termice` (
                    `IdDevizRT` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                    `LogicalDelete` tinyint(1) NOT NULL DEFAULT '0',
                    `FTick` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    `Denumire` varchar(500) NOT NULL DEFAULT '',
                    `IdDevizObiect` bigint(20) unsigned NOT NULL COMMENT 'The relation with the parent',
                    `Valoare_RON_FARA_TVA_1` double NOT NULL DEFAULT '0' COMMENT 'Studiu fezabilitate',
                    `Valoare_RON_FARA_TVA_2` double NOT NULL DEFAULT '0' COMMENT 'Proiect tehnic',
                    `Valoare_RON_FARA_TVA_3` double NOT NULL DEFAULT '0' COMMENT 'Final achizitii',
                    `IdTipProprietar` bigint(20) DEFAULT NULL,
                    `IdTipLucrari` bigint(20) DEFAULT NULL,
                    `IdDestinatieSpatiu` bigint(20) DEFAULT NULL,
                    `EligibilPentruSpatiiLocuit` tinyint(1) NOT NULL DEFAULT '0',
                    `NeeligibilPentruSpatiiLocuit` tinyint(1) NOT NULL DEFAULT '0',
                    `NeeligibilPentruSpatiiAltaDestinatie` tinyint(1) NOT NULL DEFAULT '0',
                    PRIMARY KEY (`IdDevizRT`)
                    ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='Devize reabilitari termice';


                    Jaime - as you see the child id is autoincrement but I don't have the parent id to relate the child with his parent

                    Comment


                      #11
                      Re: State variables not work

                      i will try little later and post my findings.
                      when you have a toolbar button it relates to the entire grid, nothing special about individual records in that grid. so when you press the button there is no parent meaning no individual row is selected.
                      on the other hand if you have grid row button then when you click on that the selected row can be harvested and the id of that row can be passed onto the child, see if this explanation helps.
                      if not i will post a video on a simple scenario.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      [email protected]
                      Skype:[email protected]
                      1 914 924 5171

                      Comment

                      Working...
                      X