Binding list variable to input widget in EditableTable

Binding list variable to input widget in EditableTable

  
Hello,

Is it someway possible to bind input widget used inside an EditableTable to a list variable? I have a data structure where EditableTable displays a list of rows each containing a list of values. I can use Expression widget to show the value using format like:
 
    If(MyTable.List.Current.Values.Length > 0, MyTable.List.Current.Values[0].ValueText, "")

but I would like to be able to edit these values also and use input widget. Setting the input widget's <Variable> parameter to "MyTable.List.Current.Values[0].ValueText" does't work but throws "Index 0 is out of range" exception immediately during page preparation.

I believe creating own variable for each value is a workaround but I can have 1-20 values and it feels frustating if I have to create 20 variables named like Value1, Value2, Value3.....Value20 to row level structure. Also setting/getting values to these differently named variables would be very cumbersome. 

Thanks in advance for any hints,
Joona



   
Hi Joona,

When working with lists, you'd typically use TableRecords, not an EditRecord. As the name implies, that's used for editing a single record.
Hi Kilian,
 
Thanks for the hint - I got it working with the TableRecords when I embedded input widget in the TableRecord's cell. But the behaviour of TableRecords is not what I want - I like the EditableTable's different view mode and edit mode functionality. With TableRecords I have the input widgets always visible and in editable state. And I'd like to have editing to happen within the table and not with own Edit Record popup. The data displayed and to be edited is more like Excel type data.

But what I now wonder is why binding Input widget variables within TableRecords to following variables:
 
    TableRecords1.List.Current.Values[0].ValueText    (column 0)
    TableRecords1.List.Current.Values[1].ValueText    (column 1)
    . . . etc...

works nicely but same binding with EditableTable throws exception

index 0 is out of range
   at OutSystems.HubEdition.RuntimePlatform.Db.OSList`1.get_Item(Int32 index)
   at ssXXXXXX.Flows.FlowTsComponents.WBlkXXXXXXXXXXXX.inputwt6_input_value()
   at ASP.blocks_XXXXX_XXXXXXX_XXXXXXXXXXXX_ascx.__DataBinding__control18(Object sender, EventArgs e)
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at OutSystems.HubEdition.WebWidgets.TextBox.DataBind()
   at OutSystems.HubEdition.WebWidgets.Container.DataBindChildren()
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at OutSystems.HubEdition.WebWidgets.Container.DataBind()
   at OutSystems.HubEdition.WebWidgets.RepeaterItem.DataBind()
   at OutSystems.HubEdition.WebWidgets.Iterator.#20b()
   at OutSystems.HubEdition.WebWidgets.Iterator.InsertItem(Int32 itemIndex, Object dataItem, Boolean selectItem)
   at OutSystems.HubEdition.WebWidgets.Iterator.#80b()
   at OutSystems.HubEdition.WebWidgets.Iterator.#70b()
   at OutSystems.Plugin.Widgets.EditableTable.OnRender()
   at OutSystems.HubEdition.WebWidgets.CustomWidget.#BYb(WidgetBehavior b)
   at OutSystems.RuntimeCommon.CollectionsExtensions.Apply[Type](IEnumerable`1 collection, Action`1 action)
   at OutSystems.HubEdition.WebWidgets.CustomWidget.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

immediately during the page opening. I believe EditableInput widget binds the variables differently than TableRecords but could there be some workaround around this(?)

Joona


 

Hi Joona,

Sorry for skimming your question too fast - I thought you were talking about EditRecords i/o EditableTable. I just did some tests, and it indeed seems that EditableTable tries to bind to the attributes even before the preparation has run - which is bad, imho, and a bug. Mind you, EditableTable is a disastrous piece of sh*t with tons of bugs, for which no fixes seem to be made by OS (google the forum, don't say I didn't warn you :)). We've tried to use it on various occasions, but we've always reverted to TableRecords.