View all but only edit yours

Tips submitted by ASPMaker users

View all but only edit yours

Postby ready4data » Thu Jun 07, 2012 7:36 pm

Using the server events, here is a way to hide the edit/copy/delete icons(in the Graphical extension) for records that are not entered by the current user.
This still lets them view all the records but only modify their own.
I have a field(InputBy) in a table(History) that is autofilled with each new record added. It is the user name of the logged in user.
Then in Server events>List Page>ListOptions_Rendered, I entered the following:
If History.InputBy.CurrentValue = CurrentUserName() Then
ListOptions.GetItem("view").Header = "View" 'column header text
ListOptions.GetItem("view").CssStyle = "text-align:center;"
ListOptions.GetItem("edit").Header = "Edit" 'column header text
ListOptions.GetItem("edit").CssStyle = "text-align:center;"
ListOptions.GetItem("copy").Header = "Copy" 'column header text
ListOptions.GetItem("copy").CssStyle = "text-align:center;"
ListOptions.GetItem("delete").Header = "Delete" 'column header text
ListOptions.GetItem("delete").CssStyle = "text-align:center;"
Else
ListOptions.GetItem("view").Header = "View"
ListOptions.GetItem("view").CssStyle = "text-align:center;"
ListOptions.GetItem("edit").Header = "Edit"
ListOptions.GetItem("edit").Body = "" 'removes the edit icon
ListOptions.GetItem("copy").Header = "Copy"
ListOptions.GetItem("copy").Body = "" 'removes the copy icon
ListOptions.GetItem("delete").Header = "Delete"
ListOptions.GetItem("delete").CssStyle = "text-align:center;"
ListOptions.GetItem("delete").Body = "" 'removes the delete icon
End If

Scott
ready4data
 

Re: View all but only edit yours

Postby GGavan » Sat Mar 02, 2013 6:58 pm

Great trick!
Thx!
GGavan
 
Posts: 12
Joined: Mon Nov 26, 2012 12:46 am


Return to User Submitted Tips (ASPMaker)