revolist / revogrid

Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
https://rv-grid.com
MIT License
2.79k stars 176 forks source link

Vanilla Example #462

Open JohnRSim opened 3 years ago

JohnRSim commented 3 years ago

Can you provide a vanilla example similar to select?

Thanks

hightowertech commented 1 year ago

i doubt this helps cause it isnt helping me, but this is how a different plugin does it: https://codesandbox.io/s/revogrid-staticjs-column-jvztc?file=/index.html

no clue how to make that work on this plugin

hightowertech commented 1 year ago

grid.columnTypes = { 'date': new index.Revogrid.DateColumnType() }; this will make it show the calendars but i dont think this was made for use without webpack cause the next error comes when you try to change the date. i think there was no documentation for this because the vanilla way has to be developed ;[

hightowertech commented 1 year ago

adding the module version of the duet js got me a kinda-working datepicker. selecting a date gives me undefined and this just wasnt made for this, im out

hightowertech commented 1 year ago

im back. Forget this plugin if you're using vanilla, it isnt made for it. The option im gonna go with so far is by changing the input to a type=date input which gives me a date picker in modern browsers. This is done using Revogrid's custom cell editor. https://revolist.github.io/revogrid/guide/cell.editor.html

function customEdit(column, saveCallback, closeCallback) {
  return {
      element: null, // will be setup up after render
      editCell: null, // will be setup up after render
      /**
       * required, define custom component structure
       * @param createElement: (tagName: string, properties?: object, value?: any, children: Array) => VNode
       */
      render(createElement) {
          return createElement('input',{ type:'date' });
      },
      componentDidRender() {
      //further change the component
      }, // optional, called after component rendered
      disconnectedCallback() {}, // optional, called after component destroyed
  };
};
/*
your other init code
*/
grid.editors = {
 "custom" : customEdit
}
revolist commented 4 months ago

We never intended to use it in vanilla, the best proposal is from @hightowertech! We do support exposure for vanilla js but it was never tested or intended to be used.

https://github.com/revolist/revogrid-column-date/blob/v2.0.20/lib/index.ts