Skip to main content
Solved

Adding hyperlink to grid gives disabled error

  • May 5, 2022
  • 1 reply
  • 174 views

Forum|alt.badge.img+6

I have added a view (ContractDetails) in a BusinessAccountMaint extension.  One of the columns contains a Vendor Number and I would like to add a hyperlink on that column to make the related vendor number appear in a popup window.  The Vendor Number column is defined as follows, it is just a lookup field.


    #region UsrVendor
    [PXString(15)]
    [PXUIField(DisplayName="Vendor", Enabled=false)]
    [PXDBScalar(typeof(Search2<BAccount.acctCD
     ,InnerJoin<POVendorInventory, On<POVendorInventory.vendorID, Equal<BAccount.bAccountID>>
     ,InnerJoin<ContractItem, On<ContractItem.recurringItemID, Equal<POVendorInventory.inventoryID>>>>
     ,Where<ContractItem.contractItemID, Equal<ContractDetail.contractItemID>>
     >)
    )]

    public virtual string UsrVendor { get; set; }
    public abstract class usrVendor : PX.Data.BQL.BqlString.Field<usrVendor> { }
    #endregion

Here is my code for the hyperlink and popup window. I’ve added ViewVendor in the column’s LinkCommand.

    public PXAction<Vendor> ViewVendor;
    [PXUIField(DisplayName = "", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = true, Visible = false)]
    [PXEditDetailButton]
    public virtual IEnumerable viewVendor(PXAdapter adapter)
    {


      if (ContractDetails.Current != null)
      {
        ContractDetailExt contractDetailExt = ContractDetails.Current.GetExtension<ContractDetailExt>();

        VendorMaint docgraph = PXGraph.CreateInstance<VendorMaint>();

        docgraph.CurrentVendor.Current = Vendor.UK.Find(docgraph, contractDetailExt.UsrVendor);

        if (docgraph.CurrentVendor.Current != null)
          {
            throw new PXRedirectRequiredException(docgraph, true, "Vendors") { Mode = PXBaseRedirectException.WindowMode.NewWindow };
          }

      }
      return adapter.Get();
    }

However, when I click on the Vendor # I get a message:

Error: The View Vendor button is disabled.

And based on PXTrace messages, none of the code is being run.

What might I be missing?

Best answer by Shawn Burt

what is the primary view of the screen in question?

normally the pxaction is set to match, e.g. even if it is used to view a Vendor that doesn’t mean the declare is <Vendor> it should be the primary view type of the graph. 

Also not sure what [PXEditDetailButton] attribute is, but it could be setting the button to disabled.

you might use PXButton instead.

View original
Did this topic help you find an answer to your question?

1 reply

Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 109 replies
  • Answer
  • May 5, 2022

what is the primary view of the screen in question?

normally the pxaction is set to match, e.g. even if it is used to view a Vendor that doesn’t mean the declare is <Vendor> it should be the primary view type of the graph. 

Also not sure what [PXEditDetailButton] attribute is, but it could be setting the button to disabled.

you might use PXButton instead.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings