vendredi 29 avril 2011

How to enable and disable editing fields in a grid according to records in a table

To do this override the method active from the dataSource of your grid

public int active()
{
    boolean         canEdit = true;
    ForecastModel   forecastModel;
    int             ret;
    ;

    ret = super();

   
    if (ThyProjForcasTable.ProjForecastModelId)
    {
        forecastModel = ForecastModel::find(HeadingSub::Heading, ThyProjForcasTable.ProjForecastModelId);

        if (forecastModel && forecastModel.Blocked)
            canEdit = false;
    }

    this.allowEdit(canEdit);
    this.allowDelete(canEdit);
    Generate_period.enabled(canEdit);


    return ret;
}

Aucun commentaire:

Enregistrer un commentaire