Alpha Video Training
Results 1 to 4 of 4

Thread: Hide "Add Record" option when opening a grid from Navigation

  1. #1
    Member
    Real Name
    Ken King
    Join Date
    Aug 2007
    Posts
    186

    Default Hide "Add Record" option when opening a grid from Navigation

    I want to Allow Insert (show "Add Record") when opening a grid in a Row Expander because the needed Client_ID automatically gets filled in with with the relationship to the master grid.

    I don't want to Allow Insert (need to hide "Add Record") when the grid is open from a Navigation menu. Adding a record then would set the Client_ID to zero, which is not good.

    If the Navigation passed in a session variable, is there a way to hide or show the "Add Record" option at the bottom of the grid?

    Right now I create a grid and save it as grid1 then uncheck Allow Insert and Save As grid1_noinsert. Is there a better way?

    Thanks.

  2. #2
    Guest
    Real Name
    Rod McLeish
    Join Date
    Aug 2006
    Posts
    30

    Default Re: Hide "Add Record" option when opening a grid from Navigation

    Ken,

    This can be done in the OnGridExecute event. What I would suggest is just put in debug(1) and explore everything in the e variable.

    But this is what I did in a one of my grids that I am still building:
    Code:
    dim result as SQL::resultset
    dim args as SQL::arguments
    connect = "SIS"
    if eval_valid("session.__protected__userid")
    	args.add("userid",session.__protected__userid)
    else
    	args.add("userid",3)
    end if		
    sqlquery = "SELECT persinfo FROM checklist WHERE user_iduser = :userid"
    result = SQLfunction(connect, sqlquery, args)	
    if result.data("persinfo") = .t.
    	e.tmpl.edit.number_of_insert_rows = 0
    end if
    The e.tmpl.edit.number_of_insert_rows = 0 turns off the add function.

    Rod

  3. #3
    Member
    Real Name
    Ken King
    Join Date
    Aug 2007
    Posts
    186

    Default Re: Hide "Add Record" option when opening a grid from Navigation

    Thanks for the response.

    Code:
    e.tmpl.edit.number_of_insert_rows = 0
    This works great if I was inserting records within the grid. I'm adding record with a Detail View so will need to hide the "New Record" option at the bottom of the screen.

    Any ideas what that line of code would be?

  4. #4
    "Certified" Alphaholic mmaisterrena's Avatar
    Real Name
    Mauricio Maisterrena
    Join Date
    Nov 2006
    Location
    Torreon, Mexico
    Posts
    1,435

    Default Re: Hide "Add Record" option when opening a grid from Navigation

    this is an idea using the language definition
    in the new record label put something like <a5:r>new</a5:r> then yo can define 1 dummy language with
    new=Add new record
    and a 2nd dummy language with something like
    new=.
    and use the language definition variable to switch between dummy1 and dummy2 languages

    I do think there should be better methods to achieve this but this is one option
    Last edited by mmaisterrena; 04-02-2010 at 04:14 PM.
    Cheers
    Mauricio


Similar Threads

  1. Option to "Clear grid when no search active"
    By ChristopherG in forum Archived Wishlist
    Replies: 2
    Last Post: 02-10-2010, 10:05 AM
  2. "Add" and "Save" buttons don't stay on "Self" page
    By Scholin in forum Application Server Version 8
    Replies: 2
    Last Post: 02-05-2008, 08:50 AM
  3. Dialog vs "Add Record Only" Grid (pros & cons)
    By jeffw85 in forum Web Application Server v7
    Replies: 3
    Last Post: 02-08-2007, 05:13 PM
  4. "Next record" form navigation button annoyance
    By brett s in forum Alpha Five Version 7
    Replies: 30
    Last Post: 05-07-2006, 07:23 PM
  5. UI - Hide the "add new records link label"
    By Steve Wood in forum Archived Wishlist
    Replies: 0
    Last Post: 12-30-2005, 10:21 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
  •