This is a migrated thread and some comments may be shown as answers.

[Solved] Initializing editing controls in OnEdit InCellEditing

0 Answers 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 07 Dec 2011, 12:12 PM
Hello,

In my Project i want to set the forms with special values, when the user insert a new record. I use the InCellEditing Mode. I foundthe following code in the Grid-API. But this code do not work, because the $(form).find() will not find the form. I think this is because in the InCellEditing Mode the Forms are not "active" when i add a new record.
<script type="text/javascript">
function Grid_onEdit(e) {
    var dataItem = e.dataItem;
    var mode = e.mode;
    var form = e.form;
    var priceTextBox = $(form).find("#Price");
 
    if (mode == "insert") {
        // Set default value
        priceTextBox.val("Enter price");
    }
 
    var customerDropDownList = $(form).find("#Customer");
    if (mode == "edit") {
        //Select the proper dropdown list item
        customerDropDownList.val(dataItem.CustomerID);
    }
 
}
</script>

Have somebody an Idea how i can set the form controls/values via javascript when using InCellEditing Mode?
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Share this question
or