Jump to content

In unimdbgrid how do I know in which field a click was executed?


leandroavila74

Recommended Posts

Can you try this ?:

 

1. UnimDBGrid1 -> ClientEvents -> ExtEvents -> function itemtap:

function itemtap(sender, index, target, record, e, eOpts)
{
    ajaxRequest(sender, '_cellclick', ["cellindx="+index, "colindx="+e.target.$column.getDataIndex()]);
}

2. UnimDBGrid1AjaxEvent:

procedure TMainmForm.UnimDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_cellclick' then
  begin
    ShowMessage(Params.Values['cellindx']+', '+Params.Values['colindx']);
  end;
end;
Link to comment
Share on other sites

 

Can you try this ?:

 

1. UnimDBGrid1 -> ClientEvents -> ExtEvents -> function itemtap:

function itemtap(sender, index, target, record, e, eOpts)
{
    ajaxRequest(sender, '_cellclick', ["cellindx="+index, "colindx="+e.target.$column.getDataIndex()]);
}

2. UnimDBGrid1AjaxEvent:

procedure TMainmForm.UnimDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_cellclick' then
  begin
    ShowMessage(Params.Values['cellindx']+', '+Params.Values['colindx']);
  end;
end;
 
image.jpg
 
I would like to be able to intercept the tap of the images, I have the 2 fields that are of type images, I want to be able to know when I click on "minus" or "plus".
The previous example was perfect, but it does not take the clicks on the images :(
Link to comment
Share on other sites

Ok,

 

Then try this:

function itemtap(sender, index, target, record, e, eOpts)
{
    var _column=e.target.parentNode.$column || e.target.$column;
    ajaxRequest(sender, '_cellclick', ["cellindx="+index, "colindx="+_column.getDataIndex()]);
}

Best regards.

  • Like 1
Link to comment
Share on other sites

Ok,

 

Then try this:

function itemtap(sender, index, target, record, e, eOpts)
{
    var _column=e.target.parentNode.$column || e.target.$column;
    ajaxRequest(sender, '_cellclick', ["cellindx="+index, "colindx="+_column.getDataIndex()]);
}

Best regards.

 

you are the best!
worked perfectly
 
thank you so much
  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Ok,

 

Then try this:

function itemtap(sender, index, target, record, e, eOpts)
{
    var _column=e.target.parentNode.$column || e.target.$column;
    ajaxRequest(sender, '_cellclick', ["cellindx="+index, "colindx="+_column.getDataIndex()]);
}

Best regards.

 

Delphi Developer,

 

Why this example does not work with "TUnimDBListGrid"?
I tried to use it the same way and it does not work
 
Best regards.
Link to comment
Share on other sites

 

Delphi Developer,

 

Why this example does not work with "TUnimDBListGrid"?
I tried to use it the same way and it does not work
 
Best regards.

 

 

Hi,

 

Can you try this approach for now?!:

function itemtap(sender, index, target, record, e, eOpts)
{
    var _cmp=Ext.get(e.target);
    var colIndx=$(Ext.get(target.id).select('#'+_cmp.id+'.x-mgrid-cell').elements[0]).index();
    if (colIndx!=-1) {
        ajaxRequest(sender, '_cellclick', ["rowIndx="+index, "colIndx="+colIndx]);
    };
}
procedure TMainmForm.UnimDBListGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_cellclick' then
  begin
    ShowMessage(Params.Values['rowIndx']+', '+Params.Values['colIndx']);
  end;
end;

Best regards.

Link to comment
Share on other sites

Hi,

 

Can you try this approach for now?!:

function itemtap(sender, index, target, record, e, eOpts)
{
    var _cmp=Ext.get(e.target);
    var colIndx=$(Ext.get(target.id).select('#'+_cmp.id+'.x-mgrid-cell').elements[0]).index();
    if (colIndx!=-1) {
        ajaxRequest(sender, '_cellclick', ["rowIndx="+index, "colIndx="+colIndx]);
    };
}
procedure TMainmForm.UnimDBListGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
begin
  if EventName = '_cellclick' then
  begin
    ShowMessage(Params.Values['rowIndx']+', '+Params.Values['colIndx']);
  end;
end;

Best regards.

 

Hello,
 
It did not work for me, nothing happens at the event,
But I'm solving my problem another way, using a unimscrollbox and creating my grid as I need it. Now I need your help on another topic.
 
 
Thanks a lot for the help
Link to comment
Share on other sites

  • 2 years later...
2 hours ago, gerhardhziegler said:

ItemTab seems to be obsolete. I have childsingletap, childtap etc., but without Index param, but I cant figure out, how to extract the (clicked) column.

Hi, 

Can you make a simple testcase for this? 

Link to comment
Share on other sites

  • 3 weeks later...

The case is very simple, I extracted now from my application and source:

I have a UnimDB Grid, which have two picture fields, that should act like "actionbuttons" (in desktop version). The challenge is: The green/gray buttons should fire wenn doublclicked (with column number) the "disclose" (fake) buttons should fire on single click.

At the moment I am using the Events ChildTap and ChildDoubleTap and sending the clickobject back as parameter, because I couldnt find out, how to locate the column of the click.

 ajaxRequest(sender, '_cellclick', ["clickobject="+location.getFocusEl("el").id]);

Afterwards, which is of course a bad idea, I am parsing the name of the object, because they are always numbered in the grid from 1-X, column after column, row after row. Using this I can get the clicked column by a Modulo of the column number. Of course this is "katastrofa" and causes an ajax error from time to time, saying grid is null or something like this.

A good solution would be fine. At least to know, how to read the clicked col in the ChildTap oder ChildDoubleTap Event.

Best thanks to all.

 

 

Screenshot_20.jpg

Link to comment
Share on other sites

×
×
  • Create New...