Alpha Video Training
Results 1 to 8 of 8

Thread: {grid.object}.setSelectedRow

  1. #1
    Member
    Real Name
    Josh Cole
    Join Date
    Nov 2009
    Posts
    296

    Default {grid.object}.setSelectedRow

    I have a form and I have a few fields that are auto-filled after a lookup is done on the first. What I'd like to do next is to activate the next field on the form that information needs to be entered into. Has anyone used this javascript function to accomplish this? Should it look something like this?

    {grid.object}.setSelectedRow(-4);

    -4 representing the row/field I want to activate. Does grid.object need to be the name of the grid?

  2. #2
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,298

    Default Re: {grid.object}.setSelectedRow

    Quote Originally Posted by envisionsolutions View Post
    I have a form and I have a few fields that are auto-filled after a lookup is done on the first. What I'd like to do next is to activate the next field on the form that information needs to be entered into. Has anyone used this javascript function to accomplish this? Should it look something like this?

    {grid.object}.setSelectedRow(-4);

    -4 representing the row/field I want to activate. Does grid.object need to be the name of the grid?
    {grid.object} will automatically get replaced with the actual grid object name when the grid is rendered.

    however, .setSelectedRow(-4) will give focus to the first editable field on the 4th new record row. this does not sound anything like what you have said you want to do.

    you want to give focus to a particular field in the current grid row.

    you would need code something like this:



    Code:
    var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.FIRSTNAME').focus();

  3. #3
    Member
    Real Name
    Josh Cole
    Join Date
    Nov 2009
    Posts
    296

    Default Re: {grid.object}.setSelectedRow

    Selwyn, thank you. I am still having a problem.

    FirstName is the field I am giving focus to am I correct? I added this to the onchange event inside the auto-suggest control where the client's id is selected. When I created the actionscript, I selected inline javascript, pasted this in there and saved/published. I don't receive any errors but it does not set focus to the field after selecting the ID in the auto suggest control.
    Last edited by envisionsolutions; 10-21-2010 at 05:21 PM.

  4. #4
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,298

    Default Re: {grid.object}.setSelectedRow

    Quote Originally Posted by envisionsolutions View Post
    Selwyn, thank you. I am still having a problem.

    FirstName is the field I am giving focus to am I correct? I added this to the onchange event inside the auto-suggest control where the client's id is selected. When I created the actionscript, I selected inline javascript, pasted this in there and saved/published. I don't receive any errors but it does not set focus to the field after selecting the ID in the auto suggest control.
    can you show the exact javascript.

    javascript is case sensitive. we use upper case for all object names. so if you wanted to set focus to the 'FirstName' field, then you would specify the object Id using 'FIRSTNAME'

  5. #5
    Member
    Real Name
    Josh Cole
    Join Date
    Nov 2009
    Posts
    296

    Default Re: {grid.object}.setSelectedRow

    var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DESCRIPTION').focus();

    The firstname field is where my auto-suggest control. The user selects the requestor and then I would like to set focus on the description field because the lookup definition is set to fill in the fields between Firstname and Description. I attached a ss as well.

  6. #6
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,298

    Default Re: {grid.object}.setSelectedRow

    Quote Originally Posted by envisionsolutions View Post
    var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DESCRIPTION').focus();

    The firstname field is where my auto-suggest control. The user selects the requestor and then I would like to set focus on the description field because the lookup definition is set to fill in the fields between Firstname and Description. I attached a ss as well.
    this does not look right

    this would be correct:

    Code:
    var ele = $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DESCRIPTION');
    ele.focus();
    or more simply

    Code:
    $('{grid.componentname}.V.R'+{grid.object}._selectedRow+'.DESCRIPTION').focus();

  7. #7
    Member
    Real Name
    Josh Cole
    Join Date
    Nov 2009
    Posts
    296

    Default Re: {grid.object}.setSelectedRow

    I am not sure why but it is not working. The lookup and the fill-in of the fields happens but it does not set focus to the Description field after the onchange event occurs. I know you know what you are doing so it must be something I am doing wrong. Could it have something to do with trying to run this script in unison with the auto-suggest lookup?

  8. #8
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,298

    Default Re: {grid.object}.setSelectedRow

    Quote Originally Posted by envisionsolutions View Post
    I am not sure why but it is not working. The lookup and the fill-in of the fields happens but it does not set focus to the Description field after the onchange event occurs. I know you know what you are doing so it must be something I am doing wrong. Could it have something to do with trying to run this script in unison with the auto-suggest lookup?

    Here is what I understand you want:

    1. user makes a selection from an auto-suggest field.
    2. you want focus to then automatically move to another control on the grid.

    3. to achieve this you have put code in the onChange event.

    unfortunately, this will not work because the onchange event actually fires BEFORE the selection is made from the auto-suggest list. (it fires when you start typing into the field to trigger the callback that displays the list).


    then, when the user makes his selection, the field is populated, but there are no events that fire that you can hook.

    we would have to add a new property to the auto-suggest lookup to allow you to specify your own onSelection event.

    this is not something we are currently planning on doing as there are other priorities. It certainly could be done, and if it is very important to you, please contact our professional services group.


    Addendum to message - 10/22/2010 - I have just added this new property to the auto-suggest control and the edit combo control in the Grid component.
    It will be in the next update.




    Grid Component - Edit-Combo and Auto-Suggest Controls - AfterSelect Javascript - These two controls now allow you to specify any Javascript to execute after the user has made a selection from the list. For example, the following Javascript shows how you can automatically set focus to the 'Company' field in the Grid after the user has made a selection from the list.

    var rowNumber = {grid.object}._selectedRow;
    var ele = $('{grid.componentname}.V.R' + rowNumber + '.COMPANY');
    ele.focus();
    Last edited by Selwyn Rabins; 10-22-2010 at 01:26 PM.

Similar Threads

  1. {grid.Object}.refresh() w/o confirmation
    By Steve Workings in forum Application Server Version 10 - Web/Browser Applications
    Replies: 18
    Last Post: 08-28-2018, 06:03 PM
  2. {grid.Object}.refreshRow(rowNum)
    By Peter.Greulich in forum Application Server Version 10 - Web/Browser Applications
    Replies: 21
    Last Post: 06-05-2012, 02:47 AM
  3. {grid.Object}.pageNavigate('next')
    By Toby Locke in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 10-18-2010, 05:20 AM
  4. {grid.object}.methodName(); AND '{grid.object}' i
    By NicholasWieland in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 02-15-2010, 04:33 PM
  5. {grid.Object}._setValue not working?
    By GarthMc in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 01-12-2010, 05:56 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
  •