Is there a way I can populate a field on load?
Is there a way I can populate a field on load?
orionaselite
Posts: 49Questions: 13Answers: 4
Is there a way I can populate a field on load from an remote API and update my db field immediately?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I was thinking renderer but I am not sure how. The API returns json
Could you clarify what field for me please? Are we talking about an Editor field, and do you want to populate its options (e.g. in a
select
) list?Allan
Assume I have a db with a field called price I have more but I am trying to make it simple to explain. Assuming that my primary key has a value of ABC I need to make an external api call to www.example.com/api/price/{whatever the primary key value was}/ it will return 2 for example in json format. I than need to update the price cell for ABC with that returned value from the external api. This for example need to happen every lets say 24 hours and yes they are editor fields if that matters
I almost have a solution but I have an issue with fnUpdate. It says fnUpdate is not a function. I am sure it's a stupid mistake somewhere I guess. My code is this
the line
table.fnUpdate( result[0].price_usd, index, 2,true ); // Single cell
I assume will update row 0 column 2 with value result[0].price_usd and redraw and
row 1 column 2 with value result[0].price_usd and redraw
ideas why table.fnUpdate is not a funct5ion
solved
I would suggest using
cell().data()
rather than the legacy API, but its good to hear you have it working now.Allan