cheetah-grid icon indicating copy to clipboard operation
cheetah-grid copied to clipboard

How can one put things that are not text as the header caption

Open Amndeep7 opened this issue 5 years ago • 4 comments

I want to put some stylized components in the header, but using the slot directly seems to convert everything into text.

Example:

    <template slot="layout-header">
      <c-grid-layout-row>
        <c-grid-header v-for="col of columns" :key="col.value" :width="col.width" :header-field="col.value">
          <span>
            <home-icon />
            {{col.text}}
          </span>
        </c-grid-header>
      </c-grid-layout-row>

Makes several headers that consist of Home icon [whitespace markdown removes] {the text}.

Looking at the code, it seems like this is intentional.

https://github.com/future-architect/cheetah-grid/blob/941a6f2583362534926256c666c46dd86a0fa35a/packages/vue-cheetah-grid/lib/c-grid/ColumnMixin.vue#L57

Could you please provide an example of how to put non-text components in the header?

Amndeep7 avatar May 20 '20 02:05 Amndeep7

Thank you for posting this.

Since this grid works on <canvas>, you can draw only text and check box.

If you want to draw a check box, write as follows.

<c-grid-header 
  ...
  header-type="check"
  header-action="check"
  header-field="myFiled"
  @changed-header-value="myOnChange" />

ota-meshi avatar May 20 '20 04:05 ota-meshi

It seems kinda hacky, but if someone provided raw html in an svg format, could you make a new header type that would render the svg?

Example of hack

Amndeep7 avatar May 20 '20 05:05 Amndeep7

Thank you for information!

I'll check out this SVG hack if I have time.

ota-meshi avatar May 20 '20 05:05 ota-meshi

Hi. Add filter row to header column?

Romiros82 avatar Dec 15 '20 06:12 Romiros82