Alpha Video Training
Results 1 to 6 of 6

Thread: Grid row number vs. selected row number

  1. #1
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,557

    Default Grid row number vs. selected row number

    I have a button in the grid row. Clicking on the button returns the selected row number or nothing if a row has not been selected.
    So to get the desired results, one needs to select the row first and then click on the button.

    Is there a method that will return the row number of the button that was clicked.

    This grid does not have a dialog attached.

    Thanks
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  2. #2
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,255

    Default Re: Grid row number vs. selected row number

    {Grid.RowNumber}
    Gets replaced with the row number of the Grid in which the Javascript is inserted. For new record rows, negative numbers are used. For example, the 2nd new record row is -2.

  3. #3
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,557

    Default Re: Grid row number vs. selected row number

    I have the following code in the Client-side canRowDelete event:

    Code:
    var rn = {grid.Object}._selectedRow;
    
    if(rn == 1){
    	alert('Sorry... can Not Delete All Service Note Entries.\nAt Least One Service Note Must Exist.');
    	return false;
    }else{
    	return true;
    }
    This works fine if the user clicks on a row and then clicks on the Delete Icon.
    The problem is when the user clicks on the delete icon of a un-selected row.

    How can I get the row number of the row the user clicked on.
    I looked on the message board and I can't find a solution that works.
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  4. #4
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,255

    Default Re: Grid row number vs. selected row number

    Hi Ronald,

    I just went through this a couple days ago.

    Try using var rn = {Grid.RowNumber}; instead of var rn = {grid.Object}._selectedRow;

    It worked for me.

  5. #5
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,557

    Default Re: Grid row number vs. selected row number

    I've tried that myself and it bombs.
    I found others on this board had the same results.
    Returns error: GRID1_GridObj is undefined.

    This is version 11, build 3381.
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  6. #6
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,557

    Default Re: Grid row number vs. selected row number

    I figured it out. I was using a Delete icon defined in the update properties. Then I was trying to get the current row in the client side canDeleteEvent. {Grid.RowNumber} is not available in the event. I watched a version 11 video which nudged me into a different direction. I set the Delete icon to 'none' and put an image in the grid, my Delete icon. Now using javascript in the OnClick event, {Grid.RowNumber} was available. Works perfectly.
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

Similar Threads

  1. Grid: how can I show/hide a buttom based on the number selected checkbox rows ?
    By jcarrallo in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 10-20-2015, 01:06 PM
  2. Cannot create text watermark if HTML5 is selected as "number"
    By eswindhauser in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 01-21-2015, 07:58 PM
  3. searching for partial number in number field
    By Jay Talbott in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 06-26-2012, 08:53 AM
  4. How do I format a number with a Zero pad in front of the number?
    By Julie in forum Application Server Version 9 - Web/Browser Applications
    Replies: 6
    Last Post: 11-19-2008, 05:18 PM
  5. Negative Number Instead of Positive Number
    By forskare in forum Alpha Five Version 4
    Replies: 3
    Last Post: 01-02-2002, 08:28 AM

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
  •