revogrid icon indicating copy to clipboard operation
revogrid copied to clipboard

Vanilla Example

Open JohnRSim opened this issue 4 years ago • 5 comments

Can you provide a vanilla example similar to select?

Thanks

JohnRSim avatar Jun 21 '21 10:06 JohnRSim

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 avatar Jun 19 '23 19:06 hightowertech

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 avatar Jun 19 '23 20:06 hightowertech

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 avatar Jun 19 '23 20:06 hightowertech

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
}

hightowertech avatar Jun 19 '23 21:06 hightowertech

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

revolist avatar Jul 16 '24 23:07 revolist