Rick
Rick

Reputation: 1311

Initialize new screen

I just created a new screen (gridview) with large number of columns. And I want to setup my columns run-time during the initialization.

using System;
using PX.Data;
using PX.Objects.IN;

namespace MyNameSpace
{
  public class MyNewGraph : PXGraph<MyNewGraph>
  {

    public override void Initialize()
    {
        base.Initialize();
    }
}

It doesn't seems to recognise the Initialise method and I'm getting "no suitable method found to override". Is it because it's a new graph and not a graph extension ? So which method should I call instead ? And secondly, because I'm setting the column title:

PXUIFieldAttribute.SetDisplayName<MyTable1.field1 >(cache,"My title"); 

How do I get the PXCache variable ? It's available in RowSelected event as an argument. But not in Initialise().

Thanks !

Upvotes: 1

Views: 678

Answers (1)

Brendan
Brendan

Reputation: 5623

Initialize is available when doing a graph extension. From your example you are defining a new graph. You should be able to simply call SetDisplayName from the new graph class constructor. The cache you can access based on your view.

public class MyNewGraph : PXGraph<MyNewGraph>
{
    public PXSelect<MyTable1> MyView;

    public MyNewGraph()
    {
        PXUIFieldAttribute.SetDisplayName<MyTable1.field1 >(MyView.Cache,"My title"); 
    }
}

Upvotes: 2

Related Questions