How to insert an editiable checkbox column into the Grid Spreadsheet?

  1. #1

    How to insert an editiable checkbox column into the Grid Spreadsheet?

    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).MaxLength(5).MaxLengthText("The maximum length for this field is 5."))
                                   //.Renderer(RendererFormat.Checkbox)
                                    .Text("Hide in Portal")
                                    .Filter(X.ListFilter().Options(@ViewBag.portalHideList)),
    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.categoryList)),
                            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).MaxLength(5).MaxLengthText("The maximum length for this field is 5."))
                                   //.Renderer(RendererFormat.Checkbox)
                                    .Text("Hide in Portal")
                                    .Filter(X.ListFilter().Options(@ViewBag.portalHideList))                                                           
                     )
  2. #2
    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!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Thanks Fabricio it worked :-)

    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
  4. #4
    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 only may not be sufficient, but the WebForms Examples Explorer 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

    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.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Sweet! Thanks Fabricio :-)

Similar Threads

  1. [CLOSED] Insert command column into grid
    By RCN in forum 3.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 30, 2015, 6:44 PM
  2. [CLOSED] Spreadsheet to Grid - COPY PASTE possibility
    By FpNetWorth in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 26, 2013, 11:54 AM
  3. Checkbox Column in Grid Panel
    By Rajesh in forum 2.x Help
    Replies: 2
    Last Post: Dec 26, 2012, 11:21 AM
  4. Replies: 5
    Last Post: Dec 26, 2011, 5:39 AM
  5. Ext.Net Grid Checkbox Column Problem
    By sumesh in forum 1.x Help
    Replies: 7
    Last Post: Oct 29, 2011, 9:35 AM

Tags for this Thread

Posting Permissions