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
795 stars 272 forks source link

undefined this.detectDir() #20

Closed drzraf closed 11 years ago

drzraf commented 12 years ago

When testing the "mysql" example but using editablegrid.js from git master I encoutered this failure. Including editablegrid_utils.js after (or before, even if it does not make sense) does not change anything.

drzraf commented 12 years ago

As baseurl is only used for 2 images, I'd add that both bullet_arrow symbols may easily be replaced by some unicode glyphs like 0x25B4 and 0x25BE. This may be seen as postponing the problem until other external resources come to be (really) needed but I'm not quite sure this "directory detection" is the right way to manage the issue.

webismymind commented 12 years ago

When using editablegrid.js alone in the "mysql" example, you indeed get the error "this.detectDir is not a function", which is normal since by doing so you re-declare the "EditableGrid" function and prototype. But if you include editablegrid_utils.js after, this error does disappear. I have my index.html from the mysql example updated like this and it works (just tested on FF and Chrome):

<script src="js/editablegrid-2.0.1.js"></script>   
<script src="js/editablegrid.js"></script>   
<script src="js/editablegrid_utils.js"></script>   

Anyway, if you want to use the development version, you should include all js files (last one is optional), like this:

<script type="text/javascript" src="/editablegrid/editablegrid.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_validators.js"></script> 
<script type="text/javascript" src="/editablegrid/editablegrid_renderers.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_editors.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_utils.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_charts.js"></script>

Now regarding your comment: using glyphs as an alternative for images is a good idea and if you do it, please send us a pull request so we can integrate it in our master branch. We could also have used CSS for the sort images, which would remove the need for directory detection. But the directory detection works pretty well from my experience, so it was never a priority.

There are plenty of things we have in mind to improve EditableGrid, but we don't have much time and features are added when we actually need them in our projects, or when other people contribute!

drzraf commented 12 years ago

On Thu, May 31, 2012 at 02:05:03AM -0700, Webismymind wrote:

Anyway, if you want to use the development version, you should include all js files (last one is optional), like this:

<script type="text/javascript" src="/editablegrid/editablegrid.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_validators.js"></script> 
<script type="text/javascript" src="/editablegrid/editablegrid_renderers.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_editors.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_utils.js"></script>
<script type="text/javascript" src="/editablegrid/editablegrid_charts.js"></script>

indeed it works, I may have first missed to include some of the needed files.

Now regarding your comment: using glyphs as an alternative for images is a good idea and if you do it, please send us a pull request so we can integrate it in our master branch.

cloned, I'll try to think about an enhancement here.