Hello Group,
I've sent the afternoon trying to add the JobHead.JobReleased field to the Grid on the List tab of the Resource Scheduling Board. I think I'm close but I'm missing something. Here's what I've done;
I added a FKV to the JobHead table, so I can pull the JobReleased field. This works because I can add it to the Detail tab and it works.
I manged to work through some examples, that I found on the EUG and Youtube(Thanks Jose!) for adding column to a grid. This works too.
The issue I'm running into is that when the Grid initializes, it add the column but all row show True. Which isn't correct. If I select a job on the scheduling board the field gets refreshed to the correct value.
Is there a way to have it refresh all the rows when the grid/row is initialized? I wondering if it's something weird with the Gantt chart or maybe my FKV....
Below is the code I'm using and I have the exported customization if anyone wanted to take a look.
​Any pointers would be greatly appreciated.​
Norman Hutchins
System Administrator
Howell Laboratories, Inc.
​// ****************************** ********************
// Custom code for ResourceSchedForm
// Created: 2/19/2016 1:10:30 PM
// ****************************** ********************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
Ice.Lib.Framework.EpiUltraGrid myGrid;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.txtJobNum.ValueChanged += new System.EventHandler(this. txtJobNum_ValueChanged);
// End Wizard Added Custom Method Calls
myGrid = (Ice.Lib.Framework. EpiUltraGrid)csm. GetNativeControlReference(" 87f88dc8-1b94-4324-ba83- 583a2af5cbb9");
myGrid.DisplayLayout.Bands[0]. Columns.Add("JobReleased", "Job Released");
myGrid.InitializeRow += new Infragistics.Win.UltraWinGrid. InitializeRowEventHandler( grdList_InitializeRow);
}
private void grdList_InitializeRow(object sender, Infragistics.Win.UltraWinGrid. InitializeRowEventArgs e)
{
if (!String.IsNullOrEmpty(e.Row. Cells["JobNum"].Value. ToString()))
{
EpiDataView edv = oTrans.Factory("JobHead");
if (edv.Row>= 0)
{
string ReleaseStatus = Convert.ToString(edv.dataView[ edv.Row]["JobReleased"]);
MessageBox.Show(ReleaseStatus) ;
e.Row.Cells["JobReleased"]. Value = ReleaseStatus;
}
}
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.txtJobNum.ValueChanged -= new System.EventHandler(this. txtJobNum_ValueChanged);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
myGrid.InitializeRow -= new Infragistics.Win.UltraWinGrid. InitializeRowEventHandler( grdList_InitializeRow);
}
private void txtJobNum_ValueChanged(object sender, System.EventArgs args)
{
//Define DataView
EpiDataView edv = oTrans.Factory("JobHead");
// Notify JobReleased Status
if (edv.Row>= 0)
{
if (Convert.ToBoolean(edv. dataView[edv.Row][" JobReleased"]) == true)
{
shpJobStatus.Status = (Ice.Lib.Framework. StatusTypes)0;
shpJobStatus.EnabledCaption = "Released";
}
else
{
shpJobStatus.Status = (Ice.Lib.Framework. StatusTypes)2;
shpJobStatus.EnabledCaption = "Not Released";
}
}
// Notify Job Schedule Locked Status
if (Convert.ToBoolean(edv. dataView[edv.Row][" SchedLocked"]) == true)
{
shpSchedLocked.Status = (Ice.Lib.Framework. StatusTypes)2;
shpSchedLocked.EnabledCaption = "Sched Locked";
}
else
{
shpSchedLocked.Status = (Ice.Lib.Framework. StatusTypes)0;
shpSchedLocked.EnabledCaption = "Sched UnLocked";
}
}
}
​