Validation Message when deleting a row in a data grid

Posted by Deshani De Soyza on 23-Jan-2017 00:45

Hello,

Is there a possible way to give some validation messages when trying to delete a record/row in a grid?

All Replies

Posted by Rajkumar Mateti on 23-Jan-2017 00:53

Hi,

We have "Validate Record Data" trigger which will validate the record data. Configure it to run "Before Delete" timing.

Hope this helps.

Thanks,

Rajkumar

Posted by Deshani De Soyza on 23-Jan-2017 01:05

Hi Rajkumar,

I need to validate the grid row in client side using scripts or any other way preferred before submit to save.

Posted by mpiscoso@gmail.com on 23-Jan-2017 23:34

Hello and Good Day,

You may try the script below:

<script>

$(function() {

//Add handler to all delete links

$('[id*="rbi_gridTable"]').each(function(index, element) { //Look through all grids and override the existing delete links in the page

       $(this).find('.actionCol').each(function(index, element) { //actionCol element holds the delete link element

        var delLink = $(this).find('a').first();

if (delLink.length > 0) overrideDelete( delLink );

       });

   });

});

function onCreate(gridNo,gridRow) { //appended to the oncreate of the grid to override the link when a row is created

overrideDelete( $('#rbi_gridRow_'+gridNo+'_'+gridRow+' .actionCol').first().find('a').first() );

}

function overrideDelete(element) {

var clonedElement = $(element).clone(); //Clone the delete element to retain the onclick, needed if confirmation is true

$(element).attr('onClick','').on('click', function(){ //remove onclick of the original element and append your own

var x = confirm('Are you sure you want to delete this row?'); //check if the person really wants to delete the row

if (x) clonedElement.click(); //delete if he does

});

}

</script>

Required:

- add onCreate(##,@@); to your grid control's oncreate property.

You may then play around with what I did to suit your needs.

The main thing I did is to override the delete links' onclick to be able to append your own.

Hope that helps.

This thread is closed