Hi to all,
How to make a grid non editable based on a enum value in Form in AX 2012 ?.
for Ex: in Transfer order Form, if the status moved to “Received”, the record in the grid is locked. how to do that?please help…
Thanks in Advance…
Regards,
Alonso
Override the Active method in the datasource of the form and write it as:
if (EnumValue == noyes::no)
{
datasource_ds.allowedit(false);
}
else
{
datasource_ds.allowedit(true);
}
As Vishal Said, You have to overrid the DataSource of Active method
public int active()
{
int ret;
ret = super();
if (DatasourceName.EnumField == EnumName::EnumElement) // Your Required Condition
{
DatasourceName_Ds.allowEdit(false);
}
else
{
DatasourceName_Ds.allowEdit(true);
}
return ret;
}
Thank u Vishal and Sadhullah…
it worked…
Regards,
Alonso
Sorry One more Question guys…
Can I Able to make one column in that grid editable and the rest of the columns non-editable?
Regards,
Alonso
Yes you can,
Example, There are 3 Fields in the Datasource Table. as Field1, Field2, Field3*. Here you need to allow Edit only one Field tat is Field1 and Remaining Field2 and Field3 should be non editable.*
same way you have to in the Active Method
DatasourceName_Ds.object(fieldNum(DatasourceTableName, Field1)).allowEdit(true);
DatasourceName_Ds.object(fieldNum(DatasourceTableName, Field2)).allowEdit(false);
DatasourceName_Ds.object(fieldNum(DatasourceTableName, Field3)).allowEdit(false);
Thanks Sadullah,
and sry for late reply.
Its Working Sadhullah… but when i edit and add values in those fields, it is telliing “the values in the form are not current , click restore to view the form”. any idea ???
Thanks in Advance,
Regards,
Alonso
Hi SAADULLAH,
How can I make Edit Button disabled and non editable grid base un enum value.
Hi All,
Here u r making a field editable or non editable bt I want to make a group editable or not editable …how can i do this…
I m using ax 2012 R3…
Thanks
Sachin Chauhan