Clear Grid function in Customization

Hi ! I wish to do a customization for my dashboard, which will print a label and then clear the grid. I have issue in clear the grid. I coded “myGrid.datasource = null”, then it does clear everything including column headers.

Is there another method to clear the grid without clearing its column headers?




If you are using EpiUltraGrid then you need to clear DataSource of that EpiUltraGrid.
For example:

DataTable dtInvInfo;
private void LoadUltraGridInvInfo ()
	/*--Logic to fill datatable-- DN*/
	dtInvInfo = new DataTable ();
	UltraGridInvInfo.DataSource = dtInvInfo;

private void ClearUltraGridInvInfo ()
	if (dtInvInfo.Rows.Count > 0)
		dtInvInfo.Rows.Clear ();

Thanks and Regards
Dnyanraj Patil

add a ud field to denote printed, rowrule to hide the row?

Hi ! I’ve added this line of code but I got an error as below;

‘Infragistics.Win.UltraWinGrid.RowsCollection’ does not contain a definition for ‘Clear’ and no extension method ‘Clear’ accepting a first argument of type ‘Infragistics.Win.UltraWinGrid.RowsCollection’ could be found (are you missing a using directive or an assembly reference?)’

It seems I missed an assembly reference. May I know which one should I add in?

Clearing the grid is not really the appropriate action here you are breaking the Epicor Binding.
Have you considered @Chris_Conn 's suggestion of adding a row rule or a filter the grid to hide the rows as they print?

Another option is to flag a field when the label prints which automatically removes it from your BAQ. Then refresh your dashboard.

Hi !

I’ve tried to add these methods, and put into button method to call these methods when the button is clicked.

It did clear all the rows, but it will clear the columns also. When I refresh the dashboard, the columns will come out again but it will lose its initial column properties (bold text, wrap text).

Am I missing something in it?

Does it mean I have to create a foreach loop to hide all the rows?

Hi ! I’m trying on @Chris_Conn suggestion. I attempt to create a foreach loop to hide / remove the rows in the grid. I will update the result here.

No loop is needed simply create a filter rule on the dashboard to not show the stuff that was printed.
Mark stuff printed as you run your label.

Sorry that I did not explain my objective clearly. Before users print the label in dashboard, users will call out a list of item and then select one of them to print out. My attempt is once users click on “Print” button, it will clear all the rows in the grid. We require users to input criteria and refresh if they want to print next label.

Therefore, if I got to use filter rule to hide all the rows in dashboard, I may need to use a loop to set all the rows hidden so it seems clear all the rows.

Am I missing a method that can hide all rows in one time?

I see, why don’t you just call Clear Tool instead in the dashboard?

Do you mean that we could call Clear Tool method in customization? I was trying to look for the code but so far I didn’t find any of it. I agree with you that this is the proper way to do that. I will continue to search for it. Let me know if you have the code, I would really appreciate it !