Gallery Inline editing Power apps

Loading

Requirement: Gallery Inline Editing in Power apps

SharePoint list “EmployeeData”, ID-Numbercolumn, Name-Single line of text, EmpAddress- Multi line of text, EmpDesignation- Single line of text, EmpSalary- Currency column, Status- Choice column

Blank vertical gallery, add data source on items property add SharePoint list name “EmployeeData”. Provide the label to the gallery, Add horizontal container to the screen to add labels of the gallery items.

On Gallery Add Textinput, and drop down.

On Textinput  1-Text property: ThisItem.ID
Textinput  2-Text property: ThisItem.Title
Textinput  3-Text property: ThisItem.EmpAddress
Textinput 4-Text property: ThisItem.EmpDesignation
Textinput 5-Text property: ThisItem.EmpSalary
Dropdown- Items Property: Choices(EmployeeData.Status)

Now on DisplayMode of the Items in the gallery make it Disable. add Edit Image to the gallery, on displaymode of labels and dropdown in gallery make it works when user click on edit if not make it disabled. To select more than one record for editing the data in gallery, Create a new collection to clear the previous collection used

OnVisible property of the screen- 
Reset(Gallery); Clear(colItems);Clear(colDelItems);
On Edit icon- OnSelect Property: 
Collect(colItems, ThisItem)

Now for selected item make it an cancel icon, if it is required user can cancel the item while editing.

If the item is existed in the collection then show the cancel Image if not display edit image.

Now change the functionality of the OnSelect of Image. If the item is empty in the adding to the collection , if the item exists in the collection remove it.

Add delete image to the gallery and create one more collection for delete items

edit Image

On Image Property:

If(IsBlank(LookUp(colItems, ID=ThisItem.ID)), edit, cancel)

On OnSelect Property:

If(IsBlank(LookUp(colItems, ID= ThisItem.ID)), Collect(colItems, ThisItem), Remove(colItems, ThisItem))

Add another Delete Image ,

On Image Property:

If(IsBlank(LookUp(colDelItems, ID=ThisItem.ID)), delete, cancel)

On OnSelect Property:

If(IsBlank(LookUp(colDelItems, ID= ThisItem.ID)), Collect(colDelItems, ThisItem), Remove(colDelItems, ThisItem))

Add Rectangle icon

On Visible Property:

If(IsBlank(LookUp(colDelItems, ID= ThisItem.ID)), false, true)

On DisplayMode of selected item

DisplayMode property:

If(IsBlank(LookUp(colItems, ID=ThisItem.ID)), DisplayMode.Disabled,DisplayMode.Edit)

If ID is equal to ThisItem.ID then display collection items, if it is blank then go to the edit mode.If the item it is not their, it will return empty row, then isblank will become true and it will make the control to disabled mode.

Leave a Reply

Your email address will not be published. Required fields are marked *