Hi
I have a view where I want to display the page with an empty grid that shows the spinner, then load the data for the grid
This is the outline of what I'm trying:
<script>
function loadData() {
document.getElementById('testGrid').ej2_instances[0].showSpinner();
// then load data and update the grid
}
</script>
<div id="testGridholder">
<ejs-grid id="testGrid" created="loadData"></ejs-grid>
<input type="button" onclick="loadData()" value="reload" />
</div>
Problem is, when the page first displays, the spinner isn't displayed.
If I click 'reload', the spinner is displayed as expected.
What do I need to change to get the spinner to display at the start?
Thanks
|
[index.cshtml]
function created(args) {
setTimeout(()=>{
// show the spinner after some time interval
document.getElementById('testGrid').ej2_instances[0].showSpinner();
},200)
getData(args); // get the data for Grid
}
|
|
[index.cshtml]
<ejs-grid id="testGrid" created="created" allowPaging="true" height="190">
// define the Grid columns
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" width="125"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="120"></e-grid-column>
<e-grid-column field="ShipCountry" headerText="Ship Country" width="165"></e-grid-column>
<e-grid-column field="Freight" headerText="Freight" width="150"></e-grid-column>
</e-grid-columns>
</ejs-grid>
|
Thanks - that works for me.
(I do have the column bindings in my actual code - just removed it to make the example simpler)
One other quick question:
With the DatePicker - how do I centre the text on the date in the control with CSS?
I tried using .e-input-group.e-control-wrapper with text-align: center; but it doesn't work.
Thanks
|
<style>
.e-datetimepicker.e-input {
text-align: center;
}
</style>
|