
<tr>
    <td>
        <input type="hidden" id="newDeviceId" value="{$device->id}"/>
        <input type="text" class="form-control updateElement positiveNo"  id="device_name{$device->id}" 
               data-id="{$device->id}"  data-colName="device_name" 
               data-tableName="devices"  value="{$device->device_name}"/>
    </td>
    <td>
        <select class="form-control  updateElement  deviceLocation" data-placeholder="اختر "
                id="location{$device->id}" data-id="{$device->id}" 
                data-colName="location"   data-tableName="devices" >
            <option value="">اختر</option>
            {foreach $locations as $location }
            <option value="{$location->id}" {if $device->location eq $location->id}selected{/if} > 
                {$location->name}</option>
            {/foreach}
        </select>
    </td>
    <td>
        <select class="form-control  updateElement " data-placeholder="اختر دور"
                id="floor_no{$device->id}" data-id="{$device->id}" 
                data-colName="floor_no"   data-tableName="devices" >
            <option value="">اختر</option>
            {foreach $floors as $floor }
            <option value="{$floor->id}" {if $device->floor_no eq $floor->id}selected{/if} > 
                {$floor->name}</option>
            {/foreach}
        </select>
    </td>

    <td>
        <div id="roomNoDiv{$device->id}" {if $device->location !=  2}   style="display: none;" {/if} >
            <select class="form-control select2h updateElement " data-placeholder="اختر دور"
                    id="room_no{$device->id}" data-id="{$device->id}"   data-colName="room_no"
                    data-tableName="devices"  >
                <option value="">اختر</option>
                {foreach $rooms as $room }
                <option value="{$room->id}" {if $device->room_no eq $room->id}selected{/if} > 
                    {$room->name}</option>
                {/foreach}
            </select>
        </div>
    </td>
    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$device->id}" 
           style=" float: left;" href="#" data-link="addinvestigation" 
           data-fn="del" data-tableName="devices">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr> 

{literal}
<script>
    var newDeviceId = $('#newDeviceId').val();
    $('.positiveNo').forcepositiveNum();
    $('#newDeviceId').remove();
    $('#location' + newDeviceId).select2();
    $('#room_no' + newDeviceId).select2();
    $('#floor_no' + newDeviceId).select2();
    $('#device_name' + newDeviceId).focus();
</script>
{/literal}


