disabled the pencil for editing certain record

Hi,

​I have a grid and need to disable certain record for editing based on a column value.

Below is what I have done

onApplicationInit​ event

if ({value1} == ‘Yes’){
sc_apl_conf (“grid_myapplication”, “lig_edit”, “off”);
}
else{
sc_apl_conf (“grid_myapplication”, “lig_edit”, “on”);
}

The above code I check from the user manual regards the macro but it didn’t work. The pencil does not hide at all. Please help.
[LEFT][SIZE=14px]sc_apl_conf(“Application”, “Property”, “Value”)[/SIZE][/LEFT]
[SIZE=13px][SIZE=13px]Property for Grid applications[/SIZE][/SIZE] [TABLE=“border: 0, width: 0”]
[TR=“bgcolor: transparent”]
[TD=“width: 15%, align: left”]Property[/TD]
[TD=“width: 10%, align: left”]Value[/TD]
[TD=“width: 75%, align: left”]Description[/TD]
[/TR]
[TR=“bgcolor: transparent”]
[TD=“class: corpo1, align: left”]start[/TD]
[TD=“class: corpo1, align: left”]filter[/TD]
[TD=“class: corpo1, align: left”]Forces the Grid to start by the filter.[/TD]
[/TR]
[TR=“bgcolor: transparent”]
[TD=“class: corpo1, align: left”]cols[/TD]
[TD=“class: corpo1, align: left”] [/TD]
[TD=“class: corpo1, align: left”]Forces the number of columns. (vertical and slide kind)[/TD]
[/TR]
[TR=“bgcolor: transparent”]
[TD=“class: corpo1, align: left”]rows[/TD]
[TD=“class: corpo1, align: left”] [/TD]
[TD=“class: corpo1, align: left”]Forces the number of lines per page.[/TD]
[/TR]
[TR=“bgcolor: transparent”]
[TD=“class: corpo1, align: left”]lig_edit[/TD]
[TD=“class: corpo1, align: left”]on/off[/TD]
[TD=“class: corpo1, align: left”]Qualifies (on) or unqualifies (off) the record edition. (the pencil icon)[/TD]
[/TR]
[/TABLE]

Hi, you should only set sc_apl_conf (“grid_myapplication”, “lig_edit”, “off”); for the grid in onApplicationInit event. This should work.
Then you add a field manually to your grid as an image and put an edit icon in it with a link to edit your record.
In your grid table you need a field with conditon i. e. 1 or 0 to edit or not edit (in my case data_locked != 1 -> editing is allowed)

In OnRecord you put

$editicon = "/html/sc9/file/img/editicon.png";

if({data_locked} != 1){
    {Edit} = "<img src = $editicon width = 30>";
}
else{
    {Edit} = "";
}

This lets you set a condition to edit a record or not

Joe

1 Like