Shakeel
Shakeel

Reputation: 1

Set other row cells values based on selected DropDownListItem in one cell Sheild UI Grid

<script type="text/javascript">
        function columnTemplate(cell, item) {

          var drivers = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.dirvers));

            $('<select/>')
                .appendTo(cell)
                .shieldDropDown({
                    dataSource: {
                        data: drivers
                    }  
                   , 
                    editing: 
                       {
                           enabled: true
                       }
                    ,
                    textTemplate: "{FullName}"
                    ,valueTemplate: "{DriverID}"
                    ,events: {
                        select: function(e) {
                            alert("#list select:" + 
                                    e.item.FullName + ":" + e.item.DriverID+ " : "+
                                    e.index);

    // here I want to calculated which driver is selected then set the other cell value

                        }
                    }

                });
        }
    </script>

Please help me

Upvotes: 0

Views: 156

Answers (1)

Vladimir Georgiev
Vladimir Georgiev

Reputation: 1949

You can have a columnTemplate for the other cell like this:

columnTemplate: function(cell, item, index) {
    $('<span id="uniqueid_' + index + '"/>')
        .appendTo(cell);
}

Then in the select handler of your DropDown, you can reference and update that element by taking the row index from the 3rd parameter of the columTemplate() handler...

Upvotes: 1

Related Questions