on 03-01-2007 4:04 PM
Hi,
I have a custom screen that shows items and their prices. The first column is a checkbox. I have a "Select All" button and a "Clear All" button. The following code does the select all function:
objForm.Freeze(True)
For i = 0 To objGrid.DataTable.Rows.Count - 1
If objGrid.DataTable.GetValue(3, i) = 0 Then
objCheck.Check(i, False)
Else
objCheck.Check(i, True)
End If
Next
objForm.Freeze(False)
objForm.Update()
I have about 1000 items loaded in the grid. It takes over a minute to select all and clear all. I have to add code for progres bar just to show that it's not hung. Yet in standard B1 UI, there are screens that you can clear all rows (like the Hierarchy screen, clear button) almost instantly. Am I doing something wrong? Is there a more efficient way to select/unselect all rows?
The best form that you select or clear all you rows is using the Datasources or UserDatasource, for example:
Mo_Forma.DataSources.UserDataSources.Item("itemid").Value = ValOff or ValOn
it depends of your want select or unselect.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should loop the datatable and set the datatables values instead of the UI-values... They are much faster
DataTable dt = oForm.DataSources.Datatables.Item("uid");
for(int i=0; i<dt.Rows.Count; i++)
{
dt.SetValue("colUid",i,"New-value");
}
If you do this it will automatic be reflected in the GUI
When you built your form for your grid you need specify the type of your column in this case depend of your version of SAP B1, for example from B1 2004 or early you need to use
SAPbouiCOM.BoFormItemTypes.it_EDIT
and from B1 2005 to later
SAPbouiCOM.BoGridColumnType.gct_EditText
. And in your datasource as the object checkbox use two properties called ValOn or ValOff and how they receives a string, the type for your datasource for this columns would be
SAPbouiCOM.BoDataType.dt_SHORT_TEXT
, for example
Mo_Forma.DataSources.UserDataSources.Item(chkEliminaCURP).Value = "Y"
in this case value "Y" is for checked option.
I hope that this help you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, If you have installed the SDK of SAP B1, you can check the folder Samples, path is some like this D:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources\2003, this example can help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.