Author Topic: Selected ID  (Read 3432 times)

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Selected ID
« on: March 21, 2019, 05:45:48 pm »
Hello,

How do I get the ID number of the selected fields?

https://yadi.sk/i/cp5BSgn7Bpdrew

Console.log () is enough

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Selected ID
« Reply #1 on: March 21, 2019, 05:51:23 pm »
Ex: https://paramquery.com/pro/demos/selection_cell

Cell selections are rectangular in shape.

selectChange event provides selection information in form of beginning rowIndx (r1) to end rowIndx (r2) and beginning colIndx (c1) to end colIndx (c2)

Code: [Select]
[{"r1":3,"c1":5,"firstR":3,"firstC":5,"r2":3,"c2":5,"rc":null,"cc":null,"type":"cell"}]
« Last Edit: March 21, 2019, 05:54:27 pm by paramquery »

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: Selected ID
« Reply #2 on: March 25, 2019, 04:14:23 pm »
Hello,

I got the "ID" of the selected records. I assigned it to "Input.value".

But how do I get the "dataIndx" information of the selected records? (getCellHeader, gettCell etc.?)


Code: [Select]
,selectChange: function (evt, ui) {
var selectJson=JSON.stringify(ui.selection.address());
var selectArray=JSON.parse(selectJson);
var selected=selectArray[0];
if (selected==undefined){} else{
var rowStart=selected.r1;var rowStop=selected.r2;var cellStart=selected.c1;var cellStop=selected.c2;
$('#r1').val(rowStart);$('#r2').val(rowStop);$('#c1').val(cellStart);$('#c2').val(cellStop);
var selectedValue=[];
for (i = rowStart; i <= rowStop; i++) {selectedValue.push(grid.getRowData({rowIndx:i})['ID']);}
$('#dtaLabel').val('TODO-Coll.DataIndx');
$('#dtaValue').val(selectedValue.join());
}}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Selected ID
« Reply #3 on: March 25, 2019, 05:15:55 pm »
dataIndx can be obtained from colIndx

Code: [Select]
grid.getColModel()[ cellStart ].dataIndx;

omerix

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 148
    • View Profile
Re: Selected ID
« Reply #4 on: March 26, 2019, 01:24:47 am »
Thanks param.

dataIndx can be obtained from colIndx

Code: [Select]
grid.getColModel()[ cellStart ].dataIndx;