Skip to main content
Solved

Cannot select text in a grid cell to copy to clipboard on a processing screen grid

  • November 17, 2024
  • 2 replies
  • 25 views

Joe Schmucker
Captain II
Forum|alt.badge.img+2

I made a processing screen.  In the grid, the file name is not selectable because it is read only (Inquire skin).

I want the user to be able to copy the file name into their clipboard.  I’ve tried every trick I know and I cannot find a way to make that field so that you can select the text in it.  I’ve tried enabling the cache for the grid, enabling the FileName field in the grid, adding the field to the Fields in the project editor.

 

 

The reason this is important is that there might be 40 revisions of the same file and by copying/pasting the file name into the filter will limit the view to just those files/revisions.

For example, I want to put “SO Import Sales Order Template.xlsx into the filter but I don’t want the user to have to type the name.

I created a work around by creating an action to get the current row and set the file name in the filter to the file name in the grid.

protected virtual IEnumerable copyFileName(PXAdapter adapter)
{
    UploadFileRevision ufr = (UploadFileRevision)FilesToDelete.Current;
    if (ufr == null) return adapter.Get();

    ICSUploadFileRevisionExt ext = ufr.GetExtension<ICSUploadFileRevisionExt>();
    if (ext == null) return adapter.Get();

    UploadFile uf = SelectFrom<UploadFile>.Where<UploadFile.fileID.IsEqual<@P.AsGuid>>.View.Select(this, ufr.FileID);
    if (uf == null) return adapter.Get();

    if (ext.Selected != true)
    {
        string message = string.Format(ICSMessages.MustSelectRow);

        throw new PXSetPropertyException(null, ICSMessages.MustSelectRow);
    }

    int startNumber = 0;
    startNumber = uf.Name.LastIndexOf("\\");
    if (startNumber == -1)
    {
        Filter.Current.FileNameSearch = uf.Name;
    }
    else
    {
        Filter.Current.FileNameSearch = uf.Name.Substring(startNumber + 1);
    }
    return adapter.Get();
}

This code will copy the file name to the filter.  But the row has to be checked to do it.

Clicking COPY FILE NAME action results in this.  Which is what I want.

 

What I don’t like about this is that the Current record of the grid is only “Current” if you click the Select checkbox.  

If there is a disabled field in the header (filter), you can still select and copy the text from the field.

This seems like a lot of work to simply copy the text from a cell in the grid.

Any other ideas on how to make the File Name in the grid “selectable text”?  

 

Best answer by darylbowman

You can copy most grid cells by simply selecting the cell and using Ctrl + C (enabled or not). Have you tried that?

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

2 replies

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1715 replies
  • Answer
  • November 18, 2024

You can copy most grid cells by simply selecting the cell and using Ctrl + C (enabled or not). Have you tried that?


Joe Schmucker
Captain II
Forum|alt.badge.img+2
  • Author
  • Captain II
  • 455 replies
  • November 18, 2024

@darylbowman Of course not...why would I try something obvious before spending an hour writing custom code??? 

 

OMG.  Thanks Daryl.  Let me remove all my work from my project now.  😀


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