Anyone ever add a Check All button to check all checkboxes?

Anyone ever add a Check All button to check all checkboxes in an updateable dashboard’s grid view? I want to check all JobHead.Checkbox06 when clicking the button that I have placed in my tracker. VB please if this is possible.

Thanks,
Chris

Since your name is Chris… I think @Chris_Conn has done something similar.

1 Like

That would be great!

Yep, I have. Give me a bit…

Well here is the brief version. It’s relatively simple, it just requires a customization on a dashboard - preferably a “SmartClient” assembly.

You just get a ref to the grid by gettings it’s GUID. Then using:

var myGrid = (WhateverTypeItIsHere)csm.GetNativeControlReference("the GUID here");


//You'll iterate all the rows and check\uncheck them... but also rememeber to dirty them with RowMod
foreach(var row in myGrid.Rows)
{
  row.Cells["MyColName"].Value = true;  
  row.Cells["RowMod"].Value = "U";
}

//You can also do it by using just the epiDataView that feeds the grid (look at it's EpiBinding):
var myEDV = oTrans.Factory("TheDataViewName")
foreach(var row in myEDV.dataView)
{
row["MyColName"] = true;
row["RowMod"] = "U";
}

//finally, notify the UI (you can target the exact one, or use a shotgun blast as shown below):
oTrans.NotifyAll();
3 Likes

this is one method i use in some cases for select all, clear all. It will also work with groupings as those introduce some variability. I have since learned a better way (shown to me by another knowledgeable colleague). For your reference;

private void btnSelectAll_Click(object sender, System.EventArgs args)
    {
        ChangeAll(myGrid.Rows, true);
    }

    private void btnClearAll_Click(object sender, System.EventArgs args)
    {
        ChangeAll(myGrid.Rows, false);
    }

    public void ChangeAll(RowsCollection row, bool val)
    {
        foreach (UltraGridRow r in row)
        {
            if (r.GetType() == typeof(UltraGridGroupByRow))
                ChangeAll(((UltraGridGroupByRow)r).Rows, val);
            else
                r.Cells["Print"].Value = val;
        }
    } 

another method for users highlighting rows…

    private void btnHSelect_Click(object sender, System.EventArgs args)
    {
        if (myGrid.Selected.Rows.Count > 0)
        {
            foreach (UltraGridRow dr in myGrid.Selected.Rows)
            {
                dr.Cells["Print"].Value = true;
            }
        }
        else
        {
            MessageBox.Show("You must have rows selected in order to set for printing, please play again!");
        }
    }

HTH

2 Likes

too slow :smiley:

2 Likes

He didnt even format his code. Someone link him to Jose’s post about formatting.

I know, these clients keep me too damn busy :p. How you like that dirty method of using a placeholder to beat you hahaha

Cut me some slack Haso, notepad coding :stuck_out_tongue:

lol wasn’t a race really…just having some fun. You are a busy man… i know where you are haha! Don’t sweat your ```cs #whocares

So Back to @SimpsonGranco you will have to Deploy your Dashboard. Create a Menu ID via Menu Maintenance, set it as Dashboard Type: Assembly. Then once you restart your Epicor client it will show up on the Menu. Then you can put a Customization Layer on it.

1 Like
bool RobUnderstands()
{
 rbucek++;
 return(rbucek > 100000);
}
1 Like

You rock! Happen to have the last one in VB?

Conceptual:


    Private Sub btnSelectAll_Click(ByVal sender As Object, ByVal args As System.EventArgs)
        ChangeAll(myGrid.Rows, True)
    End Sub

    Private Sub btnClearAll_Click(ByVal sender As Object, ByVal args As System.EventArgs)
        ChangeAll(myGrid.Rows, False)
    End Sub

    Public Sub ChangeAll(ByVal row As RowsCollection, ByVal val As Boolean)
        For Each r As UltraGridRow In row

            If r.[GetType]() = GetType(UltraGridGroupByRow) Then
                ChangeAll((CType(r, UltraGridGroupByRow)).Rows, val)
            Else
                r.Cells("Print").Value = val
            End If
        Next
    End Sub

    Private Sub btnHSelect_Click(ByVal sender As Object, ByVal args As System.EventArgs)
        If myGrid.Selected.Rows.Count > 0 Then

            For Each dr As UltraGridRow In myGrid.Selected.Rows
                dr.Cells("Print").Value = True
            Next
        Else
            MessageBox.Show("You must have rows selected in order to set for printing, please play again!")
        End If
    End Sub

Telerik code converter for the win!

1 Like

Stop giving away my secrets! I did it by hand for @SimpsonGranco since both him and I are from Michigan! Enduring this Cold Weather.

Also @rbucek notice how he only asked for

You rock! Happen to have the last one in VB? (The Last One!)

Didn’t want the first one.

1 Like

lol I liked how you added the option to unselect also in the last one because it would actually come in very handy. Michigan!

nice work @hasokeric

FWIW… if you notice performance issues because you’re selecting a huge number of rows, you can improve this by turning off row synchronization (infragistics mumbojumbo)

essentially you start with

// turn it off
myGrid.BeginUpdate();
myGrid.SuspendRowSynchronization();

// do stuff to your rows here


//turn it back on
myGrid.ResumeRowSynchronization();
myGrid.EndUpdate();	


3 Likes

I usually in E10 atleast use “Custom Actions” and then I trigger the Custom Action which triggers the BPM which does the work.

Sometimes I prompt the User with a BPM Form to ask for Criteria.

That’s a gem right there, I’d suggest a bookmark to anyone browsing this thread.

3 Likes

SuspendRowSynchronization and ResumeRowSynchronization methods can be used to temporarily suspend UltraGrid from responding to data source change notifications. When row syncrhonization is suspended, the UltraGrid will still mark the rows dirty so it will re-create the rows next time it gets painted.

EndUpdate Resets the Infragistics.Win.UltraControlBase.IsUpdating flag to false and optionally invalidates the control. You can pass a boolean to it.

Overall, it makes your updates faster, so the Grid doesnt repaint itself for every row, do the batch work, then repaint once.