"Add cell" action to dynamic/static table


#1

Hello, I see there are actions to remove a cell from a dynamic (or static) table. Is there a symmetric action to add a cell? (I could not find one and hope it is an oversight on my part).

Regards,
Mark


#2

Hello Mark,

This is a good question. I don’t believe there is. In order to add additions to a dynamic element, a fetch for the newly updated table data is necessary.


#3

Hi Wade,

When I fetch data, the response wipes out any existing content. I would like to achieve the effect of appending to the existing content. I am still experimenting with my chat app, which is where the question is coming from, but am also thinking about implementing an “instagram clone”.

Cheers,
Mark


#4

This sounds like a wonderful place to use our new local caching and fetching features we just added. With the ability to store locally, theres a API request mode now that will 1st use what’s locally stored, while it also goes ahead and fetches new data from the Request, and then it updates when it arrives. This should keep the table filled up and then “append” the new data technically, when it arrives.


#5

Have a look at this Posting… There are resources Sue created for this as well with links in the post and if you scroll down the thread, Nate breaks down the Modes really nicely too. I think your needs here would be in using the “Cache and Fetch” mode.


#6

Cool, let me play with it and I will report back. Thank you for your help!


#7

Hi @wade, I am playing with caching and am running into a problem. Let me describe how the app works, perhaps there is a problem with the approach altogether and I would love to get your input on this.

This is a chat app where I have a timer to fetch messages from the server. The first request brings all the messages for the user. Any subsequent request (same API call) will return only new messages. This is done by controlling a parameter in the API call which tells the server a timestamp from which any new messages should be returned. The API request issued by the timer has the following cache/offline configuration:

It works well until the API starts returning delta’s (meaning any new messages). At that point, the response of the API wipes out any previous content. Based on what you described earlier in this thread, my expectation was that any subsequent responses for the API would be appended to the data model bound to the UI control, however, it doesn’t seem to be happening.

Here’s how I configured data source binding:

Please let me know if you see anything wrong with the setup or if you have any ideas for me to try.

Cheers,
Mark


#8

Based on my understanding and testing of the caching feature, this assumption is wrong.
When new data is returned from the API it will overwrite/rebind instead of append.

With the Cache and Fetch, the request will first get the data from the cache and display while fetching from the server.
When the data is returned from the server the new data will overwrite (not append the delta) the cache as well as the data being displayed.

I remember you asked the following question

And Nate’s response was

This means when new data is fetched your UI rebinds to the new data instead of appending the delta.


#9

@seanhoots, yes, I remember what Nate said, however, I was going by @wade’s suggestion here. Notice that he says append, which for me is the key word in the light of what I am trying to do:

I am trying to find a way to have a data model which is an array of objects to which I can append new data, since returning everything from the server every time would be a major overkill.


#10

I might be wrong but I don’t think Wade meant it actually does an append. I think he meant that the effect is like an append and that’s why he put that in bracket.
Anyway let’s wait for him to clarify what he meant by append.


#11

@markpiller I am misusing “Append” word here. It’s should be “Replace”. Good catch @seanhoots…

Yes, the data is overwritten with the new data from the most recent fetch. You won’t continuously add to your local data cache but will replace it with new data. The strategy of only receiving the new messages is probably not the best tactic based on that and your use case here. You’ll want to redeliver all the messages within a time period or something. That’s probably how you want to update the chat thread in this situation.


#12

Thanks, @wade. Please consider that a feature request then :slight_smile: it would be a great addition to the functionality if one could append to a data model. Without it, a developer would have to introduce quite a bit of complexity for managing their data in many different scenarios.


#13

+1 for such a feature.

In fact there needs to be better support for arrays/lists. Currently one cannot create an array variable.
There should be ability to create list variables and assign the response of a request (list data model) to it.

With support for basic list operations like:

  • append an item to list,
  • join two lists,
  • get element at an index from list,
  • remove element at index from list,
  • etc.

Currently the only list operation available is the Iterate through Array action.
Without ability to create list variables it is very limited as you can only call it in a request response (the caching feature makes it a bit more useful though).


#14

I agree all around. I will add this to our feature request tracker. We’re incredibly stoked with what local caching is bringing in value to you and we see many ways to make it robust. This is a great way to add more power to it.