Author Topic: Set new value based on other value  (Read 1802 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Set new value based on other value
« on: October 06, 2016, 12:43:46 pm »
Im trying to use render function to set a new cell value in other column depending on an if statement:

Code: [Select]
render: function (ui) {
if (condition) {
        return "test" + ui.cellData; // this is the only line executed
        ui.rowData.column1 = "test"; // this line does not work, however it works if above line is removed
        }
}

Thanks in advance.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Set new value based on other value
« Reply #1 on: October 06, 2016, 01:30:17 pm »
That's quite normal. Any line after return statements are not executed. You could move that line before return statement.

Anyway there is a better way to set value of a cell which is based on other cell values with help of column.formula.

http://paramquery.com/pro/api#option-column-formula