GithubHelp home page GithubHelp logo

Comments (4)

mvdputten avatar mvdputten commented on August 17, 2024

I've written an example to show the current behaviour.
Uncomment the additional script tags to try out my fix.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Example for testing the cell rendering after editing.</title>
		<meta charset="utf-8" />
		<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
		<script src="http://code.gijgo.com/1.0.0/js/gijgo.js" type="text/javascript"></script>
<!--
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/widget.js" type="text/javascript"></script>
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/grid/js/grid.base.config.js" type="text/javascript"></script>
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/grid/js/grid.base.events.js" type="text/javascript"></script>
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/grid/js/grid.base.methods.js" type="text/javascript"></script>
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/grid/js/grid.base.widget.js" type="text/javascript"></script>
		<script src="http://rawgit.com/mvdputten/gijgo/bugfixrenderafteredit/src/grid/js/grid.inlineEditing.js" type="text/javascript"></script>
-->
    <link href="http://code.gijgo.com/1.0.0/css/gijgo.css" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<table id="grid" style="width:100%"/>
		<script type="text/javascript">
    
    var weekdays = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
        $(document).ready(function () {
            var data, textEditor, weekDayEditor, weekDayRenderer;
            data = [
                { "ID": 1, "Name": "Hristo Stoichkov", "DayOfWeek": 1 },
                { "ID": 2, "Name": "Ronaldo Luís Nazário de Lima", "DayOfWeek": 3 },
                { "ID": 3, "Name": "David Platt", "DayOfWeek": 4 }
            ];
            textEditor = function($container, currentValue) {
                
                $container.append('<input type="text" value="' + currentValue.replace(/\'(.*)\'/, '$1') + '" style="width:95%"/>');
            },
            weekDayRenderer = function (value, record, $cell, $displayEl) {
              $displayEl.text(weekdays[value]);
            };
            weekDayEditor = function ($container, currentValue) {
                var selectHtml, selected;
                selectHtml = "<select>";
                weekdays.forEach(function (label, value) {
                  selected = (currentValue !== undefined && value === currentValue)?"SELECTED":"";
                  selectHtml += "<option " + selected + " value=" + value + ">" + label + "</option>"
            });
                selectHtml += "</select>";
                $container.append(selectHtml);
            };
            $("#grid").grid({
                dataSource: data,
                columns: [
                    { field: "ID", width: 34 },
                    { field: "Name", tmpl: "'{Name}'", title: "Template: '{Name}'", editor: textEditor },
                    { field: "DayOfWeek", title: "Renderer: Day of week", renderer:weekDayRenderer, editor: weekDayEditor },
                ]
            });
        });

    </script>
	</body>
</html>

from gijgo.

atatanasov avatar atatanasov commented on August 17, 2024

Thanks for finding this issue. We are going to fix this problem in the new release, that is planned for release later this year.

from gijgo.

atatanasov avatar atatanasov commented on August 17, 2024

This issue is fixed in the new development version 1.1.0. You can see an working example at http://localhost:59034/Temp/2dc31c65-e4e7-44b6-8bae-36b5feff16de.html

You can use the current development version from:
https://cdn.rawgit.com/atatanasov/gijgo/master/dist/combined/js/gijgo.min.js
https://cdn.rawgit.com/atatanasov/gijgo/master/dist/combined/css/gijgo.min.css

from gijgo.

mvdputten avatar mvdputten commented on August 17, 2024

Works like a charm. Thanks!

from gijgo.

Related Issues (20)

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.