Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevExpress trial, DxSparkLine #706

Open
Laro88 opened this issue Apr 27, 2023 · 0 comments
Open

DevExpress trial, DxSparkLine #706

Laro88 opened this issue Apr 27, 2023 · 0 comments

Comments

@Laro88
Copy link

Laro88 commented Apr 27, 2023

How do I perform dynamic databinding in Vue3 to props - data is not validating on props change, however a watch setup is ok.
Navigating and rerendering works fine (except for some x-axis width that seems strange)

I have been messing around with doing a ref of the props, and using all sorts of crazy variations of :data-source="props.vals" etc.
None have resulted in a real time feed.

If you can just tell me how to force a refresh from the ID then this would be doable in the watch function where I log the data.

Btw. It seems like your documentation need a lot of work.

<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import DxSparkline, { DxTooltip, } from 'devextreme-vue/sparkline';

const props = defineProps<{
    rkey: string,
    val: number,
    vals: number[],
}>()

function ComputeKeyName(key: string) {
    console.log("Computing the key name for key:" + key);
    return key;
}

let name = "";

const r = ref(props);

  watch(r, (n) => {
     console.log(n.vals); //dump number[] to log - works :-)
 },{ deep: true });

onMounted(() => {
    name = ComputeKeyName(props.rkey);
});
</script> 

<template>
    <td>{{ name }}</td>
    <td>{{ vals[vals.length - 1] }}</td>
    <td>
        <DxSparkline :data-source=r.vals :show-min-max="true" class="sparkline" type="line">
            <DxTooltip :enabled="true" />

        </DxSparkline>
    </td>
</template>

<style scoped>
.rows-content td {
    font-weight: 400;
    width: 200px;
    padding: 25px 10px 5px 10px;
    border: 1px solid #c2c2c2;
}

.rows-content tr:nth-child(2) td {
    border-top: 1px solid #c2c2c2;
}

.rows-content td:first-of-type {
    border-left: 1px solid #c2c2c2;
}

/* .rows-content .sparkline {
    width: 100px;
    height: 40px;
} */

 .sparkline {
    width: 400px;
    height: 30px;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant