Kendo ui gives an empty data

hi guys look at my code see where is the problem. the problem is that kendo ui showing no data to me, but this will happen after template. and part of url is my controller that works fine but like i said the problem happen from template and says browser can identify ‘id’. so i would happy anyone can help me and new with javascript and jquery!
here is my code:

$("#my-grid").kendoGrid({
            dataSource: {
                type: "Data",
                transport: {
                    read: {
                        url: '/News/LoadNews',
                        dataType: 'json',
                        type: 'GET'
                    },
                },
                pageSize: 20,
            },
            height: 550,
            groupable: true,
            sortable: true,
            pageable: {
                refresh: true,
                pageSizes: true,
                buttonCount: 5,
            },
            columns: [
                {
                    field: "news_title",
                    title: "عنوان",
                },
                {
                    field: "author_name",
                    title: "نویسنده",
                },
                {
                    field: "news_write_date",
                    title: "تاریخ",
                },
                {
                    title: "عملیات",
                    template:'#= editNewsButton(Id) #'
                },
            ],
        });

Why the value function in js is not working

First I created a input element which will take the text input from the user ……
<input style=" font-size: 12 px;" type="text" name="text" id="txt">

Then to this I used some javascript to get the value of the text that the user gives as an input for that I write the below code….
const text= document.querySelector('#txt').value console.log(text)

But with this I am not getting any kind of value actually I am just getting an empty null value in the console can anyone please point out the mistake in the code …

Issue with vue slots, when trying to display data from api call in Vuejs?

HelloWorld.vue

<template>
  <div>
    <div v-for="box in boxes" :key="box.SourceDatabaseName">
      <BaseAccordian>
        <template v-slot:title>{{ box.SourceDatabaseName }}</template>
        <template v-slot:content>
          <div
            v-for="paint in paints"
            :key="paint.TargetDatabaseName"
            class="line"
          >
            <List
              :data="matchingdata"
              :SourceDatabaseName="box.SourceDatabaseName"
            />
          </div>
        </template>
      </BaseAccordian>
    </div>
  </div>
</template> 

<script>
import { boxcontent } from "../assets/boxcontent";
import { paintcontent } from "../assets/paintcontent";
import { matchingcontent } from "../assets/matchingcontent";
import BaseAccordian from "./BaseAccordian.vue";
import List from "./List.vue";
export default {
  name: "HelloWorld",
  components: {
    BaseAccordian,
    List,
  },
  data() {
    return {
      boxes: [],
      paints: [],
      matchingdata: [],
    };
  },
  mounted() {
    boxcontent().then((r) => {
      this.loading = true;
      this.boxes = r.data;
    });
    paintcontent().then((r) => {
      this.loading = true;
      this.paints = r.data;
    });
    matchingcontent().then((r) => {
      this.loading = true;
      this.matchingdata = r.data;
    });
  },
};
</script>

List.vue

<template>
  <div class="">
    <div
      v-for="match in matchingData"
      :key="match.PipelineID"
      :class="{
        green: match.OverallStatus === 'healthy',
        red: match.OverallStatus === 'down',
      }"
    >
      {{ match.OverallStatus }}
    </div>
  </div>
</template>
<script>
export default {
  components: {},
  props: {
    data: {
      type: Array,
      required: true,
    },
    SourceDatabaseName: {
      type: String,
      required: true,
    },
  },
  data: function () {
    return {};
  },
  methods: {},
  computed: {
    matchingData() {
      return this.data.filter(
        (item) => item.PipelineID === this.SourceDatabaseName
      );
    },
  },
};
</script>
<style scoped>
</style>

Present output:-(having issue, unable to see {{overallstatus}} from list.vue component? after checkbox is clicked,)

enter image description here

Expected output:-

enter image description here

After clicking checkbox from the matchingdata array, i am unable to get the response. I am thinking issue with the below code… may be in this code problem??? <List :data="matchingdata" :SourceDatabaseName="box.SourceDatabaseName" />

In List.vue component also, i think data is not filtering correctly and proceeding.

Can you please check my code once, and tell me where exactly i have issue?
code:- https://codesandbox.io/s/vigorous-shtern-lrfeuy?file=/src/components/HelloWorld.vue

Understanding React-hook-form Controller

I am working on a website that has been build before me and it uses a method of the Controller part of react-hook-form that I have not seen before.

This is an example of the code:

const CheckboxController = (props: CheckboxProps) => {
  return (
    <Wrapper>
      <Controller as={CheckboxInput} {...props} /> 
    </Wrapper>
  );
};

With CheckboxInput being a simple material-ui checkbox.

I understand the traditional method of using something like:

const CheckboxController = (props: CheckboxProps) => {
  return(
    <Controller
    name={props.name}
    control={props.control}
    render={({ field }) => (
      <label>
          <Checkbox
            onChange={(e) => field.onChange(e.target.checked)}
            checked={props.checked}
            disabled={props.isDisabled}
            />
            {props.label}
        </label>
      )}
    />
  );
};

But unfortunately the entire site is build upon the <Controller as={}> setup. I cant seem to find any info online about it to figure out how it works. Does anyone know about this method or can point me in the right direction? Thank you.

Moving Row to another sheet and clear content/ ArrayFormula

Short story:
How do I modify the script below to clear contents in multiple cells in the row? For example Rows 7,13,24,25,34

Long story (in case there is a better solution):

I have been using this script to move rows between sheets based on a value without carrying over the formatting so the next sheet has its own and the conditional formatting isn’t stacking up.

  function onEditComplete(e) {
 //e.source.toast('Entry');
 //Logger.log(JSON.stringify(e));
 const sh=e.range.getSheet();
 if(sh.getName()=="Sheet1a" && e.range.columnStart==5 && e.value=="Completed") {
  //e.source.toast('Conditional');
 var tsh=e.source.getSheetByName("Sheet2a");
 tsh.getRange(tsh.getLastRow()+1,1,1,sh.getLastColumn()).setValues(sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()). 
getValues());
sh.deleteRow(e.range.rowStart);}
  }

The problem I am encountering now is I am using Formulas.
I have 4 sheets. Sheet1a and Sheet1b have vlookup formulas between them. Sheet2a and Sheet2b will also have the same Vlookup formula between them.

=ArrayFormula(IFERROR(VLOOKUP(PARTS!$B1:$B,{PARTS!$B1:$B,PARTS!$AF1:$BD&","&PARTS!$AJ1:$AJ&","&PARTS!$AN1:$AN&","&PARTS!$AR1:$AR&","&PARTS!$AV1:$AV&","&PARTS!$AR1:$AR&","&PARTS!$AZ1:$AZ},2,0)))

Since it’s an ArrayFormula, as long as Sheet2a and Sheet2b are set it should only be a matter of clearing the content in the specific cells before it moves over since it transfers as text value and breaks the formula in Sheet2a and Sheet2b.

Why is this Javascript code running twice?

In vanilla JS, I want to take a value and append it to the href value of a link, but for reasons I can’t understand the value is being added twice.

My HTML is:

<a href="some-path/some-page" class="js-btn">Click me</a>

My Javascript is:

var refCode = "1234";

var href1 = document.querySelector(".js-btn").href;

document.querySelector(".js-btn").href = href1 + "?referral_code=" + refCode;

console.log(href1);

The expected result is:

<a href="some-path/some-page?referral_code=1234" class="js-btn">Click me</a>

but the actual result is:

<a href="some-path/some-page?referral_code=1234?referral_code=1234" class="js-btn">Click me</a>

Of course, I’ve checked to see if the script is appearing twice, but it’s not.

Would anyone know why this is?

I want to execute a command only if an interval is running

I’m making a command that sends a specific message every 1.5 seconds. I have also made a command to stop the interval. It works as i expected. But if the interval is not running and someone executes the stop command, the whole bot crashes. I want to stop that
Here’s the code –

else if (command === prefix + "spam" && args[0] !== undefined) {
        message.reply("Quick tip: Use `stopspam` command to stop this")
        spamInterval = setInterval(() => {
          message.channel.send(`${args.slice(0).join(" ")}`)
        }, 1500)
      }
    else if (command === prefix + "stopspam") {
        clearInterval(spamInterval);
        message.reply("Stopped the spamming. Hope it created some chaos :skull:")
    }

Error occured in react.production.min.js after deploying react app to the aws amplify

I’ve made complex react app but after deploying it on aws amplify i’ve got these errors, i don’t know why i got these errors, on local it works perfectly
here is the error log

Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at j (react.production.min.js:18)
at t.useContext (react.production.min.js:22)
at oe (hooks.js:18)
at Lu (Body.js:18)
at li (react-dom.production.min.js:157)
at Gl (react-dom.production.min.js:267)
at Is (react-dom.production.min.js:250)
at Bs (react-dom.production.min.js:250)
at Ms (react-dom.production.min.js:250)
at bs (react-dom.production.min.js:243)
ul @ react-dom.production.min.js:216

Uncaught Error: Minified React error #321; visit 
https://reactjs.org/docs/error-decoder.html? react-dom.production.min.js:260 
invariant=321 for the full message or use 
the non-minified dev environment for full errors and additional helpful warnings.
at j (react.production.min.js:18)
at t.useContext (react.production.min.js:22)
at oe (hooks.js:18)
at Lu (Body.js:18)
at li (react-dom.production.min.js:157)
at Gl (react-dom.production.min.js:267)
at Is (react-dom.production.min.js:250)
at Bs (react-dom.production.min.js:250)
at Ms (react-dom.production.min.js:250)
at bs (react-dom.production.min.js:243)

if you know any solution or way to solve these kind of errors please answer it here! thanks 🙂

Music player in react native

Which is a best way to fetch the all my audio files which store in my local device storage and use in a my react native offline music player app . Or suggest me library which help me to archive this task

JavaScript – Balance an Unbalanced Power Load

The array below contains a list of numbers that represent power load. The while loop, loops through the array and gets the sum of the array. The sum is then passed into the balance_load function so it can divide it into 3 parts such that the maximum and minimum value are as minimum as possible. What I would like to do next is write an algorithm that will distribute the available numbers(load) in the array to x, y and z such that the total values in x, y and z are very close to eachother and the sum of all three equal the sum of the entire array which in the example below is 909. The objective is to make the load as balanced as possible.

**GET SUM OF THE ARRAY AND DIVIDE IN THREE PARTS**
let x = 0;
let y = 0;
let z = 0;


function balance_load(x, n){
  let balanced_load = []
  if(x < n){
    balanced_load.push('-1')
  }else if(x % n === 0){
    for(let i=0; i<n; i++){
      balanced_load.push((x/n))
    }
  }else{
    let smallest_value = Math.floor(x/n);
    let smallest_value_count = n - (x % n)

    for(let i=0; i<n;i++){
      if(i >= smallest_value_count){
        balanced_load.push((smallest_value + 1))
      }else{
        balanced_load.push(smallest_value)
      }
    }
  }

  return balanced_load
}



let total = 0;


let array = [50,50,25,167,167,50,25,50,75,75,25,50,25,50,25]


for(let i of array){
  total += i
}
let balance = balance_load(total,3)

console.log(balance)
**EXAMPLE OF THE TYPE OF OUTPUT I AM LOOKING FOR AFTER GETTING SUM OF THE ARRAY AND DIVIDING IT BY THREE**

//x=317 (50 + 167 + 50 + 50)
//y=292 (167 + 75 +25 + 25)
//z=300 (50 + 25 + 50 + 25 + 75 + 50 + 25)
//x + y + z = 909//which is  the total

Javascript array values take from JSON file

I need to take this catWomen, catMen (Like other arrays) child data array values from a JSON file which is stored in my react app frontend. This catWomen, catMen like arrays data take for a drop-down in website homepage, I just only need to get these arrays child data (ex: catWomen array’s cloths’ child data item2, item 8) from separate JSON file

/* eslint-disable react/jsx-pascal-case */
import React, { Fragment, useState, useRef } from "react";
import { Col, Row } from "antd";
import { useNavigate } from "react-router-dom";
import { Menu, Transition } from "@headlessui/react";
import * as Icons from "../../assets/svg/mobile-icons";
import * as Icons2 from "../../assets/svg/icon";

import data01 from  './CategoriesData.json'

function classNames(...classes) {
  return classes.filter(Boolean).join(" ");
}


const catWomen = [
  { id: 1, name: "See All", icon: <Icons2.seeall />, childs: [] },
  {
    id: 2,
    name: "Clothes",
    icon: <Icons2.frock01 />,
    childs: ["item2", "item8"],
  },
  {
    id: 3,
    name: "Shoes",
    icon: <Icons2.shoes06 />,
    childs: ["item3", "item7"],
  },
  { id: 4, name: "Bags", icon: <Icons2.purse01 />, childs: ["item4", "item6"] },
  {
    id: 5,
    name: "Accessories",
    icon: <Icons2.bag05 />,
    childs: ["item5", "item2"],
  },
  { id: 6, name: "Beauty", icon: <Icons2.hat02 />, childs: ["item6", "item4"] },
];


const catMen = [
  { id: 1, name: "See All", icon: <Icons2.seeall />, childs: [] },
  {
    id: 2,
    name: "Clothes",
    icon: <Icons2.shirt1 />,
    childs: ["item2", "item8"],
  },
  { id: 3, name: "Shoes", icon: <Icons2.shoes1 />, childs: ["item3", "item7"] },
  { id: 4, name: "Bags", icon: <Icons2.bag05 />, childs: ["item4", "item6"] },
  {
    id: 5,
    name: "Accessories",
    icon: <Icons2.purse02 />,
    childs: ["item5", "item2"],
  },
  { id: 6, name: "Grooming", icon: <Icons2.hat />, childs: ["item6", "item4"] },
];

const catKids = [
  { id: 1, name: "See All", icon: <Icons2.seeall />, childs: [] },
  {
    id: 2,
    name: "Clothes",
    icon: <Icons2.shirt1 />,
    childs: ["item2", "item8"],
  },
  {
    id: 3,
    name: "Shoes",
    icon: <Icons2.shoes05 />,
    childs: ["item3", "item7"],
  },
  { id: 4, name: "Bags", icon: <Icons2.bag05 />, childs: ["item4", "item6"] },
  {
    id: 5,
    name: "Accessories",
    icon: <Icons2.bow />,
    childs: ["item5", "item2"],
  },
  {
    id: 6,
    name: "Grooming",
    icon: <Icons2.hat03 />,
    childs: ["item6", "item4"],
  },
];

const Categories = () => {
  const navigate = useNavigate();

  function SubCategories(props) {
    return (
      <Transition
        enter="transition ease-out duration-100"
        enterFrom="transform opacity-0 scale-95"
        enterTo="transform opacity-100 scale-100"
        leave="transition ease-in duration-75"
        leaveFrom="transform opacity-100 scale-100"
        leaveTo="transform opacity-0 scale-95"
      >
        <Menu.Items className="origin-top absolute w-auto rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 divide-y divide-gray-100 focus:outline-none">
          <div className="py-1 flex">{props.children}</div>
        </Menu.Items>
      </Transition>
    );
  }

  function DropDownItem(props) {
    const items = props.data.map((item) => (
      <Menu.Item key={item.id.toString()}>
        {({ active }) => (
          <div
            onMouseOver={() => setChild(item.id)}
            onClick={() => {
              item.id === 1
                ? navigate(`/allproducts?mainProductCategory=${props.parent}`)
                : navigate(
                    `/allproducts?mainProductCategory=${props.parent}&category=${item.name}`
                  );
            }}
            className={classNames(
              active ? "bg-gray-100 text-gray-900" : "text-gray-700",
              "grid grid-cols-8 block px-4 py-2 text-xs"
            )}
          >
            <div className="col-span-7">{item.name}</div>
            <div className="col-span-1">{item.icon}</div>
          </div>
        )}
      </Menu.Item>
    ));
    return (
      <>
        <div className="border-r border-gray-300 w-40 text-sm">{items}</div>
      </>
    );
  }

  const [child, setChild] = useState(1);

  function LoadChilds(props) {
    const childs = props.data[props.child - 1];
    const subItems = childs.childs.map((item) => (
      <Menu.Item key={item.toString()}>
        {({ active }) => (
          <div
            onClick={() => navigate(`/allproducts?mainProductCategory=${props.parent}&category=${childs.name}&subCategory=${item}`)}
            className={classNames(
              active ? "bg-gray-100 text-gray-900" : "text-gray-700",
              "block px-4 py-2 text-sm"
            )}
          >
            {item}
          </div>
        )}
      </Menu.Item>
    ));
    return <div className="w-56">{subItems}</div>;
  }

  const dropdownRef = useRef();

  return (
    <Row className="bg-white w-full" style={{ position: "fixed", border: 0 }}>
      <Col offset={2}>
        <div className="flex w-full gap-6 text-xs cursor-pointer mt-0.5">
          <Menu as="div">
            <div
              className={`border-b-2 border-b-white hover:border-b-red-400 p-2`}
              onClick={() => navigate(`/allproducts`)}
            >
              <p>Shop</p>
            </div>
          </Menu>

          <Menu as="div">
            <Menu.Button
              className={`border-b-2 border-b-white hover:border-b-red-400 p-2`}
            >
              <p>Women</p>
            </Menu.Button>
            <div ref={dropdownRef}>
              <SubCategories>
                <DropDownItem data={catWomen} parent="Women" />
                <LoadChilds child={child} data={catWomen} parent="Women" />
              </SubCategories>
            </div>
          </Menu>

          <Menu as="div">
            <Menu.Button
              className={`border-b-2 border-b-white hover:border-b-red-400 p-2`}
            >
              <p>Men</p>
            </Menu.Button>
            <div ref={dropdownRef}>
              <SubCategories>
                <DropDownItem data={catMen} parent="Men" />
                <LoadChilds child={child} data={catMen} parent="Men" />
              </SubCategories>
            </div>
          </Menu>

          <Menu as="div">
            <Menu.Button
              className={`border-b-2 border-b-white hover:border-b-red-400 p-2`}
            >
              <p>Kids</p>
            </Menu.Button>
            <div ref={dropdownRef}>
              <SubCategories>
                <DropDownItem data={catKids} parent="Kids" />
                <LoadChilds child={child} data={catKids} parent="Kids" />
              </SubCategories>
            </div>
          </Menu>

          <Menu as="div">
            <div
              className={`border-b-2 border-b-white hover:border-b-red-400 p-2`}
            >
              <p>About</p>
            </div>
          </Menu>
        </div>
      </Col>
    </Row>
  );
};

export default Categories;