Marquee Selection

Use the showMarquee property to add an Excel-style marquee to the grid. You can customize the appearance of the marquee by styling the 'wj-marquee' class. When the marquee is enabled, the grid does not highlight the active cell (like Excel). If you want to highlight the active cell, use a CSS selector based on the :focus pseudo-selector:

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as wjGrid from '@grapecity/wijmo.grid'; import * as wjCore from '@grapecity/wijmo'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // var theGrid = new wjGrid.FlexGrid('#theGrid', { alternatingRowStep: 0, showMarquee: true, itemsSource: getData(), }); // // toggle marquee styling document.getElementById('showMarquee').addEventListener('click', function (e) { theGrid.showMarquee = e.target.checked; theGrid.focus(); }); document.getElementById('customMarquee').addEventListener('click', function (e) { wjCore.toggleClass(theGrid.hostElement, 'customMarquee', e.target.checked); theGrid.invalidate(); theGrid.focus(); }); document.getElementById('highlightActive').addEventListener('click', function (e) { wjCore.toggleClass(theGrid.hostElement, 'highlightActive', e.target.checked); theGrid.focus(); }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexGrid Marquee</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <label> Show Marquee <input id="showMarquee" type="checkbox" checked="checked"> </label> <br/> <label> Custom Marquee <input id="customMarquee" type="checkbox"> </label> <br/> <label> Highlight Active Cell <input id="highlightActive" type="checkbox"> </label> <div id="theGrid"></div> </div> </body> </html> // create some random data export function getData() { var countries = 'US,UK,Germany,France,Italy,Japan,China'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], downloads: Math.round(Math.random() * 20000), sales: Math.random() * 10000, expenses: Math.random() * 5000 }); } return data; } .highlightActive .wj-cells .wj-cell:focus { background: rgba(255,150,30,.75) !important; } .customMarquee .wj-marquee { border: 8px solid rgba(255,150,30,.75); border-radius: 8px; } body { margin-bottom: 12px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import { Component, enableProdMode, NgModule, Inject, ViewChild } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjGridModule } from '@grapecity/wijmo.angular2.grid'; import * as wjcCore from '@grapecity/wijmo'; import * as wjcGrid from '@grapecity/wijmo.grid'; import { DataService } from './app.data'; @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { data: any[]; // DataSvc will be passed by derived classes constructor(@Inject(DataService) dataSvc: DataService) { this.data = dataSvc.getData(); } @ViewChild('flex') flex: wjcGrid.FlexGrid; gridGetFocus() { this.flex.focus(); } showCustomMarquee(e: Event) { wjcCore.toggleClass(this.flex.hostElement, 'customMarquee', (<HTMLInputElement>e.target).checked); this.flex.invalidate(); this.flex.focus(); } highlightActive(e: Event) { wjcCore.toggleClass(this.flex.hostElement, 'highlightActive', (<HTMLInputElement>e.target).checked); this.flex.focus(); } } @NgModule({ imports: [WjGridModule, BrowserModule, FormsModule], providers: [DataService], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexGrid Marquee</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <label> Show Marquee <input [(ngModel)]="flex.showMarquee" (click)="gridGetFocus()" type="checkbox"> </label> <br/> <label> Custom Marquee <input (click)="showCustomMarquee($event)" type="checkbox"> </label> <br/> <label> Highlight Active Cell <input (click)="highlightActive($event)" type="checkbox"> </label> <!-- the grid --> <wj-flex-grid #flex [alternatingRowStep]="0" [showMarquee]="true" [(itemsSource)]="data"> </wj-flex-grid> </div> import { Injectable } from '@angular/core'; @Injectable() export class DataService { getData(): any[] { let countries = 'US,UK,Germany,France,Italy,Japan,China'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], downloads: Math.round(Math.random() * 20000), sales: Math.random() * 10000, expenses: Math.random() * 5000 }); } return data; } } .highlightActive .wj-cells .wj-cell:focus { background: rgba(255,150,30,.75) !important; } .customMarquee .wj-marquee { border: 8px solid rgba(255,150,30,.75); border-radius: 8px; } body { margin-bottom: 12px; } <template> <div class="container-fluid"> <label> Show Marquee <input v-model="showMarquee" @click="gridGetFocus" type="checkbox"> </label> <br/> <label> Custom Marquee <input @click="showCustomMarquee($event)" type="checkbox"> </label> <br/> <label> Highlight Active Cell <input @click="highlightActive($event)" type="checkbox"> </label> <!-- the grid --> <wj-flex-grid :initialized="initGrid" :alternatingRowStep="0" :showMarquee="showMarquee" :itemsSource="data"> </wj-flex-grid> </div> </template> <script> import "@grapecity/wijmo.styles/wijmo.css"; import 'bootstrap.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.core'; import '@grapecity/wijmo.vue2.grid'; import * as wjcCore from '@grapecity/wijmo'; import { getData } from './data'; let App = Vue.extend({ name: 'app', data: function(){ return { data: getData(), flex: null, showMarquee: true } }, methods: { initGrid: function(flex){ this.flex=flex; }, gridGetFocus: function() { this.flex.focus(); }, showCustomMarquee: function(e) { wjcCore.toggleClass(this.flex.hostElement, 'customMarquee', e.target.checked); this.flex.invalidate(); this.flex.focus(); }, highlightActive: function(e) { wjcCore.toggleClass(this.flex.hostElement, 'highlightActive', e.target.checked); this.flex.focus(); } } }); new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> .highlightActive .wj-cells .wj-cell:focus { background: rgba(255,150,30,.75) !important; } .customMarquee .wj-marquee { border: 8px solid rgba(255,150,30,.75); border-radius: 8px; } body { margin-bottom: 12px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"> </div> </body> </html> // create some random data export function getData() { var countries = 'US,UK,Germany,France,Italy,Japan,China'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], downloads: Math.round(Math.random() * 20000), sales: Math.random() * 10000, expenses: Math.random() * 5000 }); } return data; } import "@grapecity/wijmo.styles/wijmo.css"; import "bootstrap.css"; import "./app.css"; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjcCore from "@grapecity/wijmo"; import * as wjcGrid from "@grapecity/wijmo.react.grid"; import { getData } from "./data"; class App extends React.Component { constructor(props) { super(props); this.state = { data: getData(), flex: null, showMarquee: true }; } render() { return <div className="container-fluid"> <label> Show Marquee <input checked={this.state.showMarquee} onChange={this.gridShowMarquee.bind(this)} onClick={this.gridGetFocus.bind(this)} type="checkbox"/> </label> <br /> <label> Custom Marquee <input onClick={this.showCustomMarquee.bind(this)} type="checkbox"/> </label> <br /> <label> Highlight Active Cell <input onClick={this.highlightActive.bind(this)} type="checkbox"/> </label> <wjcGrid.FlexGrid initialized={this.initGrid.bind(this)} alternatingRowStep={0} showMarquee={this.state.showMarquee} itemsSource={this.state.data}> </wjcGrid.FlexGrid> </div>; } initGrid(flex) { this.setState({ flex: flex }); } gridGetFocus() { this.state.flex.focus(); } gridShowMarquee(e) { this.setState({ showMarquee: (e.target).checked }); } showCustomMarquee(e) { wjcCore.toggleClass(this.state.flex.hostElement, 'customMarquee', e.target.checked); this.state.flex.invalidate(); this.state.flex.focus(); } highlightActive(e) { wjcCore.toggleClass(this.state.flex.hostElement, 'highlightActive', e.target.checked); this.state.flex.focus(); } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Grapecity Wijmo OLAP Pivot Chart Overview</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> .highlightActive .wj-cells .wj-cell:focus { background: rgba(255, 150, 30, .75) !important; } .customMarquee .wj-marquee { border: 8px solid rgba(255, 150, 30, .75); border-radius: 8px; } body { margin-bottom: 12px; } export function getData() { var countries = 'US,UK,Germany,France,Italy,Japan,China'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], downloads: Math.round(Math.random() * 20000), sales: Math.random() * 10000, expenses: Math.random() * 5000 }); } return data; }