Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
A Grid is being populated with an Infotable that has dynamically generated fields. How does one make all columns of this grid editable? To be clear, the 'Configure Grid Columns' has no columns to show at design time.
There is a hack. If you know what columns might be present, one could create a temporary DataShape capturing those, then use it for the configuration of the Grid and get rid of it once the configuration is done. The configuration is retained.
There is only one solution for this limitation that I've been able to figure out. Unfortunately, you won't be able to edit your grid rows directly in the grid , but I don't really think doing so is very elegant and it definitely seems to affect performance on grids with a lot of data and many editable columns. Also, the data driving your grid must reside in a data table.
Here's the solution:
Create a mashup that you will use as a pop-up window. On the mashup, include all the fields you wish to be able to edit. Include a "Save" button. Configure the mashup to have one parameter for each field on the mashup.
On your grid, configure the double-click event to call a service which takes the "Selected Row(s)" as input. Since you know what your selected row looks like, from a data shape perspective, even though there isn't one specifically assigned to the grid, you'll be able to parse the infotable to extract the values of the fields you want to edit. Be sure to include the ID--just don't display it on your pop-up if it's not needed. Return those values in a new infotable using a new DS of just those fields. This new service now has an explicitly defined result data shape that you'll be able to use to map each one of the fields to a corresponding field on your mashup pop-up. Use the service complete event to trigger a navigate widget which launches your pop-up.
The pop-up will launch and all your fields will contain the corresponding data from the selected row in the grid. Make whatever changes you need to your data and then when a user clicks the the "Save" button, call a new service which takes all the values from your pop-up mashup and uses the ID field which you also passed in to do an update query on your data table. When the user closes the pop-up, call the same service you initially called to populate your grid. The grid will refresh with the updated data.
To power up this idea, you can use a repeater that dynamically shows the right mashup based on base type to create an editor for a dynamic table.
Hey a bit late to the party, but in any case can you elaborate more on how to create the service that will be displayed in the pop-up mashup
hi,
what type of service is used, you told "On your grid, configure the double-click event to call a service which takes the "Selected Row(s)" as input."
I configured my grid to open a pop-up in that I create fields and I used "Get Data Table entries" as service but I am unable to load the values into that mashup...
could you explain clearly... what type of service is used..?
Grid Double Click -> Navigation Widget to open Pop Up mashup -> Pop Up mashup must have Mashup Parameter
Pass Grid Data Source Selected Row KEY to Navigation Widget map to Mashup parameter
In Pop Up use Mashup parameter to do GetDataTableEntryByKey
Display in Editable boxes
Bind Editable boxes to AddOrUpdateDataTableEntry
Button to execute AddOrUpdateDataTableEntry service
AddOrUpdateDataTableEntry Service Invoke Completed to Close Mashup if Pop up
Navigate Widget on Popup Close to GetDataTableEntries to refresh content
Hi pai Chung,
ThankYou for the reply. Should I have to create a grid widget again in the Pop-mashup...??
I dis not get what is Mashup Parameter..??
Could you please elaborate your answer..??
The help isn't super great
you can do some searches here on the community for Mashup parameter as well.
but in that pop up mashup you are bringing back one single record to edit, I would not use a grid, but individual widgets per value to be edited.
Hi Pai Chung,
ThankYou for the reply, I implemented what you told in your reply such as adding mashup parameter, AddorUpdateDataTable entry etc But Still I am unable to get the data into the mashup fields..?
can you suggest anything?
I will appreciate your help.
regards,
madhu
can you post some screenshots of how you have defined your mashups?
hi Paichung,
"Pass Grid Data Source Selected Row KEY to Navigation Widget map to Mashup parameter"
for this as shown in 3rd image i used parent mashup "GetDataTableEntries" Service and in that key to navigate widget to mashup parameter
Not sure what isn't displaying for you but the wiring all looks good.
Hi Pai Chung,
I am able to execute it. I rectified my mistake. ThankYou for the help.
regards,
madhu