Alpha Video Training
Results 1 to 5 of 5

Thread: Javascript - setSelectedRow()

  1. #1
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,605

    Default Javascript - setSelectedRow()

    Using the grid's AfterInsertRecord event, I want to set the grid's focus on the new record. So:

    Code:
    '//Set focus to the last row in the Grid (not including new record rows).
    jtxt = <<%a%
    var rowNum = {grid.object}._rowsInGrid;
    {grid.Object}.setSelectedRow(rowNum)
    %a%
    
    aa = e.rtc.A_AjaxResponses
    aa[].text = jtxt
    aa[..].id = 1
    But, this always sets the focus on the next-to-last record. If I add one with this or any variation:

    Code:
    var rowNum = {grid.object}._rowsInGrid + 1;
    the focus just gets set to the first record in the grid.

    Anyone know what I'm missing?

    I've also tried the {grid.Object}.setFocus(rowNum) function but to no avail, and I'm not sure I see the difference between the two.
    -Steve


  2. #2
    "Certified" Alphaholic Scott Emerick's Avatar
    Real Name
    Scott Emerick
    Join Date
    Dec 2000
    Location
    Central Virginia/ North Carolina Border
    Posts
    2,154

    Default Re: Javascript - setSelectedRow()

    Steve,

    Isn't the new record rows -1, -2, ect. ?

    Scott

  3. #3
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,605

    Default Re: Javascript - setSelectedRow()

    The new record, until committed, is -1, I agree. But I'm doing this on the AfterInsert event which moves it to a positive row number, no?
    -Steve


  4. #4
    "Certified" Alphaholic Scott Emerick's Avatar
    Real Name
    Scott Emerick
    Join Date
    Dec 2000
    Location
    Central Virginia/ North Carolina Border
    Posts
    2,154

    Default Re: Javascript - setSelectedRow()

    my bad .. I misread your post .. yes it would be a positive number after it is inserted

    Sounds like a possible timing issue ???

  5. #5
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,605

    Default Re: Javascript - setSelectedRow()

    Well, yes, could be a timing issue. So, how to commit a record in a tabular grid, and then set focus to it? I ain't succeeding.
    -Steve


Similar Threads

  1. Javascript to open Row Expander and show specific grid
    By iviowa in forum Application Server Version 10 - Web/Browser Applications
    Replies: 4
    Last Post: 11-08-2013, 03:20 PM
  2. {grid.object}.setSelectedRow
    By envisionsolutions in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 10-21-2010, 07:21 PM
  3. Action JavaScript not available in Grid Javascript function declarations
    By Clipper87 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 09-23-2010, 11:22 AM
  4. JavaScript
    By DOntquIT in forum Application Server Version 9 - Web/Browser Applications
    Replies: 5
    Last Post: 07-29-2008, 06:00 AM
  5. Mixing javascript and Xbasic and other javascript questions ...
    By drgarytraub in forum Application Server Version 9 - Web/Browser Applications
    Replies: 4
    Last Post: 07-08-2008, 07:15 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
  •