Hello,
Is there a way to force the grid to finish an edit when it loses focus? I tried to call grid.editEditing() in the onblur event of a surrounding div, but the onblur event only fires when not editing.
Thanks in advance!
Daniel
Hello,
Is there a way to force the grid to finish an edit when it loses focus? I tried to call grid.editEditing() in the onblur event of a surrounding div, but the onblur event only fires when not editing.
Thanks in advance!
Daniel
Try modalEditing:true
works!
Exactly what I needed.
Thanks for answering even the novice questions (with amazing response time).
Encountered a hitch here: when modalEditing=true the event that ended the edit was consumed. For example, if the event is a button click elsewhere, the click never surfaces to the button. Any way to fix that?
JohnBlack,
Is this the right thread for your reply? I don’t see how this thread applies.
Hy johnsondanielj,
I’ve re-read your post for 10 times and I think you’re right.
It’s my mistake. Sorry.
Now, let me see if I’m getting it right this time:
You editing your’re grid and while in editing mode you click on a button elsewhere on your page and the event that should be trigged by the button click don’t fires?
If that’s the case all that I can tell you is that I’m using list grid’s with modalEditing:true and just now I’ve tested by clicking on an button from my page while editing and the button fired normaly.
Hi JohnBlack,
Thanks for your reply. Please try the example below. To get the click event, I have to click the “hi” button twice:
example.html:
<html>
<head>
</head>
<body>
<table>
<tr>
<td><div id="gridContainerDivSCGrid1"></div></td>
</tr>
</table>
<button onclick="alert('hi')">hi</button>
<br/>
<SCRIPT>var isomorphicDir="../../scripts/isomorphic/";</SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_Core.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_Foundation.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_Containers.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_Grids.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_Forms.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/system/modules/ISC_DataBinding.js"></SCRIPT>
<SCRIPT SRC="../../scripts/isomorphic/skins/SmartClient/load_skin.js"></SCRIPT>
<script language="javascript">
var fieldData_SCGrid1 = [
{name:'ItemID',title:'ItemID',required:true},
{name:'Description',title:'Description'},
{name:'DiscountPerc',title:'DiscountPerc'},
{name:'Taxable',title:'Taxable'},
{name:'CurrencyID',title:'CurrencyID'},
{name:'CurrencyExchangeRate',title:'CurrencyExchangeRate'},
{name:'ItemCost',title:'ItemCost'},
{name:'ItemUnitPrice',title:'ItemUnitPrice'},
{name:'_pk',title:'_pk',hidden:true,primaryKey:true},
{name:'CompanyID',title:'CompanyID',hidden:true},
{name:'DivisionID',title:'DivisionID',hidden:true},
{name:'DepartmentID',title:'DepartmentID',hidden:true},
{name:'InvoiceNumber',title:'InvoiceNumber',hidden:true},
{name:'InvoiceLineNumber',title:'InvoiceLineNumber',hidden:true}];
isc.RestDataSource.create({ID:"gridData_SCGrid1",
dataFormat:"json",
fields:fieldData_SCGrid1,
fetchDataURL:"example_fetch_response.json",
addDataURL:"irrelevant_to_example_but_present",
updateDataURL:"irrelevant_to_example_but_present",
removeDataURL:"irrelevant_to_example_but_present"
});
var grid_SCGrid1 = ListGrid.create({fields:[
{name:'ItemID',title:'ItemID',required:true},
{name:'Description',title:'Description'},
{name:'DiscountPerc',title:'DiscountPerc'},
{name:'Taxable',title:'Taxable'},
{name:'CurrencyID',title:'CurrencyID'},
{name:'CurrencyExchangeRate',title:'CurrencyExchangeRate'},
{name:'ItemCost',title:'ItemCost'},
{name:'ItemUnitPrice',title:'ItemUnitPrice'}],
dataSource:"gridData_SCGrid1",
width:'84%',
height:'80px',
alternateRecordStyles:true,
autoFetchData:true,
position:"relative",
listEndEditAction:"next",
modalEditing:true,
canEdit:true,
id:'grid_SCGrid1'});
grid_SCGrid1.setHtmlElement(document.getElementById('gridContainerDivSCGrid1'));
grid_SCGrid1.startEditingNew();
</script>
</body>
example_fetch_response.json:
{response:
{status:0,
startRow:0,
endRow:3,
totalRows:3,
isDSResponse:true,
invalidateCache:false,
data:[
{ItemID:'BBB',Description:'Bigger Bowling Ball',DiscountPerc:'0',Taxable:'False',CurrencyID:'USD',CurrencyExchangeRate:'1',ItemCost:'0.0000',ItemUnitPrice:'0.0000'},
{ItemID:'ABC',Description:'Another Item',DiscountPerc:'0',Taxable:'True',CurrencyID:'USD',CurrencyExchangeRate:'1',ItemCost:'0.0000',ItemUnitPrice:'0.0000'},
{ItemID:'DEF',Description:'Yet another item',DiscountPerc:'0',Taxable:'True',CurrencyID:'USD',CurrencyExchangeRate:'1',ItemCost:'0.0000',ItemUnitPrice:'0.0000'}]}
}
Thank you for your help!
Hy johnsondanielj,
I’ve tried and it happens as you said.
But the way I’m doing it is diffrent: I use SmartClient Button class when I create the Button.
isc.Button.create({
ID:"myButtonID",
title:"hi",
click:"alert('hi')"
});
and it works ok.
If u’re not restricted by any other requests from u’re clients I suggest to use to the minumum native html.
However it’ll be intresting what’s Isomorphic opinion on this subject.
Hi JohnBlack, johnsondanielj,
Very, very long story, but in a nutshell it’s not currently possible to support a feature like modalEditing:true in combination with native HTML buttons without blocking that first click. It has to do with several interlocking bugs related to focus handling and keyboard events on IE.
As JohnBlack pointed out, behavior is normal with SmartClient Buttons and we recommend using SmartClient controls everywhere you can, so you never have to deal with cross-platform issues.
Hmmm… Unfortunate for me. I was hoping to ease my way into a transition to isc controls.
The offending context happens to be <gasp!> ASP.NET,.. SO I guess if I want this to work I’ll have to make the isc button do a postback, asp.net-style, something like:
isc.Button.create({
ID:“myButtonID”,
title:“hi”,
click:“<% ClientScript.GetPostBackEventReference(…) %>”
});
bleck! But that only takes care of the button and not a number of other controls. Woe…
If you have other ideas/workarounds that don’t involve an all-out-asp.net-drop-kick (as this is a general issue for any non-ISC interaction anyway), I’d love to hear them.
Thanks for your replies.
Hi Johnson,
With a little effort it should be possible to reproduce the modalEditing:true feature without stealing the first click from your ASP.NET controls.
We’d recommend starting with a Page.setEvent(“click”, action). If SmartClient reports the target as null it’s not on a SmartClient widget, and is probably correct to call grid.endEditing().
Sorry we can’t say definitively, but it depends on how friendly ASP.NET controls are in terms of interoperability with Ajax frameworks.