jQWidgets Forums

jQuery UI Widgets Forums Grid Get Cell Element

Tagged: , , , , ,

This topic contains 8 replies, has 3 voices, and was last updated by  Peter Stoev 8 years, 4 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Get Cell Element #32211

    Justavian
    Member

    I’m totally new to JQWidgets, and i’m fiddling around a bit to see if it might suit my needs. I’m looking at the editing demo, and i’m trying to figure out how to get the actual element for a cell during an event. I looked through the API, and i didn’t see anything that would give me the actual HTML element associated with anything.

    Is there any built in way to retrieve the actual TD element for a particular cell? How about rows?

    In addition to looking at the API, i also tried cycling through the properties of various objects passed around with the events, to no avail.

    I can think of some work around type solutions to this, where i could get the row index and maybe column index before using that to find the cell – but it seems like there must be something built in to find elements for the various components. Did i miss it in the documentation?

    -RP

    Get Cell Element #32213

    Justavian
    Member

    In the event info passed in for things like cellbeginedit, why are all the target properties set to the div which represents the entire grid?

    Get Cell Element #32218

    Peter Stoev
    Keymaster

    Hi Justavian,

    We do not use TR/TD for creating the table and also it is not possible to select a cell by ID using jQuery, because we do not create HTML Elements for all Data Cells. We reuse the HTML Elements in the Grid i.e we have implemented an approach called UI Virtualization.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get Cell Element #32284

    Justavian
    Member

    Ok, but shouldn’t i still be able to retrieve the DIV that’s responsible for the event during a beginedit / endedit?

    I’ve already edited the JS for the grid to allow the getCell() method to return the element in question – but it’s just a best guess, and i bet there are going to be circumstances where the element i return there is wrong. I’m calculating the column index, based on which columns are hidden or visible, and then using the this.table[0].rows[rowIndex].cells[colIndex] to get the element in question and tack it onto the object being returned by getCell. That lets me access the element in the events.

    I need this in my particular case because i want to show a secondary floating div just below the cell that’s being edited. Without having access to the element responsible for the event, there’s no way to snap another div to it.

    My little hack job might cause problems down the road, but at least it gets me what i need right now. Please consider building that into future releases. I realize that some “cells” (in the form of divs) might be reused later – but they should available during the events at least.

    -RP

    Get Cell Element #32289

    Peter Stoev
    Keymaster

    Hi Justavian,

    No, the cells DIV tags should not be accessible during beginedit/endedit. The cell’s editor only should be and is accessible and that is shown in the demos about Grid editing and editors customization.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get Cell Element #32522

    Justavian
    Member

    Ok, maybe i need to ask a more direct question, then – rather than arguing about what i *should* be able to do.

    Is there any way to access the LOCATION of a particular cell? What if i don’t want to actually allow editing to a cell – i just want to display something in a floating div next to it when the user clicks on it. How do i figure out where a cell is so that i can do that?

    Again – i’ve already gotten something working by simply rewriting a few of your base functions to return the DIV element in question. However, i realize that if i use more of the features of the grid, it’s unlikely that this will work. I’d rather use your suggestions, since i don’t want to break anything with my rewriting of core functions.

    Get Cell Element #32523

    Peter Stoev
    Keymaster

    Hi Justavian,

    If you do not want to allow editing of a cell or row, you may look at this sample which demonstrates what should be done to disable cells editing – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/disableeditingofrows.htm?arctic i.e you need to implement the column’s “cellbeginedit” callback function and return true or false depending on whether you want the cell to be editable or not.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Get Cell Element #90211

    Llorx
    Participant

    So no reply to the last direct question? Is important for us to have access to the cell HTML element on click. Not to work with it, maybe to do whatever we want, like show a tooltip near it instead than mouse location.

    Get Cell Element #90213

    Peter Stoev
    Keymaster

    No there is no direct access to Cell elements or any other HTML Elements of jqxGrid. Reasons are concepts such as Horizontal and Vertical UI Virtualization and so on.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.