jQWidgets Forums

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts

  • chzhong1001
    Participant

    Hi admin,
    This way it can be solved.
    Thanks very much.


    chzhong1001
    Participant

    Hi admin,
    In fact, I want to be able to get row data in the button click event.For example, in the following “myButton.addEventHandler(‘click’, function ()”.
    How do I do that?

    createwidget: (row: number, column: any, value: string, htmlElement: HTMLElement): void => {
    const container = document.createElement(‘div’);
    const id = myButton${this.counter};
    container.id = id;
    container.style.border = ‘none’;
    htmlElement.appendChild(container);
    const imgurl = ‘./../../../images/’ + value.toLowerCase() + ‘.png’;
    const options = {
    width: ‘100%’, height: 90, template: ‘success’,
    imgSrc: imgurl, imgWidth: 40, imgHeight: 50, value: value,
    imgPosition: ‘center’, textPosition: ‘center’, textImageRelation: ‘imageAboveText’
    };
    const myButton = jqwidgets.createInstance(#${id}, ‘jqxButton’, options);
    myButton.addEventHandler(‘click’, function (): void {
    const currentButtonValue = this.children[1].innerHTML;
    alert(row.boundindex); // does not match when scrolling
    alert(row.bounddata); // does not match when scrolling
    alert(currentButtonValue);
    });
    this.counter++;
    },
    initwidget: (row: number, column: any, value: any, htmlElement: HTMLElement): void => {
    const imgurl = ‘./../../../images/’ + value.toLowerCase() + ‘.png’;
    (<HTMLImageElement>htmlElement.children[1].children[0]).src = imgurl;
    htmlElement.children[1].children[1].innerHTML = value;
    }


    chzhong1001
    Participant

    Hi, admin:
    Thanks for your reply! I’ve seen this code,but the issue what the bounddata of row does not match when scrolling with createwidget method does not resolved.
    The code of mine like this:

    createwidget: (row: number, column: any, value: string, htmlElement: HTMLElement): void => {
    const container = document.createElement(‘div’);
    const id = myButton${this.counter};
    container.id = id;
    container.style.border = ‘none’;
    htmlElement.appendChild(container);
    const imgurl = ‘./../../../images/’ + value.toLowerCase() + ‘.png’;
    const options = {
    width: ‘100%’, height: 90, template: ‘success’,
    imgSrc: imgurl, imgWidth: 40, imgHeight: 50, value: value,
    imgPosition: ‘center’, textPosition: ‘center’, textImageRelation: ‘imageAboveText’
    };
    const myButton = jqwidgets.createInstance(#${id}, ‘jqxButton’, options);
    myButton.addEventHandler(‘click’, function (): void {
    const currentButtonValue = this.children[1].innerHTML;
    alert(row.boundindex); // does not match when scrolling
    alert(row.bounddata); // does not match when scrolling

    alert(currentButtonValue);
    });
    this.counter++;
    },
    initwidget: (row: number, column: any, value: any, htmlElement: HTMLElement): void => {
    const imgurl = ‘./../../../images/’ + value.toLowerCase() + ‘.png’;
    (<HTMLImageElement>htmlElement.children[1].children[0]).src = imgurl;
    htmlElement.children[1].children[1].innerHTML = value;
    }


    chzhong1001
    Participant

    Hi, admin:
    can you please provide a sample code for the row’s boundindex and bounddata are up to date in the initwidget ?
    Thanks.


    chzhong1001
    Participant

    Hi, this topic has another issue, the bounddata of row does not match when scrolling with createwidget method.
    Please let me know if any way can fix this issue. Thanks.
    This is demo image
    link:https://pan.baidu.com/s/1vgRQ4drVk4gQ4iaTfqsWGw
    key:ul2j

Viewing 5 posts - 1 through 5 (of 5 total)