institut-de-genomique / Ultimate-DataTable

This AngularJS directive generate a HTML table with build-in fonctionnality like save, edit, remove, pagination etc...
http://institut-de-genomique.github.io/Ultimate-DataTable/
45 stars 26 forks source link

When overriding the render function it keeps on firing continues #6

Closed davidhigler closed 8 years ago

davidhigler commented 8 years ago

Dear Ultimate-DataTable,

I've got the following column definition:

                {
                    "header": "Actions",
                    "property": "id",
                    "order": false,
                    "type": "text",
                    "render": function (value, line) {
                        console.log(value.id);
                        //console.log(line);
                        return "<span>" + value.id + "</span>";
                    }
                }

When the datatable renders the id is shown correctly but the render function keeps on firing. In the browser console i see the id constantly being outputted. It seems that the overridden render function is stuck in some sort of loop.

Am I doing something wrong or is this a possible bug of some kind?

My goal is to put a button in the action column and give it the id of the item represented in the row. With this I can couple a click action to the button of a specific row for possibly a redirect to a page that's linked to the item in the row.

Maybe you have a better solution for what i'm trying to accomplish.

Many thanks,

Greetings,

David

galbini commented 8 years ago

Hi David,

The better way is to put directly your html code in render attribute. UDT generate a variable call cellValue that represent the value of the property.

               {
                    "header": "Actions",
                    "property": "id",
                    "order": false,
                    "type": "text",
                    "render": "<span ng-bind='cellValue' />"

                }

Thanks to use UDT ! Guillaume

davidhigler commented 8 years ago

Hi Guilaume,

Many thanks! Didn't know that, works perfectly. You may get a pull request from me in the future ;-).

Thanks again.

David

galbini commented 8 years ago

Hi David,

You're welcome.

Thanks. Guillaume