Joget DX Beta Available for Download

Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

In this article, we will learn on how to clone/duplicate entries from one Form Grid to another Form Grid.

Code
<p><a class="copy btn">Copy Grid 1 to Grid 2</a></p>
<script>
$(function(){
    $(".copy").on("click", function() {
        var grid1 = FormUtil.getField("field1");
        var grid2 = FormUtil.getField("field2");

        $(grid1).find(".grid-row").each(function(){
            var json = $(this).find("textarea").val();

            //remove id
            var obj = JSON.parse(json);
            if (obj.id !== undefined) {
                delete obj.id;
                json = JSON.stringify(obj);
            }

            $(grid2).enterpriseformgrid("addRow", {result: json });
        });
    });
});
</script>

 

APP_gridcopy-1-20181031190701.jwa

  • No labels