Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
How to get defaultValue loaded by using addRow method
posted

The addRow method requires a values object to pass in.

.igGridUpdating( "addRow", values:object );

But using the default add-new-row from the grid UI, the default value is loaded automatically when clicking the cell for adding new row.

Is there a way that the defaultValue set from the columnSettings can be loaded automatically when adding new row from the addRow method?

Thanks.

Parents
No Data
Reply
  • 23953
    Verified Answer
    Offline posted

    Hi Erica,

    You can easily implement a function which creates an object from the columnSettings default values. Then use this object to add additional information and pass it to addRow method.

    Here is an example implementation of such method:

     

    function getDefaultValuesObject() {

        var tmpObject = {};

        var colSettings = $("#grid1").igGridUpdating("option", "columnSettings");

        colSettings = colSettings || [];

        for (var i = 0; i < colSettings.length; i++) {

            if (colSettings[i].hasOwnProperty("defaultValue")) {

                tmpObject[colSettings[i].columnKey] = colSettings[i].defaultValue;

            }

        }

        return tmpObject;

    }

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

     

Children
No Data