PDA

View Full Version : .Net Core Syntax



Fahd
Jun 02, 2023, 3:47 PM
I am trying to find example to convert my below code/Syntax to new .net core that I couldn't find. I can see now Editor as 'modelEditor' property but not sure how do I set properties and Listensers with the 'modelEditor'.


<ext:Column ID="Column16" renderer="testRenderer" >
<Editor>
<ext:NumberField ID="nfStandardBatchesMixed" runat="server" HideTrigger="true" KeyNavEnabled="false"
SelectOnFocus="true">
<Listeners>
<Focus Handler="if(this.getValue() == 0)this.setValue('');" />
<SpecialKey Fn="editorKeyDown" />
</Listeners>
</ext:NumberField>
</Editor>

</ext:Column>

fabricio.murta
Jun 04, 2023, 11:26 PM
Hello, @Fahd!

Would you mind editing your message to wrap the code block between
tags?

As for the actual question, I get you see the editor with editorModel in the Grid Panel > Editable > Editor with DirectMethod example (https://examples.ext.net/#/gridpanel/editable/editor_with_directmethod), right?

The editorModel variable is okay for simple components without many options, but as you get fancy, it may become a bit convoluted to determine all in a single quote/dblquote enclosed space.

In the example pointed above, for instance, it is possible to add this to the code block @{ } in the top of the page:



var editorNumberField = new NumberField();
editorNumberField.Listeners.Focus.Handler = "if (this.getValue() == 0) this.setValue('');";
editorNumberField.Listeners.SpecialKey.Fn = "editorKeyDown";


Then add this to the JavaScript block in the page:



var editorKeyDown = function(a, b, c, d) {
Ext.toast("Key pressed in editor: " + b.keyCode);
}


Finally, pick one of the NumberField() editors and bind this variable, say, pctChange and make it use the custom component:



<ext-column text="Change" dataIndex="pctChange" renderer="pctChange" editorModel="editorNumberField">


And you should get the listeners attached to the editor.

The editorNumberField component could also be set as a property/field in the model code (equivalent to "code behind" in Ext.NET 5), and bound to the component likewise.

Unfortunately, at this time markup is not supported.

Hope this helps!