I am using the new BoundCheckBoxField and I want it to postback each time the checkbox is clicked so I can update the database.
Is this possible?
I really don't want to have an "update" button anywhere and this is the ONLY column in the grid that is editable.
Hi RBonser,
This should be possible. There is no autopostback flag, but you can commit the value. What you should do is handle the ValueChanged client event off of the EditingCore behavior. In that, you could check for the correct column key and then call commit off of the editing core behavior.
var grid = $find("WebDataGrid1");
var editingCore = grid.get_behaviors().get_editingCore();
editingCore.commit();
You may need to handle the RowUpdating or RowUpdated server event for EditingCore in order to make row updating not do its batch mode. I think commit is fixed so it should go back. Hopefully this is what you're looking for. Let me know if you have any other trouble with the new column or see room for improvement in it.
regards,David Young
This isn't working. The javaScript runs through just fine, but commit is not doing anything.
I am handeling both RowUpdating and RowUpdated server events and they are never hit. Nothing happens when I check the checkbox.
I have also turned off AutoCrud since I need to handle the update myself (doesn't work even when AutoCrud is on).
<ig:EditingCore AutoCRUD="False"> <EditingClientEvents CellValueChanged="whdgPEPs_Editing_CellValueChanged" CellValueChanging="whdgPEPs_Editing_CellValueChanging" /> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="ProjectNumber" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="PrjResp" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="Status" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="DueDate" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="StatusChangeBy" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="StatusChangeDate" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="ClientName" ReadOnly="True" /> </ColumnSettings> </ig:CellEditing> </Behaviors></ig:EditingCore>
ClientSide:
function whdgPEPs_Editing_CellValueChanging(grid, eventArgs){ ///<param name="eventArgs" type="Infragistics.Web.UI.CancelCellValueChangeEventArgs"></param>
var cell = eventArgs.get_cell(); var row = cell.get_row();
var isPM = row.get_cellByColumnKey('PrjResp').get_text() == 'PM';
if (!isPM) { eventArgs.set_cancel(true) }}
function whdgPEPs_Editing_CellValueChanged(grid, eventArgs){ ///<param name="eventArgs" type="Infragistics.Web.UI.CellValueChangedEventArgs"></param>
editingCore.commit();}
Server Side:
protected void whdgPEPs_RowUpdated(object sender, RowUpdatedEventArgs e){
}
protected void whdgPEPs_RowUpdating(object sender, RowUpdatingEventArgs e){ long pepID = (long)e.Row.DataKey[0];
tblPEP_Master pep = tblPEP_Master.GetRecord(pepID);
if (pep != null) { pep.Confidential = (bool)e.Row.Items[(int)GridColumns.Confidential].Value; tblPEP_Master.Update(pep); }}
Okay, it appears that commit does not work when the grid is set to EnableAjax="False"
I have disabled Ajax because my grid is inside of an update panel and I use that for Ajax instead of the Grid so that I can use a common AjaxProgressIndicator and I have outside items that effect the grid (such as a pagesize chooser).
How can I make commit work with EnableAjax set to false?
Hi,
You appear to be correct about that. I believe that is a bug. You should be able to force it to commit with this code after calling editingCore.commit();
var eventArgs = new $IG.CancelBehaviorEventArgs(editingCore);
eventArgs._props[1] =grid._enableAjax ? 2 : 1;
grid._raiseClientEventEnd(eventArgs);
I will submit a bug about this.
-Dave
That worked. Thanks.
Hello,
I have also noticed that this issue is fixed by development (Issue ID# 82029) and updates should be merged in next service release. Here is a link to service release schedule:
<http://es.infragistics.com/support/service-releases.aspx#ServiceReleases>
Update me if you have any further questions with this matter.