Jump to content

UniDBGrid and catch Button on Footer click


PetrB

Recommended Posts

Hi all,

 

I start play with this powerfull enviroment to Before-buy try.

I try customize TUniDBGrid a bit for my needs. I did found some piece of code to add button in line with refresh and paginal buttons on DBGrid footer.

I use this code in TabulkaKaret:TUniDBGrid.ClickEvents.UniEvents.Ext.toolbar.Paging[pagingBar].afterCreate

 

function pagingBar.afterCreate(sender)

{

  sender.add([

               {

                xtype: 'button',

                icon: 'files/images/navigate_plus.png',

                tooltip: 'Přidej řádek',

                handler: function() {

                 ajaxRequest(

                             MainForm.DetailUctuFrame,'addRow',

                 ["slctd="+MainForm.DetailUctuFrame.TabulkaKaret.getSelectionModel().getCount()]

                            );

                                    }

               },

               {

                xtype: 'button',

                icon: 'files/images/navigate_edit.png',

                tooltip: 'Oprav řádek',

                handler: function() {

                 ajaxRequest(

                             DetailUctuFrame.window,'edRow',

                 ["slctd="+TabulkaKaret.getSelectionModel().getCount()]

                            );

                                    }

               },               

               {

                xtype: 'button',

                icon: 'files/images/navigate_minus.png',

                tooltip: 'Zruš aktuální řádek',

                handler: function() {

                   ajaxRequest(MainForm.window, 'delRow',

                   ["slctd="+DetailUctuFrame.TabulkaKaret.getSelectionModel().getCount()]);

                }

               }

  ]);

The creating is working fine, I have 3 new buttons on position where I exactly want to have it.

 

The problem is, that I'm not to able catch click on those buttons. I have main form called MainForm:TMainForm.. The TabulkaKaret.TUniDBGrid is situated on DetailUctuFrame:TDetailUctuFrame.

My ajaxRequests are bad, but I don't know, how to write a correct syntax. Could you help me, please.

 

Best regards

 

Petr

Link to comment
Share on other sites

Hi,

what do you mean?

 

If I use this code above, my three buttons are created.

I have on my frame code for AjaxEvent catch

 

procedure TDetailUctuFrame.UniFrameAjaxEvent(Sender : TComponent;eventname: String;Params : TUniStrings);

 Begin  //here is a breakpoint

  inherited;

End;

 

the breakpoint catch situation, :

Sender=TabulkaKaret (the DBGrid)  EventName=data

Sender=TabulkaKaret                        EventName=load

Sender=TabulkaKaret                        EventName=load

Sender=TabulkaKaret                        EventName=load

Sender=TabulkaKaret                        EventName=load

 

I have three records in my table.

 

But when I press one of new buttons, there is no action in this routine.

 

I need to put some code "somewhere" to make service with those buttons.

 

PetrB

Link to comment
Share on other sites

This text is in start of my application HTML code

 

<link rel=stylesheet href="/uni-1.0.0.1421/css/uni-ext.css" />
<link rel=stylesheet href="/ext-4.2.5.1763/resources/css/ext-all.css" />
<script src="/ext-4.2.5.1763/ext-all.js"></script>
<script src="/uni-1.0.0.1421/ext-unicommon-min.js"></script>
<script src="/uni-1.0.0.1421/ext-sync-min.js"></script>
<script src="/ext-4.2.5.1763/locale/ext-lang-cs.js"></script>
<script type="text/javascript">

Link to comment
Share on other sites

In TDetailUctuFrame  (there is situated Grid and frame is hosted by TMainForm)

 

procedure TDetailUctuFrame.UniFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
begin  //Breakpoint here, to catch Event
  inherited;
//
end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...