Selecting rows to delete

Jun 30, 2014 at 2:33 PM
Is there any possible way to select several rows(like with checkboxes) and delete them with one button press?
Coordinator
Jun 30, 2014 at 2:40 PM
Edited Jun 30, 2014 at 2:43 PM
yes, try this demo: http://demo.aspnetawesome.com/MailboxDemo

with actual checkboxes you can do it like this:
         <%=Html.Awe().Grid("Grid")
            .Columns(
                new Column{Width = 55,
                    ClientFormat = "<input type='checkbox' name='id' value='.Id'/>", 
                    Header = "<input type='checkbox' name='chkAll' />"},
                new Column{Name = "Person"},
                new Column{Name = "Food"},
                new Column{Name = "Location"}
            )
            .Url(Url.Action("GetItems", "LunchGrid"))
%>
<br/>
<button class="awe-btn" id='btnGetSelection'>get selection</button>
<div id="log"></div>
<script>
    $(function () {
        $(document).on('click', '.awe-grid [name=chkAll]', function () {
            if($(this).is(':checked'))
                $(this).closest('.awe-grid').find('[name=id]').attr('checked', 'checked');
            else
                $(this).closest('.awe-grid').find('[name=id]').removeAttr('checked');
        });

        $('#btnGetSelection').click(function () {
            var arr = $('#Grid [name=id]:checked').map(function() {
                return $(this).val();
            }).get();

            $('#log').html(JSON.stringify(arr));
        });
    });
</script>