----- Solution ---------------------------
Write a renderer. You can get the row and column of the cell you clicked in the renderer. Change the editable property of the DataGrid according to the row and column, and give you an idea:
Listen to click events;
2. In the event processing function, take the row index from listDatadata and judge (which row can be edited by this variable, you can use properties to pass it into the renderer when creating the renderer);
(true), set (or parentDocuemnt) editable property to true, and then place the cursor on the cell you click (set editedItemPosition property, how to check it yourself);
4. Listen to the itemEditEnd event of DataGrid. Set editable function to false in the event handling function
----- Solution ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I came up with a simpler way, editable="true", and then directly stop itemEditBegin to block the call to createItemEditor.
Listen to DataGrid's itemEditBegin event
private function onItemEditBegin(event:DataGridEvent):void
{
if( == 0)//If it is the first line, no editing is allowed
{
();
}
}
Write a renderer. You can get the row and column of the cell you clicked in the renderer. Change the editable property of the DataGrid according to the row and column, and give you an idea:
Listen to click events;
2. In the event processing function, take the row index from listDatadata and judge (which row can be edited by this variable, you can use properties to pass it into the renderer when creating the renderer);
(true), set (or parentDocuemnt) editable property to true, and then place the cursor on the cell you click (set editedItemPosition property, how to check it yourself);
4. Listen to the itemEditEnd event of DataGrid. Set editable function to false in the event handling function
----- Solution ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I came up with a simpler way, editable="true", and then directly stop itemEditBegin to block the call to createItemEditor.
Listen to DataGrid's itemEditBegin event
Copy the codeThe code is as follows:
private function onItemEditBegin(event:DataGridEvent):void
{
if( == 0)//If it is the first line, no editing is allowed
{
();
}
}