Saturday, December 29, 2012

Pre-selecting Fields for Update

When a user is performing a batch edit on several fields, they must check “update” boxes next to the fields that will be updated. These boxes are unchecked by default.

Batch edit in form with two fields to be updated.

Let’s change the default state of the checkboxes to be enabled when the form loads.

Start the Project Designer. In the Project Explorer, switch to the Controllers tab. Right-click on Suppliers / Business Rules and press New Business Rule.

New business rule for Suppliers controller.

Use the following configuration:

Property Value
Type JavaScript
Command Name Select
Command Argument editForm1
Phase After
Script
if (this.dataView().get_lastCommandName() == 'BatchEdit') {
    $('.DataView.Suppliers_editForm1 input:checkbox')
        .attr('checked', 'checked');
}

Press OK to save. On the toolbar, press Browse.

Navigate to the Suppliers page and check the box next to several rows. Press Batch Edit (Form) option in a row context menu.

Activating the 'Batch Edit (Form)' context menu option.

When the form loads, all “update” checkboxes will be enabled.

All checkboxes are checked when the form is loaded.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com