Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

KTDataTable


Hello,


const myData = ref<Array<any>>([]);
const getRulesList = computed(() => {
return store.getRulesGetAll;
});
onMounted(async () => {
await getRules();

myData.value.splice(0, getRulesList.value.length, ...getRulesList.value);
});

const search = ref<string>("");
const searchItems = () => {
getRulesList.value.splice(0, getRulesList.value.length, ...myData.value);
if (search.value !== "") {
let results: Array<any> = [];
for (let j = 0; j < getRulesList.value.length; j++) {
if (searchingFunc(getRulesList.value[j], search.value)) {
results.push(getRulesList.value[j]);
}
}
getRulesList.value.splice(0, getRulesList.value.length, ...results);
}
};

const searchingFunc = (obj: any, value: string): boolean => {
for (let key in obj) {
if (!Number.isInteger(obj[key]) && !(typeof obj[key] === "object")) {
if (obj[key].indexOf(value) != -1) {
return true;
}
}
}
return false;
};


I keep getting this error for search function
obj[key].indexOf is not a function shocked

Please help me.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Melih,

Thank you for reaching out to us.

Could you please specify which Metronic version are you using?

Do you have the same issue on our preview page?
https://preview.keenthemes.com/metronic8/vue/demo1/#/dashboard

Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(