02-11-2014 05:36 AM
I am using a datagrid to display product lines in a quote. When the quote is finalised I want to make the grid completely read-only i.e. disable the "Edit" and "delete" column links entirely. Is this possible?
02-17-2014 05:35 AM
Found a way to do this using jQuery:
- picking up the value of "finalised" from a field on the form.
- overriding the delete confirm message so it doesn't show.
- preventing the "edit" and "delete" links in the grid from working by removing the href attribute on anchor tags in the grid. Also fade the colour after the click attempt.
- display a message to the user.
var script = @"require(['dojo/ready', 'Sage/Utility'], function(ready, utility){ ready(function() { var finalised = $('#TabControl_element_QuoteProducts_element_view_QuoteProducts_QuoteProducts_Finalised').val(); if (finalised == 'True') { window.confirm = function() {}; $('#TabControl_element_QuoteProducts_element_view_QuoteProducts_QuoteProducts_grdrrigationQuoteItems a').click(function () { alert('Products cannot be edited on a finalised quote.'); $(this).fadeTo('fast',.5).removeAttr('href'); }); } }); });"; ScriptManager.RegisterStartupScript(this, GetType(), new Guid().ToString(), script, true);