Giter VIP home page Giter VIP logo

webismymind / editablegrid Goto Github PK

View Code? Open in Web Editor NEW
796.0 74.0 270.0 1.97 MB

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.

Home Page: http://www.editablegrid.net

License: Other

CSS 0.37% JavaScript 97.26% HTML 0.61% PHP 1.77%

editablegrid's Introduction

WARNING

Documentation below is NOT up to date as it does not contain the latest features added in EditableGrid 2.0. We currently have no time to update the documentation properly, so we chose to release version 2.0 as-is.

The best way to learn using EditableGrid is to play with the fairly complete examples (examples/index.html).

EditableGrid v1.0.11

Introduction

EditableGrid is a Javascript library that allows you to make the tables in your web sites and applications editable. EditableGrid focuses on simplicity: only a few lines of code are required to get your first table up and running.

You can use the EditableGrid library in two ways:

  • Hook up to an existing HTML table. This approach can be very useful for plugging EditableGrid on an existing web application.

  • Build your grid from an XML description of the table structure and contents. This approach is recommended if you're writing a new web application (or if you are want to improve an existing web application).

This only influences the way you create your editable grid. The way you can customize and use your grid afterwards is identical in both cases.

API documentation

In directory doc/jsdoc you will find a reference documentation of all classes and functions available in this library.

A first example

This library is very simple to use, so the best way to start is just to check out an example. First, let's have a look at the result: open up examples/demo.html in your favorite browser. This example will let you edit cells of various types (string, numeric, enum, email, boolean, date). It will also let you sort columns by clicking on the column header and remove rows.

In order to get you started, we provide a simplified version of this demo, so let's start with this. In file demo.html at line 12, you just have to replace "demo.js" with "demo_simple.js" and refresh the file in your browser. What you'll see is the same editable grid, but with some features removed.

Now let's see the source code behind this demo:

  • demo.html/css: main html page and a stylesheet to make our table prettier
  • demo.xml: xml file containing the table structure and contents
  • demo_simple.js: javascript source to create our editable grid

Let's analyze each file in more details:

  1. The HTML page is very simple: all it does is include the necessary javascript and css files and create some divs. The CSS file is a very simple and classical stylesheet.

  2. The XML file contains two parts:

    a. The table structure, enclosed in the tag:

    Declaring the structure of your table consists in declaring a list of columns and give the following information for each column:

    • name: this name can for example be the name of the corresponding field in a database (or anything else you may find useful to know which data has been modified)
    • label: this label will be used in the table header (if no label is given, the name is used)
    • type: type can be one of the following: string, integer, double, boolean, date, email, website, html (if not given, "string" is assumed)
    • editable: is the column editable or not (if not specified, it won't be editable)

    For double and integer columns, the type can also provide additional information, such as the unit, the precision, and/or the symbol to use for NaN, e.g.:

    • double(m): unit is 'm'
    • double(1): precision is 1 (and unit is not specified)
    • double(m, 1): unit is 'm' and precision is 1
    • double(m, 1, n/a): unit is 'm', precision is 1 and symbol for NaN is 'n/a'
    • double(€, 2, -): unit is '€', precision is 2 and symbol for NaN is '-'

    For string and email columns, you can specify the desired length of the text field used when editing these values, like this: string(40) or email(24). The default length is 12 for string and 32 for email and website.

    A specific style will be applied to numeric columns (bold and aligned to the right). Also, when a numeric cell is edited, the user won't be able to apply its changes until he enters a valid numeric value. For emails and dates also, we check that the entered value is a valid email address, resp. date.

    You can also specify a list of predefined values for each column. In this case, when a cell is edited, the user will be presented with a drop-down list containing these predefined values.

    b. The table contents, enclosed in the tag:

    This is basically a list of rows, each row containing a value for each column. It is recommended to name your columns: this way you can declare them in any order and skip some columns if you want. But naming the columns is not mandatory: the order used in metadata must then be respected. You can also assign a unique id with each row (for example, the id of the row in a database).

    Just have a look at the XML file demo.xml: it should speak for itself.

  1. In the Javascript file demo_simple.js, all we do is to create an EditableGrid object and specify two things:

    a) A function "tableLoaded" that will be called when the grid has been fully loaded. Here we simply display a message and define a renderer for the action column in order to display a delete button (see below for more details about cell renderers). Then we render the loaded grid in our div "tablecontent" using out css style "testgrid".

    b) A function "modelChanged" that will be called each time a cell has been modified by the uses. Here we just display a message showing the new value. In real life, it's here that you can for example update your database (with an AJAX request).

    When the EditableGrid object is created with the necessary callbacks activated, we use function "loadXML" to load the XMl file demo.xml.

That's it for the basics of using EditableGrid.

Improving our first example

You remember we asked you to replace demo.js with demo_simple.js in demo.html. Well now that you are ready to see the real power of EditableGrid, you can use "demo.js" again.

In this part, we'll see how to further customize our editable grid, using mainly 3 mechanisms:

  • cell and header renderers that allow you to customize the way values are displayed
  • cell validators that will allow you to tell when a value entered by the user is valid or not
  • enumeration providers that will allow you to dynamically build the list of possible values for a column

The file "demo.js" will bring the following new features to our first example:

  1. show more details when a cell has been modified
  2. add a validator to check that the age must be inside the bounds [16, 100[
  3. display the unit in the HEIGHT column
  4. use a flag image to display the selected country
  5. propose a list of countries that depends on the selected continent
  6. clear the selected country when another continent is selected
  7. display an information icon in the table header for some columns
  8. possibility to attach to an existing HTML table (see file demo_attach.html)

Let's see how each feature has been implemented in our example:

  1. The modelChanged callback function receives as parameters: rowIndex, columnIndex, oldValue, newValue, row. The last parameter "row" can be used to get the row id that was specified in the XML file.
    In our example, we display a message composed as follows:

    "Value for '" + this.getColumnName(columnIndex) + "' in row " + row.id + " has changed from '" + oldValue + "' to '" + newValue + "'"
    
  2. To associate a custom validation with a column, you can use the addCellValidator function which takes a CellValidator object, like this:

    addCellValidator("age", new CellValidator({
    isValid: function(value) { return value == "" || (parseInt(value) >= 16 && parseInt(value) < 100); }
    }));
    
  3. To customize the way cells in a particular column are displayed you must associate a CellRenderer, using the function setCellRenderer:

    setCellRenderer("height", new CellRenderer({
    render: function(cell, value) { new NumberCellRenderer().render(cell, value ? value + " m" : ""); }
    })); 
    
  4. Here again, to display a flag for the country we associate a custom CellRenderer with the column 'country':

    setCellRenderer("country", new CellRenderer({
    render: function(cell, value) { cell.innerHTML = value ? "<img src='images/flags/" + value.toLowerCase() + ".png' alt='" + value + "'/>" : ""; }
    })); 
    
  5. To achieve this, we must associate a custom EnumProvider with our column, using the function setEnumProvider:

   setEnumProvider("country", new EnumProvider({ 
       getOptionValues: function (grid, column, rowIndex) {
           var continent = grid.getValueAt(rowIndex, 4);
           if (continent == "eu") return { "be" : "Belgique", "fr" : "France", "uk" : "Great-Britain", "nl": "Nederland"};
           else if (continent == "am") return { "br" : "Brazil", "ca": "Canada", "us" : "USA" };
           else if (continent == "af") return { "ng" : "Nigeria", "za": "South Africa", "zw" : "Zimbabwe" };
           return null;
       }
   }));

The function getOptionValues is called each time the cell must be edited. Here we do only client-side Javascript processing, but you could use Ajax here to communicate with your server. If you do, then don't forget to use Ajax in synchronous mode.

  1. In the modeChanged function we can check the modified column: if it is the continent then we clear the country in the same row, like this:
   if (this.getColumnName(columnIndex) == "continent") 
		this.setValueAt(rowIndex, this.getColumnIndex("country"), "");
  1. To achieve this, we will use the method setHeaderRenderer that allows us to customize the way column headers are rendered. Since we want to use the same renderer for several column, we are going to declare a class InfoHeaderRenderer which extends CellRenderer, like this:
   function InfoHeaderRenderer(message) { this.message = message; };
   InfoHeaderRenderer.prototype = new CellRenderer();
   InfoHeaderRenderer.prototype.render = function(cell, value) { /* create the icon, see demo.js for the code */ }

We use this class with setHeaderRender as follows:

   setHeaderRenderer("age", new InfoHeaderRenderer("The age must be an integer between 16 and 99"));
   setHeaderRenderer("height", new InfoHeaderRenderer("The height is given in meters"));
  1. To attach to an existing HTML table you won't use the loadXML function as before. Instead you will use the function attachToHTMLTable, as follows:
   	editableGrid.attachToHTMLTable($('htmlgrid'), 
		[ new Column({ name: "name", datatype: "string(24)" }),
		  new Column({ name: "firstname", datatype: "string" }),
		  new Column({ name: "age", datatype: "integer" }),
		  new Column({ name: "height", datatype: "double" }),
		  new Column({ name: "continent", datatype: "string", optionValues: {"eu": "Europa", "am": "America", "af": "Africa" }}),
		  new Column({ name: "country", datatype: "string" }),
		  new Column({ name: "email", datatype: "email(26)" }),
		  new Column({ name: "freelance", datatype: "boolean" }) ]);

As you can guess, the HTML table you're attaching to will define the contents of the table. But since we don't have the XML metadata to define the table columns, you must declare these columns using Javascript as shown above. Of course, in this case you don't have to register the callback method "tableLoaded" since nothing has to be loaded.

PHP helper class

If you work with PHP on the server side, you can make use of the simple class EditableGrid.php to ease the creation and rendering of the XML data.

Charts

EditableGrid allows you to create bar and pie charts from the grid data.

This makes use of OpenFlashCharts 2.0, which you should include by yourself in your client application. The following javascript files must be included (all can be found in the official OpenFlashChart 2.0 download):

  • openflashchart/js-ofc-library/open_flash_chart.min.js
  • openflashchart/js-ofc-library/ofc.js
  • openflashchart/js/swfobject.js
  • openflashchart/js/json/json2.js

If any of these files is missing, trying to use the charting methods will display an error indicating the missing library. The SWF file must be named "open-flash-chart.swf" and must be placed in the "openflashchart" directory: it will then be detected automatically.

Creating charts with EditableGrid is very easy. The first thing to do is to have some empty DIV in your page that will be used as a container for the chart. You can control the chart dimensions by setting the "width" and "height" attributes, inline or through a CSS stylesheet. Otherwise some default dimensions will be used (500*200px).

Then according to the type of chart you want, you just have to call one of the following methods:

  1. renderBarChart(divId, title, labelColumnIndexOrName, legend)

    This method will create a bar chart: labelColumnIndexOrName is the name or index of the column that will be used for the chart categories. For each category, you will have one bar per numerical column having the "bar" attribute set to true (which is the default). The 'bar' attribute can be set in the grid XML metadata when declaring a column. The 'legend' parameter is optional: by default the label of the column given by "labelColumnIndexOrName" will be used. You don't have to care about the chart's scale: it will be computed automatically to best fit the data.

    Example: Imagine you have the following data giving the number of kilometers done by person and by year

	name    2009   2010
	--------------------
	John    40000  30000
 	Jack    60000  20000
 	Paul    20000  50000

Calling renderBarChart(divId, "Kilometers", "name") will produce the following chart:

	# 2009  * 2010
             
     60,000           #
     50,000           #          *
     40,000  #        #          *
     30,000  # *      #          *
     20,000  # *      # *      # *
     10,000  # *      # *      # *
     
          0  John     Jack     Paul
          
                   Person	   
  1. renderPieChart(divId, title, valueColumnIndexOrName, labelColumnIndexOrName, startAngle)

    This method will create a pie chart:

    • valueColumnIndexOrName is the name or index of the column that will be used as the value for each pie part
    • labelColumnIndexOrName is the name or index of the column that will be used as the label for each pie part

    In other words, you can display the distribution of the values of "valueColumnIndexOrName" as a pie, using "labelColumnIndexOrName" to label each value. The percentage of each value w.r.t. the column's total will also be displayed in the label. The startAngle parameter is optional: it gives the angle of the first pie part (default is 0). If no title is given (i.e. title is null) the label of the column given by "valueColumnIndexOrName" will be used.

Both methods renderPieChart and renderBarChart can be called any number of times: if the chart already exists it will be updated (ie. not rebuilt). For example, you can call one of these methods each time the table is sorted (tableSorted) or edited (modelChanged), in order to update the chart to match the new data. Updating a chart is very fast, which gives a very nice effect: when sorting or editing the grid, the chart "follows" beautifully.

If your grid has a row displaying e.g. the total, you can ignore it in the charts by setting EditableGrid.ignoreLastRow to true. In this case, this last row will also be ignored when sorting the grid data.

Extensions

The directory "extensions" is there for interesting cell editors, renderers and validators. It contains a subdirectory "jquery" with the jQuery library v1.4.2. Extensions may indeed be based on jQuery, unlike the core library which stays jQuery-independent.

Current extensions:

  • two variants of "AutocompleteCellEditor", each based on a different autocomplete jQuery plugin

editablegrid's People

Contributors

cpressey avatar dound avatar driverpt avatar frankschmitt avatar jeinokc avatar jybeaujean avatar kuemit avatar kulikovpavel avatar louisantoinem avatar pestbarn avatar shiroychoksey avatar vinniecent avatar yshalabi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

editablegrid's Issues

InfoHeaderRenderer problem

this may be a bug [hard to imagined it being designed this way]

with enablesort true, plus a infoheader alert, the column header is displayed
with enablesort false, plus a infoheader alert, the column header is not displayed

replicated in the 'full demonstration'

Row for inserting data

I was wondering if I could get some help (code) in :

  1. to have a row at the end of the table with textboxes and dropdowns for the respective cells and an insert button instead of the delete button, so if i write values in those textboxes and click the insert button, the row gets inserted with auto ID. just like somewhat the ASP.NET gridview.
  2. Is there any support for JSON data type. I mean binding the table to JSON Data.
  3. the grid does not support multiple choice values. it only supports single choice with dropdown. Are you considering this in your next version.

How to Group Rows Using Editablegrid

Hi

I am trying to do grouping of row based on one column. Say if i have a table with 5 columns (address, city, state, country, pincode) and i want to group all the rows which has the same state in tree like view.

can you please suggest an idea to implement the same using your plugin.

I am new to github so dont know where to post the query so placing it under issue. sorry for that.

Thanks.

demo_attach.html issue

If you use E{nnn} as row id in the html table (instead of the numbers you used) the demo throws an "tr is null" error and doesn't delete the row when you click on the action column.

Look here for a complete html example [http://tinypaste.com/d2182]

Numeric cell editor not displaying configuration option properly

When I define a metadata entry for a field (eg. "double" and give it a "values" property, the renderer handles the display of certain options properly (in my case, "thousands_separator" and "decimal_point"). However, when the field needs to be edited, instead of a text editor as I expect, I'm provided a select dropdown with the values contained in the "values" property in addition to my original value. It seems to me that this may be an issue with the SelectCellEditor incorrectly being triggered for the columns containing a "values" property. This seems to be occurring not only in the snapshot download but the development version as well. The documentation for defining a column's value formatting isn't exactly clear about how this should be done.

Add a new row

Hi! First of all thanks a lot for this wonderful library.

I have succeeded importing it to a django server and make it work with python. auto saving each value modification to server.

But now I'd like to append an empty row except the first column which is the index row value. Do you have a scripted example for that?

I've tried the duplicate() and the insertAfter() value. but it doesn't changes the current row values but the previous one. and also import the this.getrowvalues(this.getRowcount-1). Do you have an easy way to do that? Thanks a lot

Big tables.

It would be nice to have checkboxes to select witch columns are shown on large tables. =)

Maximum size of XML document?

I have been working with Editable grid for a few hours over the weekend and I noticed that if I have more than 20 rows in my XML document the grid fails to render at all and throws a JavaScript error. [setCellRenderer] Invalid column: action
I am not sure what I should do to resolve the issue or if the loadXML function just can't handle the large amount of columns that I am presenting in the XML ( currently 18 ).

double datatype column show comma as the deicmal separator

Hi,
double datatype column is showing comma(,) as the decimal separator.
Is it fixed or can we change that ?
My local machine regional settings are as per English, New Zealand, so ideally it should show period as the decimal.

also I would like to show cubic meters as unit of the value, is it possible to do that ?

I used below line as metadata:
{"name":"12-06am","label":"12 July 06:00 a.m.","datatype":"double(2)","bar":false,"editable":true,"values":null},

untitled

Thanks !
Sunny

Invalidate Cell

When I add a new row, I would like to invalid some cells to let the user know that she needs input data there.
How do I add a validator for IPV4 addresses?

Thanks,

ltlu

My SQL more features

Hi there great job with the grid, do you have any time to release enhanced version like similar to jqgrid with,

  1. Form to capture input, with more table related featured for adding new rows etc...

appreciated if you could add more featured related to My SQL back end table

Favaz

Auto sorting in HTML rendering

In some situations, when sort is enabled, HTML table rendering is misbehaving.
The table is auto-sorted, although the header row was not clicked. However, when I came to edit a filed by clicking it, the input of the field was reverted to the original value before the table sort. If I wouldn't edit the value, the value that will be shown is the original one, but modelChanged function was not called.

You can see it here:
http://www.editablegrid.net/editablegrid/examples/attach/index.html
For example, in the country row click on France field. you will get Belgium automatically.

getJSON()

Hello,

it seems like there is no way of extracting all data - is there some "opposite" of loadJSON(.)? Eg
editorGrid.getJSON() -> Returns current values as JSON?

Thanks, yanosz

Memory leak

Editable grid has a memory leak when rendering a table. I tried to trace this down a little, and I think the problem is that _renderGrid (which creates the table) is called twice:

  1. renderGrid -> _renderGrid
    2).renderGrid -> setPageIndex -> refreshGrid -> _renderGrid

I suspect that there is already an event attached to the first table created which prevents it from being freed by the garbage collector when the 2nd table overwrites it.

I'm not sure if it's a good idea to create the table twice to begin with, but if it is necessary, need to remove the events or whatever is keeping the reference to it.

Since this is done internally in renderGrid, there is no way to bypass it from the outside by removing the table (i.e. $("#tableid").empty() ).

applyEditing function bad for custom converters

In trying to write my own converters (convertTo for display, convertFrom for model update) I found that the applyEditing method updated the display prior to updating the model (and calling the modelChanged event).
In my attempts to emulate a to (render) and from (editor) converter, this seems logically backwards.

My recommendation would be to use the editableGrid.getValueAt method to get the previousValue first, then update the model if the value is different, and then call the setValueAt method. It would seem to flow more logically from a programmatic perspective.
(Note: this method I believe starts on line 158 of the editablegrid_editors.js)

language encoding issue

Retrieving values(utf-8_unicode_ci) from database and it turns up as ?????.
but when i edit that value on the EditableGRid, with the respective language, it will turn up as unreadable value.
let's say Japanese, すし(sushi). if sushi is store in data base, it showed up as ???? on EditableGrid
if sushi is stored into database using EditableGrid, then it will appear as "��" in database.

please help me

Passing value to an editablegrid

I would like to pass a value into an editablegrid, hence change the sql in the grid.However, no matter GET or POST method, i found it doesn't work.

Wiki Section needed...

Where is your Wiki section with samples, tutorials, screen snapshots, etc.
This would be FANTASTICALLY helpful :-)

Documentation needed...

Please provide - in the source code - better documentation.
For example, the class EditableGrid.php...

  1. why is this needed?
  2. what is the primary API?
  3. where in the "process" is this server functionality used?

Multiple row removal painfully slow

Hi

Removing more 20 rows starts becoming very slow - the call to refresh the grid after every remove seems to be the culprit. I have added a removeMulti function and edited the remove function to allow for suppressing the refreshGrid when removeMulti calls remove().

You can view this at
https://github.com/dineshcooper/editablegrid/commit/dfc1a9456004616005df412c1777c6529c95cd1c

Seems to work well for me but would like to see if you have a more elegant solution.

Thanks

Add a "json" data type

Columns can be declared of type "json".

The values in these columns will be automatically evaluated in Javascript.

Of course, such columns would probably need a specific renderer and editor.

Personal note: use this in Timetrack (theoretical amount) and NewsOn (contact lists).

missing files

I think an AUTHORS file (with at least one email address) + a LICENCE file would be a must-have in the repository.
On a side note the changelog may get its order reversed as it's usually the case.

use of native PHP facilities

While looking at EditableGrid.php I found that most of the code relates to XML and JSON generation.
PHP provides some facilities for this like simplexml and json* functions. Is there any technical reasons for not using them ?

defining id, updating 2 db-tables from 1 editablegrid

I know guys aren't big on questions, but I am not sure what else to do

scenario:
sql joined table - TableA, TableB
two ID colums
and a grid with columns from both db-tables

how does editableGrid.getRowId(rowIndex) get to be something like editableGrid.getValueAt(rowIndex, editableGrid.getColumn("TableB ID"))

how can the ajax > data > id column be defined

it's explained better here if you're keen

http://stackoverflow.com/questions/11344155/ajax-update-to-multiple-database-tables

re - but I am not sure what else to do... I've no problem using freelancer.com et al but would like to learn where I can

Feature request: configurable date format in detail

It'd be great addition if we can define date and time format to use (for editing and validations), not just US/EU but in detail like: yyyy-MM-dd'T'HH:mm:ssZZ

We could use configs of java.util.Date, if possible.

Thanks.

Content Type on JSON requests

When making a json request the content-type should be set to json. It currently doesn't appear to set content type.

buttons or other events inside cells

I have a button inside of a cell, which I created a CellRenderer with "" code which works fine. I'd like to have it respond to a button click. I'd like the row to be deleted, but also have the rest of my code know that the row was deleted.

Any thoughts would be helpful.

In short, here's my code:

function DeleteCellRenderer(config) {
  this.init(config);
}

DeleteCellRenderer.prototype = new CellRenderer();
DeleteCellRenderer.prototype.render  = function(_cell,_value){
          $(_cell).html("<button class='btn btn-small'><i class='icon-trash'></i></button>")
              .on("click", {obj: this, cell: _cell, value: _value}, this.deleteRow); };

DeleteCellRenderer.prototype.deleteRow = function(evt) {
  var row =  evt.data.obj.editablegrid.getRowIndex($(evt.data.cell).parent().attr("id").split("_")[1]);

// I can remove the proper row here, but need to notify the rest of my program that the data was deleted.

              };

HTML entities problem

When I attach EditableGrid to existing HTML table and in some cell there are & amp; entities, Grid replaces ampersand with & so it becomes & amp;amp; and in browser I see & amp; instead of &.

Second problem is that, when i start to edit some cell where are some &, in input i get & and it is annoying.

First problem I temporarily solved by creating cellRenrerer where i do cell.innerHTML = value.replace('& amp;amp;', '& amp;');

But the second one is still remains.

Please fix it.

change on* events to addEventListener

Hi,

Is it possible to change the onclick, onblur, and other events to addEventListener?
I use this for greasemonkey, which does not support setting on* due to xpcnativewrapper

thanks, love the lib

Mulitple inputs inside one cell

I have a grid with a column of date/times. Visually, I have the date printed in standard form and then the time as a clock icon (the time is less important), which I've generated in a custom renderer. I would like to be able to click on the date to get a date picker (much like the default is) and then the clock to edit the time.

Looking a the source code, the actual target element is lost in the mouseClicked function of EditableGrid and only the row and column is captured. It seems like to get the functionality, I could override this method to capture the clicked element. Any other thoughts?

TextCellEditor maxlen config

Hi,

Is it possible to make maxlen configurable?
It defaults to 255, this is a bit short for my purposes, I have to change the source to make it bigger
function TextCellEditor(size, maxlen, config) { this.fieldSize = size || -1; this.maxLength = maxlen || 255; if (config) this.init(config); };

thanks

Ability to highlight edited cells / cell data and disable sorting

Hi,
I need to highlight the edited values until user hits a save button. Is it possible using editable grid ? if yes, then how ?

Also I need to disable sorting of all the columns in my grid, I tried to use below metadata to disable sorting but this doesn't work. : "enablesort":false

{"name":"12-06am","label":"12 July 06:00 a.m.","datatype":"double(,2, dot, comma, 0, n/a)","bar":false,"editable":true,"values":null,"enablesort":false},

Thanks a lot for your time !
Sunny

How to get XML data not using php?

I'm currently using this with bottlepy and python and I am linking it to a sqlite3 database.
I've written code that can generate XML code based on the data I need from the database and I can display this very easily.
I also have code written for generating data from XML code.

The issue now is how do I get new XML code if the user changes the data. I know there is a function in php but for some reason I can't get that to work. And I don't know how I would be able to interface that with the rest of my python code to send it back to the database.

Please let me know if there is already a way. I am willing to contribute to this project if there is no current way to do this. Let me know what path I can follow to get this to work.

Thanks

Bug in processJSON(), and a fix.

So, looking at this demo --

http://www.editablegrid.net/editablegrid/examples/json/index.html

it all works fine. However, it seems to work fine only because of the way the sample data was set up. In particular, part of grid.json looks like this --

    {"id":1, "values":{"country":"uk","age":33,"name":"Duke","firstname":"Patience","height":1.842,"email":"[email protected]","lastvisit":"11\/12\/2002"}},
    {"id":2, "values":["Rogers","Denise",59,1.627,"us","[email protected]","","07\/05\/2003"]},

processJSON() allows you to specify data either as a list of columns or as an associative array. Looks like the sample data was given this way so we can see both methods. (Very nice.)

However, the list of columns only works as long as an associative array had been processed previously.

If the first data point processed is a list of columns, you get a

"Uncaught ReferenceError: cellValues is not defined"

error.

The fix seems quite simple. In editablegrid.js, add this line --

            var cellValues = {};

before this line

            // row values can be given as an array (same order as columns) or as an object (associative array)^M

info about column sorted

In callback tableSorted any parameters regarding the sorted column.

in editablegrid.js row 1219, this change:

// callback
tableSorted(columnIndexOrName, descending);

(PS: how do I update the file compressed with this change?)

thanks

Incorrect editor location

When editable grid is inside a div that has a scroll bar, the editor location doesn't account for the scrollbar position.
In other words, if the div scroll bar is 100px down, the editor shows 100px below the cell location.

undefined this.detectDir()

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.

Mark column as ineditable

Hi,
is it possible to mark a column non-editable in editable grid ?
I have a requirement where the first column will have static information and that should not be allowed to change.
Thanks!
Sunny

Cell block

I wonder if the current version can lock the cells so that can not be edited.

In the readme I have not seen anything about it.

Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.