Hi Abu,
I have a master grid of cars where you select one and the price plus mileage is communicated to the detail grid as subgridparams. As you know from my code, this works very well. However, in the detail grid, I want for each row to take the price and mileage of the competitive car and subtract from these the price and mileages from the master grid to provide the difference. For example, I select a car costing £10,000 in the top grid and in the detail grid the first row has a car costing £8,000 so I want to show £2,000 in the Price Diff column and so on for each row.
I created a function and event for the do_onload of the detail grid. I know how to get the values of the subgridparams. I can for each row in the detail grid get the price and mileage of each car. How do I set the value of the Price Diff and Mileage Diff columns? Do they have to be editable=true? For example, I tried:
jQuery(‘[name=”car_mileage_diff”].editable’).val(mileage – comp_mileage);
Thanks,
Gary
I figured out the following code:
st = (mileage – comp_mileage).toString();
jQuery(‘#comp tr.jqgrow:eq(‘+i+’)’).find(“td:eq(11)”).html(st);
but how do I use the column name rather than the column number?
Thanks
Gary
Just to log the solution, better way to pick column is to use aria-describedby attribute.
Instead of td:eq(11)
You can use:
td[aria-describedby="list1_colname"]
where list1 is grid id and colname is column name.
jQuery('#comp tr.jqgrow:eq('+i+')').find("td[aria-describedby=list1_colname]").html(st);