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


(Chris Simpson) #1

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.


(Haso Keric) #2

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

(Chris Simpson) #3

That would be great!

(Chris Conn) #4

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):

(Rob Bucek) #5

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);
                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;
            MessageBox.Show("You must have rows selected in order to set for printing, please play again!");


(Rob Bucek) #6

too slow :smiley:

(Haso Keric) #7

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

(Chris Conn) #8

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:

(Rob Bucek) #9

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

(Haso Keric) #10

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.

(Chris Conn) #11
bool RobUnderstands()
 return(rbucek > 100000);

(Chris Simpson) #12

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

(Haso Keric) #13


    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)
                r.Cells("Print").Value = val
            End If
    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
            MessageBox.Show("You must have rows selected in order to set for printing, please play again!")
        End If
    End Sub

(Chris Conn) #14

Telerik code converter for the win!

(Haso Keric) #15

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.

(Chris Simpson) #16

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

(Rob Bucek) #17

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

// do stuff to your rows here

//turn it back on

How to check all checkboxes in a Column
(Haso Keric) #18

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.

(Chris Conn) #19

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

(Haso Keric) #20

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.