npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fancy-grid-vue

v1.0.7

Published

FancyGrid Vue Component

Downloads

233

Readme

FancyGrid

Vue Grid Component for FancyGrid
Read more here:
https://fancygrid.com/docs/getting-started/vue

Install

Vue CLI

npm install -g @vue/cli
vue create my-project
cd my-project
npm run serve

If everything goes well, npm run serve has started the web server.
You can open the default app at localhost:8080.

As a next step, let's add the FancyGrid NPM packages. Run the following command in my-project (you may need a new instance of the terminal):

npm install --save fancygrid fancy-grid-vue

After a few seconds of waiting, you should be good to go. Let's get to the actual coding!

As this will be a simple example we can delete the src/components directory. Our example application will live in src/App.vue.

Let's add the component definition to our template. Edit app/App.vue and replace the scaffold code:

<template>
  <div id="app">
	<fancy-grid-vue :config="gridConfig"></fancy-grid-vue>
  </div>
</template>

In code above you see that we provide only one param config. It is the simplest way to provide component with grid config.

Next, let's declare the basic grid configuration. Edit src/App.vue:

<script>
import FancyGridVue from 'fancy-grid-vue';

let data = [{
  name: 'Ted',
  surname: 'Smith',
  position: 'Java Developer',
  email: '[email protected]',
  company: 'Electrical Systems',
  age: 30,
  knownledge: 'Java, Ruby'
}, {
  name: 'Ed',
  surname: 'Johnson',
  position: 'C/C++ Market Data Developer',
  email: '[email protected]',
  company: 'Energy and Oil',
  age: 35,
  knownledge: 'C++'
}, {
  name: 'Sam',
  surname: 'Williams',
  position: 'Technical Analyst',
  email: '[email protected]',
  company: 'Airbus',
  age: 38,
  knownledge: ''
}, {
  name: 'Alexander',
  surname: 'Brown',
  position: 'Project Manager',
  email: '[email protected]',
  company: 'Renault',
  age: 24,
  knownledge: ''
}, {
  name: 'Nicholas',
  surname: 'Miller',
  position: 'Senior Software Engineer',
  email: '[email protected]',
  company: 'Adobe',
  age: 33,
  knownledge: 'Unix, C/C++'
}, {
  name: 'Andrew',
  surname: 'Thompson',
  position: 'Agile Project Manager',
  email: '[email protected]',
  company: 'Google',
  age: 28,
  knownledge: ''
}, {
  name: 'Ryan',
  surname: 'Walker',
  position: 'Application Support Engineer',
  email: '[email protected]',
  company: 'Siemens',
  age: 39,
  knownledge: 'ActionScript'
}, {
  name: 'John',
  surname: 'Scott',
  position: 'Flex Developer',
  email: '[email protected]',
  company: 'Cargo',
  age: 45,
  knownledge: 'Flex'
}];

export default {
  name: 'app',
  data: function() {
    return {   
      gridConfig: {
        title: 'Vue with FancyGrid',
        theme: 'gray',
        width: 700,
        height: 400,
        data: data,
        resizable: true,
        defaults: {
          type: 'string',
          width: 100,
          sortable: true,
          editable: true,
          resizable: true
        },
        selModel: 'rows',
        trackOver: true,
        columns: [{
          type: 'select'
        },{
          index: 'company',
          title: 'Company'
        },{
          index: 'name',
          title: 'Name'
        },{
          index: 'surname',
          title: 'Sur Name'
        },{
          index: 'age',
          title: 'Age',
          type: 'number',
          width: 80
        },{
          index: 'email',
          title: 'Email',
          width: 160
        }]
      }
    }
  },
  components: {
    FancyGridVue
  }
}
</script>

It could be needed to re-run npm run serve.
Also check the terminal on errors.
If everything works as expected, you should see a simple grid.

The code above is the simplest way to use FancyGrid with Vue.
Let us change it to Vue code style that your app looks better.
In FancyGrid you can define properties, events and use reactivity like in Vue.

Let's change the component template. Edit app/App.vue and replace the code to:

<template>
  <div id="app">
	<fancy-grid-vue 
	  :title="title"
      :theme="'gray'"
      :width="width"
      :height="height"
      :data="data"
      :resizable="true"
      :defaults="defaults"
      :sel-model="'rows'"
      :trackOver="true"
      :columns="columns">
	</fancy-grid-vue>
  </div>
</template>

Almost all properties from grid API are available for Vue wrapper.
Except: renderTo, renderOuter.
Also you need to remember that camelCase properties should be replaced with kebab code style.
selModel to sel-model

Next, let's change the grid configuration. Edit src/App.vue:

<script>
import FancyGridVue from 'fancy-grid-vue';
export default {
  name: 'app',
  data: function(){
    return {
	  title: "Vue with FancyGrid",
	  theme: "gray",
	  width: 700,
	  height: 400,
	  data: this.getData(),
	  defaults: this.getDefaults(),
	  columns: this.getColumns()
    };
  },
  methods: {
    getColumns: function(){
	  return [{
	    type: 'select'
	  },{
	    index: 'company',
	    title: 'Company'
	  },{
	    index: 'name',
	    title: 'Name'
	  },{
	    index: 'surname',
	    title: 'Sur Name'
	  },{
	    index: 'age',
	    title: 'Age',
	    type: 'number',
	    width: 80
	  },{
  	    index: 'email',
	    title: 'Email',
	    width: 160
	  }];
    },
    getDefaults: function(){
	  return {
  	    type: 'string',
	    width: 100,
	    sortable: true,
	    editable: true,
	    resizable: true
	  };
    },
    getData: function(){
	  return [{
	    name: 'Ted',
	    surname: 'Smith',
	    position: 'Java Developer',
	    email: '[email protected]',
	    company: 'Electrical Systems',
	    age: 30,
	    knownledge: 'Java, Ruby'
	  }, {
	    name: 'Ed',
	    surname: 'Johnson',
	    position: 'C/C++ Market Data Developer',
	    email: '[email protected]',
	    company: 'Energy and Oil',
	    age: 35,
	    knownledge: 'C++'
	  }, {
	    name: 'Sam',
	    surname: 'Williams',
	    position: 'Technical Analyst',
	    email: '[email protected]',
	    company: 'Airbus',
	    age: 38,
	    knownledge: ''
	  }, {
	    name: 'Alexander',
	    surname: 'Brown',
	    position: 'Project Manager',
	    email: '[email protected]',
	    company: 'Renault',
	    age: 24,
	    knownledge: ''
	  }, {
	    name: 'Nicholas',
	    surname: 'Miller',
	    position: 'Senior Software Engineer',
	    email: '[email protected]',
	    company: 'Adobe',
	    age: 33,
	    knownledge: 'Unix, C/C++'
	  }, {
	    name: 'Andrew',
	    surname: 'Thompson',
	    position: 'Agile Project Manager',
	    email: '[email protected]',
	    company: 'Google',
	    age: 28,
	    knownledge: ''
	  }, {
	    name: 'Ryan',
	    surname: 'Walker',
	    position: 'Application Support Engineer',
	    email: '[email protected]',
	    company: 'Siemens',
	    age: 39,
	    knownledge: 'ActionScript'
	  }, {
	    name: 'John',
	    surname: 'Scott',
	    position: 'Flex Developer',
	    email: '[email protected]',
	    company: 'Cargo',
	    age: 45,
	    knownledge: 'Flex'
	  }];
    }
  },
  components: {
    FancyGridVue
  }
}
</script>

We got the same grid but with nicer code.
In code above we change data and adding methods to that code looks cleaner.

Support

If you need any assistance or would like to report any bugs found in FancyGrid, please contact us at [email protected]