webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
796 stars 271 forks source link

How can i install your plugin #138

Closed ramonYcajal closed 7 years ago

ramonYcajal commented 8 years ago

hello, i don't know how should I install your plugin, links to css and scripts in head, create de grid in body tag and create de script on document ready to generate it and whatever it wants. firs, columns, then data and finally to create an instance of this object. In doc doesn`t explain it and I can't understand watching basic examples. I show gratitude for this help. Thanks

ramonYcajal commented 8 years ago

well done!!!, i just do it but the doc doesn`t help me Now I have more problems, How can I get the position of the cell which has a focus or get de content of it, like getCurrentCellContent or similar, without passing index...

ramonYcajal commented 8 years ago

hello!! I solved my problem using mouseclicked from the editablegrid.js and modifying the content to use in my script. $("#table").on('click', function(e){ showPosition(e);

            });

            function showPosition(e){
                e = e || window.event;
                with (editableGrid) {

                    // get row and column index from the clicked cell
                    var target = e.target || e.srcElement;

                    // go up parents to find a cell or a link under the clicked position
                    while (target) if (target.tagName == "A" || target.tagName == "TD" || target.tagName == "TH") break; else target = target.parentNode;
                    if (!target || !target.parentNode || !target.parentNode.parentNode || (target.parentNode.parentNode.tagName != "TBODY" && target.parentNode.parentNode.tagName != "THEAD") || target.isEditing) return;

                    // don't handle clicks on links
                    if (target.tagName == "A") return;

                    // get cell position in table
                    var rowIndex = getRowIndex(target.parentNode);
                    var columnIndex = target.cellIndex;
                    console.log(rowIndex,columnIndex);

                }
            }
simivar commented 7 years ago

@ramonYcajal please close the issue if it's already solved.