Column value based on the flag

Please take a look at my JSFiddle . I have a YearEligible column with Y and N values in the cell for each record. Based on this I want to decide what values does the Year column sends upon clicking Get rows button.

Explanation in detail regarding my requirement:

Let’s say If I have checked the very first row ( as shown in the image below):
enter image description here

When I click on the Get rows button, I can see the following in console.log which looks good:

[{
  available: true,
  boundindex: 0,
  firstname: "Mayumi",
  lastname: "Nagase",
  price: 3.25,
  productname: "Espresso con Panna",
  quantity: 6,
  total: 19.5,
  uid: 0,
  uniqueid: "2128-24-28-17-311629",
  visibleindex: 0,
  yeareligible: "Y",
  yearValue: "2011"
}]

However, let’s say if I select a record where the Year Eligible column has a value of N and click on the Get rows button, I see the following in console.log:

[{
  available: true,
  boundindex: 1,
  firstname: "Regina",
  lastname: "Davolio",
  price: 3.3,
  productname: "Doubleshot Espresso",
  quantity: 8,
  total: 26.4,
  uid: 1,
  uniqueid: "2917-25-23-18-212828",
  visibleindex: 1,
  yeareligible: "N"
}]

My observation:

The above console.log is not returning anything for yearValue, which makes sense since I didn’t select anything.

My Questions:

  1. In above scenario, is it possible to return a default value of yearValue as -1? Basically, I want to include yearValue as -1 when a user selects a record with Year Eligible value set to N.

  2. Display N/A on the cell under Year column for which the Year Eligible column has a value of N ?

Thought of asking this question on this forum to see if we can achieve this using javascript and the jqwidgets library knowledge is not needed. Thanks !

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.