1 (edited by evilive 02/15/2011 10:11:31 am)

Topic: Add new item to document

I'm developing a new extension and I want the extension has same feel and look with the core script.

I would like to learn the framework behind the "Add new item to document" where you add new item into a document without reloading the page.

I have been trying for few days to add new item to a document but nothing showed up.

I want to know :
1. the differences between Ajax->Activate() and Ajax->AddUpdate()
2. when and why do we call these function

Please enlight me...

Re: Add new item to document

Ajax solution in FA is for historical reasons somewhat different from those used in other frameworks. In fact Ajax call on server side is treated nearly identical to normal synchronous POST request. Most normally displayed elements are rendered, and their content is collected in $Ajax singleton variable.  In contrast to synchronous call, during ajax request those elements are not sent  back to browser unless they are activated by some trigger using Activate method.

There is a couple of Ajax class methods to save various items rendered during the request, addUpdate method is one of such collecting methods, other examples are addScript (for javascript fragments) or addFocus for current focus.

If you only use standard ui helper functions found in files ui_input.php, ui_lists.php etc, and you does not create new helpers you can mostly ignore the collecting methods (eg addUpdate).  The only thing you have to do to make some ui element update is to activate it with $Ajax->activate() call. The only parameter of the call is trigger name of the element you want to update. This name is nearly always just the name of underlying input element, or id of label. So, if you have following code:

start_form();
 start_table();
  text_row('Very important parameter:', 'param')
 end_table();
 submit('update', 'Update page', true, true);
end_form();

all you have to do to have 'param' input updated after submit button is pressed in ajax mode is adding following in any place of the page code:

if (get_post('update')) {
    $Ajax->activate('params');
}

Janusz

Re: Add new item to document

hi,

i'm working on custom module too and still have problem on creating item cart just like display_transfer_items function.

Would you give a clue where do i start to have item cart like that working on my custom module?

Thanks..

Re: Add new item to document

I' not sure I undrstand you right. If you are looking for the line code which create item cart it is placed in line 70 of transfer.php.

5 (edited by Rohan Raj 07/25/2011 07:37:40 am)

Re: Add new item to document

I am working on Item adjustment.... and I need to add Packaging size in format (x*y*z*), (x*Y) and Expiry date for the new adjustment..... would u suggest me how do i start to have this as a result???????


completed.... i have done with it........

Re: Add new item to document

SORRY my english is quite poor.....


From Where should I start to get the specific reference number of SALES ORDER ENTRY for specific ITEM CATEGORY in SALES ORDER ENTRY page.....

i need to do....
if I choose the component (from Item category) then it's reference number should start with 1 n then it increases as per sales entry for same category..... but when i choose the service (from Item category) then it's reference number again start with 1 n then increase as per sales entry for same category..... and again if i choose any other item category's item then it starts with 1 n so on...... wat to do n how to do it..... can anyone help me with it......

Re: Add new item to document

Multiply numbering sequences are not supported in current FA version. You will need to wait for next major FA release, or pay some developer to implement this feature for you.
Janusz