PDA

View Full Version : How to insert an editiable checkbox column into the Grid Spreadsheet?



vasa
Feb 14, 2017, 8:46 PM
Hi there,

I am quite new to Ext.Net MVC we have a Grid Spreadsheet created using the Overview example. Now we require to insert a Checkbox which will show and allow enable disable 'Hide in Portal' attribute which is stored in database and in our model.

Currently we have it functioning with the boolean values (true, false) shown and editable using the following bit of code:


X.ColumnFor(Model, m => m.PortalHide).ToBuilder<Column.Builder>()
.Flex(1)
.ID("PortalHide")
.Align(ColumnAlign.Start)
.Editor(X.TextField().NoteEncode(true).AllowBlank( false).StandardVtype(ValidationType.None).MaxLengt h(5).MaxLengthText("The maximum length for this field is 5."))
//.Renderer(RendererFormat.Checkbox)
.Text("Hide in Portal")
.Filter(X.ListFilter().Options(@ViewBag.portalHide List)),


Trying various snippets to insert a functional checkbox has been unsuccessful. Any help is appreciated.

Here's a bit more of the column list showing


.ColumnModel(
X.ColumnFor(Model, m => m.ID).ToBuilder<Column.Builder>()
.Renderer("return record.phantom ? '' : value;")
.Hidden(true),
X.ColumnFor(Model, m => m.ProductID).ToBuilder<Column.Builder>()
.Hidden(true),
X.ColumnFor(Model, m => m.AOGCategory).ToBuilder<Column.Builder>()
.Flex(1)
.ID("AOGCategory")
.Align(ColumnAlign.Start)
.Editor(X.TextField().NoteEncode(true).AllowBlank( true).StandardVtype(ValidationType.None).MaxLength (100).MaxLengthText("The maximum length for this field is 100."))
.Filter(X.ListFilter().Options(@ViewBag.categoryLi st)),
X.ColumnFor(Model, m => m.PortalHide).ToBuilder<Column.Builder>()
.Flex(1)
.ID("PortalHide")
.Align(ColumnAlign.Start)
.Editor(X.TextField().NoteEncode(true).AllowBlank( false).StandardVtype(ValidationType.None).MaxLengt h(5).MaxLengthText("The maximum length for this field is 5."))
//.Renderer(RendererFormat.Checkbox)
.Text("Hide in Portal")
.Filter(X.ListFilter().Options(@ViewBag.portalHide List))
)

fabricio.murta
Feb 15, 2017, 10:52 AM
Hello @vasa! And welcome to Ext.NET forums!

I believe you would need to explicitly use the Html.X().CheckColumn() in that case. You can still bind the DataIndex as you do with ColumnFor, something similar to this:



X.CheckColumn().DataIndex(Model, m => m.PortalHide)


I hope this helps!

vasa
Feb 16, 2017, 7:43 PM
Hey thanks alot for that it worked fine. Unreal how may combinations of those commands/code bits we tried, we even tried the X.ChecColumn() but a couple of other things in there stopped it from working.

Now here is the million dollar question :-) is there any documentation, references, help or trainning courses on Ext.Net MVC out there anywhere that we can get hold of?

Becuase it is quite frustrating when we get into a block often on a simple thing. We rely heavily on the Examples on the Ext.Net website often it negates the advatage we have with Ext.Net which is cut down on the development time.

Thanks again and sorry for my late reply.

Cheers,
Vasa

fabricio.murta
Feb 17, 2017, 12:26 PM
Hello @Vasa, glad it helped you!

Well, the resources I can think of are:

The Examples Explorer

Even though you may be working with MVC, using the MVC Examples Explorer (http://mvc.ext.net/) only may not be sufficient, but the WebForms Examples Explorer (http://examples.ext.net/) has more examples and can be used for insight on what can be done on MVC -- whatever can be done in WebForms can be done in MVC -- they weren't ported to the MVC version because they would just be redundant there.

The Ext.NET forums

The forums is the best backlog we have about issues users have been thru since the first release of Ext.NET. Before any question you make, searching the forums beforehand is a must as your answer can already be answered here somewhere. Premium subscription to the forums would earn you high priority response to all your inquiries, but the community forums are open for all to participate. I usually myself search the forums using google with a search filtering the forums website (site:forums.ext.net <my_search_here>).

There are also a huge amount of examples provided among the various threads, both as test cases, and solutions.

Underlying framework documentation

This may not help much with Razor syntax or maybe figuring out the field to use (like in this case) but will surely help you know what you can use and when/where for the components you are working with. The documentation is thorough, we copy over basic content to the Ext.NET server side components' IntelliSense help, but they are undoubtely the most comprehensive documentation on the components. The current framework is ExtJS 6.2.1 which documentation is here: http://docs.sencha.com/extjs/6.2.1/classic/Ext.html

Ext.NET API reference

We maintain an online API reference in http://docs.ext.net/

Ext.NET book

It is reasonably old -- was released by the times of Ext.NET 2 -- but can still be used for a fairly good reference on using Ext.NET as still a considerable amount of the "way of thinking" an application is kept in.

Here's our blog post about the book when it was released, back in 2012: New Book: Ext.NET Web Application Development (http://ext.net/new-book-ext-net-web-application-development/)

Sencha forums

When the issue remains on the underlying framework's usage, the Sencha forums is a great library of questions and answers, the same searching with google tips to our forums applies here. The forums are available at http://www.sencha.com/forum/

Formal Courses

I'm not really aware of Ext.NET training courses around and we'll encourage companies offering these to announce in our forums. Maybe a good section would be Open Discussions forum (http://forums.ext.net/forumdisplay.php?6-Open-Discussions).

Hope this helps!

vasa
Feb 19, 2017, 9:04 PM
Sweet! Thanks Fabricio :-)