ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: darioup on September 21, 2018, 12:44:50 pm

Title: An undesired "undefined" word is showing when using render function and grouping
Post by: darioup on September 21, 2018, 12:44:50 pm
Hi, I'm using the render function to make some customization on a column.
I'm also using the grouping feature to keep data more clear.
When the data is grouped it seems that the column with render function displays their "summary" option, which I don't declare in the colModel, and an undefined word is showed at the top of the table
How can I remove this "undeifned" word, or stop colModel with render function from being summarized?
(https://preview.ibb.co/gnz1ez/Screen_Shot_2018_09_21_at_1_50_08_AM.png)

Removing the grouping
(https://preview.ibb.co/j1eOsK/Screen_Shot_2018_09_21_at_1_50_22_AM.png)
Code: [Select]
colModel: [
                { title: "ID", "dataType": "integer", "dataIndx": "id",
                    editable: false, maxWidth: 50, align: 'center', denyGroup: true, },
                { title: "Nombre", dataType: "string", dataIndx: "name",
                    editable: false, width: 150 },
                { title: "Material", dataType: "string", dataIndx: "material",
                    editable: false, },
                { title: "Color", dataType: "string", editable: false, dataIndx: "color",
                  render: function (ui) {
                      var html = "";
                      if (ui.rowData.color_value) {
                          html += '<div class="color-sq" style="background-color:'+ ui.rowData.color_value +'"></div>';
                      }
                      html += "<span>"+ ui.rowData.color +"</span>";
                      return {
                          text: html
                        }
                  }
                },
                { title: "TamaƱo", dataType: "string", dataIndx: "size",
                    editable: false, },
                { title: "Stock", dataType: "integer", dataIndx: "quantity",
                    maxWidth: 80, align: 'center', denyGroup: true,
                    summary: { type: "sum" },
                  render: function (ui) {

                      return {
                          style: 'background-color: rgb(76, 175, 80);color: white;border:1px dotted #333333;border-top:0;'
                      }
                  }
                },
            ],
Code: [Select]
groupModel: {
                on: true,
                dataIndx: ['name'],
                collapsed: [true],
                fixCols: false,
                summaryInTitleRow: 'all',
                titleInFirstCol: false,
                headerMenu: false,
            }
Title: Re: An undesired "undefined" word is showing when using render function and grouping
Post by: paramvir on September 21, 2018, 01:30:59 pm
If undefined is returned as text value by your render function, then it displays undefined.

Code: [Select]
html += "<span>"+ ui.rowData.color +"</span>";

Try changing it to

Code: [Select]
html += "<span>"+ (ui.rowData.color || "") +"</span>";

Please let me know whether it fix your issue, if not then kindly share a jsfiddle.
Title: Re: An undesired "undefined" word is showing when using render function and grouping
Post by: darioup on September 25, 2018, 01:38:44 pm
thanks it solved  :)