javascript - Clone Row (copy records) in Oracle Apex is not working -


<script type="text/javascript">     function fn_clonerow(pthis) {         $(pthis).parent().parent().clone().appendto($(pthis).parent().parent().parent());     } 

with use of above code able clone clicked rows in tabular form bottom of table, unable store them. when change values of cloned rows, original row updated instead of adding new row when page submitted.

that because in cloning row clone element containing primary key. top of head, following elements:

  • empty input element containing pk (you'll need find out if array f01 or other. question not provide context) or if use rowid, clean out input element name "frowid"
  • empty input element containing row checksum. input element name "fcs"
  • set input element containing record status (name = fcud) 'c' . used determine action perform on it. 'd' new, 'c' changed , 'u' update - presume. not in documentation though, inspecting html , javascript can find this.

you can further improve code not doing parent().parent()... , instead closest tr or table using .closest(...)

var newrow = $(pthis).closest('tr').clone(); $('input[name=f01]', newrow).val(""); //input pk value -- make sure matches situation!!! $('input[name=frowid]', newrow).val(""); //or if form works rowid, use $('input[name=fcs]', newrow).val(""); //clear checksum $('input[name=fcud]', newrow).val("c"); //set record status newrow.appendto($(pthis).closest('table')); //finally, append row table 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -