Customer Order | Customer Sale | |
---|---|---|
Country* |
|
|
Product* |
|
|
Price* |
|
|
Date |
|
|
Settings
Description
This sample shows how to use TabOrder for controls. The 'Default' setting shows the controls without the TabOrder property . The 'Customized' setting specifies the TabOrder property for each control, a tab order that follows relationships in the content without following the order of the interactive elements in the code.
TabIndex attribute value can be defined statically for a Wijmo control by specifying it on the control's host HTML element. But this value can't be changed later during application lifecycle, because Wijmo controls have complex structure, and the control may need to propagate this attribute value to its internal element to work properly.
Because of this, to read or change control's tabindex dynamically, you should do it using TabOrder property.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | using C1.Web.Mvc; using C1.Web.Mvc.Serialization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MvcExplorer.Models; using System.Collections.Generic; namespace MvcExplorer.Controllers { public partial class TabOrderController : Controller { private readonly ControlOptions _optionModel = new ControlOptions { Options = new OptionDictionary { { "Tab Order" , new OptionItem{ Values = new List< string > { "Default" , "Customized" }, CurrentValue = "Default" }} } }; public ActionResult Index(IFormCollection collection) { _optionModel.LoadPostData(collection); ViewBag.DemoOptions = _optionModel; return View(); } public ActionResult GetCustomerOrder([C1JsonRequest] CollectionViewRequest<CustomerOrder> requestData) { return this .C1Json(CollectionViewHelper.Read(requestData, CustomerOrder.GetCountryGroupOrderData())); } public ActionResult GetCustomerSale([C1JsonRequest] CollectionViewRequest<Sale> requestData) { return this .C1Json(CollectionViewHelper.Read(requestData, CustomerSale.GetData(10))); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | @ { ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; string tabOrder = optionsModel.Options[ "Tab Order" ].CurrentValue; } < div class = "container-fluid" > < div class = "row" > < div class = "col-md-7 col-md-offset-2" style = "text-align:center; max-width: 660px;" > @if (tabOrder == "Customized" ) { < table class = "input-form" > < tr > < th ></ th > < th >Customer Order</ th > < th >Customer Sale</ th > </ tr > < tr > < th >Country*</ th > < td > < c1-combo-box id = "orderCountry" is-required = "true" tab-order = "1" > < c1-items-source source-collection = "@Countries.GetCountries()" ></ c1-items-source > </ c1-combo-box > </ td > < td > < c1-combo-box id = "saleCountry" is-required = "true" tab-order = "5" > < c1-items-source source-collection = "@Countries.GetCountries()" ></ c1-items-source > </ c1-combo-box > </ td > </ tr > < tr > < th >Product*</ th > < td > < c1-combo-box id = "orderProduct" is-required = "true" tab-order = "2" > < c1-items-source source-collection = "@Products.GetProducts()" ></ c1-items-source > </ c1-combo-box > </ td > < td > < c1-combo-box id = "saleProduct" is-required = "true" tab-order = "6" > < c1-items-source source-collection = "@Products.GetProducts()" ></ c1-items-source > </ c1-combo-box > </ td > </ tr > < tr > < th >Price*</ th > < td > < c1-input-number id = "orderPrice" min = "0" step = "10" value = "0" format = "c0" is-required = "true" tab-order = "3" > </ c1-input-number > </ td > < td > < c1-input-number id = "salePrice" min = "0" step = "10" value = "0" format = "c0" is-required = "true" tab-order = "7" > </ c1-input-number > </ td > </ tr > < tr > < th >Date</ th > < td > < c1-input-date id = "orderDate" value = "@DateTime.Today" is-required = "false" tab-order = "4" > </ c1-input-date > </ td > < td > < c1-input-date id = "saleDate" value = "@DateTime.Today" is-required = "false" tab-order = "8" > </ c1-input-date > </ td > </ tr > </ table > } else { < table class = "input-form" > < tr > < th ></ th > < th >Customer Order</ th > < th >Customer Sale</ th > </ tr > < tr > < th >Country*</ th > < td > < c1-combo-box id = "orderCountry" is-required = "true" > < c1-items-source source-collection = "@Countries.GetCountries()" ></ c1-items-source > </ c1-combo-box > </ td > < td > < c1-combo-box id = "saleCountry" is-required = "true" > < c1-items-source source-collection = "@Countries.GetCountries()" ></ c1-items-source > </ c1-combo-box > </ td > </ tr > < tr > < th >Product*</ th > < td > < c1-combo-box id = "orderProduct" is-required = "true" > < c1-items-source source-collection = "@Products.GetProducts()" ></ c1-items-source > </ c1-combo-box > </ td > < td > < c1-combo-box id = "saleProduct" is-required = "true" > < c1-items-source source-collection = "@Products.GetProducts()" ></ c1-items-source > </ c1-combo-box > </ td > </ tr > < tr > < th >Price*</ th > < td > < c1-input-number id = "orderPrice" min = "0" step = "10" value = "0" format = "c0" is-required = "true" > </ c1-input-number > </ td > < td > < c1-input-number id = "salePrice" min = "0" step = "10" value = "0" format = "c0" is-required = "true" > </ c1-input-number > </ td > </ tr > < tr > < th >Date</ th > < td > < c1-input-date id = "orderDate" value = "@DateTime.Today" is-required = "false" > </ c1-input-date > </ td > < td > < c1-input-date id = "saleDate" value = "@DateTime.Today" is-required = "false" > </ c1-input-date > </ td > </ tr > </ table > } < br /> < button id = "add-row" class = "btn btn-primary col-sm-offset-2" > < b >< i class = "glyphicon-plus" ></ i > Add Data</ b > </ button > < br /> </ div > < br /> < br /> < div class = "col-md-12" > < div class = "col-md-6" > < label >Customer order</ label > < c1-flex-grid id = "order" class = "grid" auto-generate-columns = "false" allow-add-new = "true" height = "200px" selection-mode = "Row" is-read-only = "true" > < c1-flex-grid-column binding = "ID" width = "40" ></ c1-flex-grid-column > < c1-flex-grid-column binding = "OrderTime" width = "100" ></ c1-flex-grid-column > < c1-flex-grid-column binding = "Country" width = "100" > < c1-data-map display-member-path = "Name" selected-value-path = "Name" sort-by-display-values = "true" > </ c1-data-map > </ c1-flex-grid-column > < c1-flex-grid-column binding = "Product" width = "100" > < c1-data-map display-member-path = "Name" selected-value-path = "Name" sort-by-display-values = "true" > </ c1-data-map > </ c1-flex-grid-column > < c1-flex-grid-column binding = "Price" format = "c" width = "100" ></ c1-flex-grid-column > < c1-items-source read-action-url = "@Url.Action(" GetCustomerOrder ")" disable-server-read = "true" ></ c1-items-source > </ c1-flex-grid > </ div > < div class = "col-md-6" > < label >Customer Sale</ label > < c1-flex-grid id = "sale" class = "grid" auto-generate-columns = "false" allow-add-new = "true" height = "200px" selection-mode = "Row" is-read-only = "true" > < c1-flex-grid-column binding = "ID" width = "40" ></ c1-flex-grid-column > < c1-flex-grid-column binding = "Start" width = "100" ></ c1-flex-grid-column > < c1-flex-grid-column binding = "Country" width = "100" > < c1-data-map display-member-path = "Name" selected-value-path = "Name" sort-by-display-values = "true" > < c1-items-source source-collection = "@FullCountry.GetCountries()" ></ c1-items-source > </ c1-data-map > </ c1-flex-grid-column > < c1-flex-grid-column binding = "Product" width = "100" > < c1-data-map display-member-path = "Name" selected-value-path = "Id" sort-by-display-values = "true" > < c1-items-source source-collection = "@CustomerSale.PRODUCTS" ></ c1-items-source > </ c1-data-map > </ c1-flex-grid-column > < c1-flex-grid-column binding = "Amount" format = "c" width = "100" ></ c1-flex-grid-column > < c1-items-source read-action-url = "@Url.Action(" GetCustomerSale ")" disable-server-read = "true" ></ c1-items-source > </ c1-flex-grid > </ div > </ div > </ div > </ div > @section Styles{ < style > .input-form td, th { padding: 0.5rem; } .input-form .wj-template{ width:240px; } </ style > } @section Scripts{ <script> c1.documentReady( function () { let cOrderGrid = wijmo.Control.getControl( "#order" ) let orderCountry = wijmo.Control.getControl( "#orderCountry" ); let orderProduct = wijmo.Control.getControl( "#orderProduct" ); let orderPrice = wijmo.Control.getControl( "#orderPrice" ); let orderDate = wijmo.Control.getControl( "#orderDate" ); let cSaleGrid = wijmo.Control.getControl( "#sale" ); let saleCountry = wijmo.Control.getControl( "#saleCountry" ); let saleProduct = wijmo.Control.getControl( "#saleProduct" ); let salePrice = wijmo.Control.getControl( "#salePrice" ); let saleDate = wijmo.Control.getControl( "#saleDate" ); document.getElementById( 'add-row' ).addEventListener( 'click' , function (e) { //add new row to Order grid cOrderGrid.focus(); let oview = cOrderGrid.editableCollectionView; let onewItem = oview.addNew(); onewItem.ID = oview.items.length; onewItem.OrderTime = orderDate.value; onewItem.Country = orderCountry.selectedValue; onewItem.Product = orderProduct.selectedValue; onewItem.Price = orderPrice.value; oview.commitNew(); //add new row to Sale grid cSaleGrid.focus(); let sview = cSaleGrid.editableCollectionView; let snewItem = sview.addNew(); snewItem.ID = sview.items.length; snewItem.Start = saleDate.value; snewItem.Country = saleCountry.selectedValue; snewItem.Product = saleProduct.selectedValue; snewItem.Amount = salePrice.value; sview.commitNew(); e.preventDefault(); // don't submit the form }); }) </script> } @section Settings{ @await Html.PartialAsync( "_OptionsMenu" , optionsModel) } @section Summary{ < p > @Html .Raw(TabOrderRes.TabOrder_Text0)</ p > } @section Description{ < p > @Html .Raw(TabOrderRes.TabOrder_Description_Text0)</ p > < p > @Html .Raw(TabOrderRes.TabOrder_Description_Text1)</ p > < p > @Html .Raw(TabOrderRes.TabOrder_Description_Text2)</ p > } |