Right-Click menu on unbound grid

Is there any way to add right-click functionality through code to a grid or dataset to get context menu functionality in an ultragrid if the data is not bound to a dataview?

i am attaching non-BAQ datasets to an ultragrid without storing the data and it would be nice to still have the right-click functionality.

Thanks!
Ross

Thanks, Theodore.

This looks perfect for existing field names.

What if my data in the grid column is called ParentJobNumber from a dataset? Is there any way to map this back to JobHead.JobNum?

Regards,
Ross

I believe so, I’m not sure of the full column name is it a calculated column in a BAQ or what is ParentJobNumber? How is the grid being populated?

I am drawing the data from a stored procedure and attaching it via ultragrid.Datasource in a custom form. Everything works perfectly but I don’t have any right-click functionality, which I understand, I was just wondering if there was a way to point a custom column to an existing context like the following:

Ultragrid.Rows.Column(“ParentJobNumber”) = JobHead.JobNum. I know this syntax isn’t correct, it is just to illustrate the idea.

Thanks,
Ross

Why not use a BAQ, then in the form customization create a BAQView and bind this to your grid. Then you can use the example a referenced above.

1 Like

BAQView as @tkoch recommends or even a custom EpiDataView, you should try to use the “EpiMagic” whenever possible. You get a bunch of “free” help with that including right click menus

I agree and wanted to do it that way but I couldn’t get it done with a BAQ. Creating a Epidataview is a good idea. Can I just pin a custom datasource to that and go with it?

Ross

Enjoy
http://trigemco.com/add-a-custom-epidataview-in-an-epicor-customization/

Thanks, Jose. I appreciate it.

Ross

One more thing…in this case, how do I align the ParentJobNumber column on the incoming dataset with the JobHead.JobNum context right-click function on the dataview?

I see that I can bind the dt to the dv and tie that to the ultragrid for continuity but I don’t see how to get the right-click to tie in.

Thanks,
Ross

call the extended properties of the newly created epidataview.

Change code accordingly .

EpiDataView Newedv_CaseReporting = ((EpiDataView)(Script.oTrans.EpiDataViews["edv_CaseReporting"]));
// End Wizard Added EpiDataView Initialization

// Begin Wizard Added Conditional Block
if (Newedv_CaseReporting.dataView.Table.Columns.Contains("Calculated_JobNum"))
{
	// Begin Wizard Added ExtendedProperty Settings: edvedv_CaseReporting-Calculated_JobNum
	Newedv_CaseReporting.dataView.Table.Columns["Calculated_JobNum"].ExtendedProperties["Like"] = "JobHead.JobNum";
	
}
2 Likes

Set the ExtendedProperty in the column to have a Like value of Jobhead.JobNum

Okay, thank you!

Ross

1 Like

Jose,

Once this dataview is created from the empty row datatable in Initialize Custom Code, how do I dynamically populate it in my subroutines?

I thought I could just fill the dt as I am and it would present in the dv but it is not. Do you I need to iterate through and populate the dataview that way? Sorry I am being so slow with this…

Otherwise, it looks like the perfect solution. I have the DataView bound to the grid and the properties set I just need to populate the DataView on retrieve from the incoming dataset.

Thanks,
Ross

You should be able to fill in the datatable with data and as long as the data table is the one you bound to the dataView property in the EpiDataView it should just work.

Okay, thanks. I was calling a method that returned a datatable to my dv datatable and it didn’t work.

I changed the called method to directly add it to the dv datatable and it works now.

I appreciate your help.

Thanks,
Ross

Just to clarify another feature that many people don’t know about with BAQs… you can redefine the “Like” attribute on any field within a BAQ - even calculated fields.
Below is an example where I defined a calculated field to be “Like” an OrderHed.OrderNum… when this BAQ is later run, you can right-click in the field, and it will automagically allow the Open With dialog. This has proved very useful with some advanced BAQs & Dashboards.

4 Likes

Hello Tim Sir,

This really helped. It has made very easy and this even works for External BAQs.

Thank You.
Hanky