Гость
25 Июль 2013 01:00

I'm making custom field which value is boolean value (actually it's based on boolean field). The problem is that field value is not known during record saving and is being calculated afterwards (on record list/display). I'd like to save calculated field value (for search/filtering) during "onRenderList".

Is there available some api method for that or i just must insert/update value directly in database?

Последние изменения: 02 Март 2014


Sergey
Total posts: 13,748
26 Июль 2013 02:09

First method in the field is

onPrepareSave($value, $record, $type, $section)

This is called when to prepare what you want to save. You form have more data than you want to save. So you return string or array in this method.

Then next method is

onStoreValues($validData, $record)

This is method is used to add values to index. You may return array or string. If you return array, then new js_res_record_values record will be created per every array element.

And no in onFilerWhere method you can query this table to get list of articles ids.


Гость
29 Июль 2013 03:05

Thanks for an answer!

Still i have a bit different problem. I have kind of boolean field "task completed" which is calculated outside cobalt (in different component). I don't have yet information when new article is being saved and i can't use these methods. I want to grab value (from other component) and update record field when user is viewing that record (or record list).

Or, maybe, the better way it is to update cobalt record in that, another, component at the moment task completion is updated. I'd like use something like this:

include joomla_framework

include cobalt_framework

cobalt->updaterecord(udpated_rec_id)

In that way field saving would be activated and i could use these methods.

Is it possible?


Sergey
Total posts: 13,748
29 Июль 2013 05:21

Please, tell me what this field stores? I suspect some sort or reference to task. If o then in on filter where you can search if task was completed without saving anything in cobalt.

Работает на Cobalt