Fábio Matte Posted October 5, 2023 Share Posted October 5, 2023 Intercept OnClick event that is inside UniDBGrid's store.load. I created a code with CSS and also customized the display of data in a UniDBGRID (see attached images). I would like to intercept the OnClick event that is inside store.load. By clicking this button, execute some routine within the Application. How could I do it correctly? CODE: function store.load(sender, records, successful, operation, eOpts) { sender.grid.getColumns()[0].renderer = function (value, metadata, record) { var imagePath = ''; if (!imagePath || imagePath === '') { imagePath = '/img/clientes.png'; // Imagem padrão } var description = record.get('1'); if (description.length > 800) { description = description.substring(0, 800) + ' ...'; } metadata.tdAttr = 'data-qclass="dvQtip" data-qtip="' + record.get('0') + '"'; return '<div class="dvContainer">'+ '<table class="tableContent"> ' + '<tr>'+ '<td class="thumbnailCell">' + '<img src="' + imagePath + '" class="thumbnail">' + '</td>' + '<td>'+ '<table class="tableContent"> ' + '<tr>'+ '<td class="divTitle" colspan="3">'+ // Atualizar o colspan para 3 '' + record.get('0') + '</td>'+ '</tr>'+ '<tr>'+ '<td class="divSubTitle" colspan="3">'+ '<span class="labelDesc">Descrição:</span>' + description + '</td>'+ '</tr>'+ '<tr>'+ '<td class="divCity" colspan="3">'+ '<span class="labelTemp">Temporalidade:</span>' + record.get('2') + '</td>'+ '</tr>'+ '<tr>'+ '<td class="divCity" colspan="3">'+ '<span class="labelTemp">Localização:</span>' + record.get('7') + '</td>'+ '</tr>'+ '<tr>'+ '<td class="divNewClass1">'+ '<span class="labelDesc">Data do Documento:</span>' + record.get('4') + '</td>'+ '<td class="divNewClass2">'+ '<span class="labelDesc">Data do Descarte:</span>' + record.get('5') + '</td>'+ '<td class="divNewClass1">'+ '<span class="labelDesc">N.º Documento:</span>' + record.get('6') + '</td>'+ '</tr>'+ '</table>'+ '</td>'+ '<td>'+ '<div class="fileLink" onclick="showPnlArquivos();">' + '<img src="/css/img/ged/files-48.png" alt="Arquivos" />' + '<span>Arquivos</span>'+ '</div>'+ '</td>'+ '</tr>'+ '</table>'+ '</div>'; }; sender.grid.getView().refresh(); } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 5, 2023 Share Posted October 5, 2023 1 hour ago, Fábio Matte said: showPnlArquivos(); Hello, Where is the function assigned? Testcase? Quote Link to comment Share on other sites More sharing options...
Fábio Matte Posted October 5, 2023 Author Share Posted October 5, 2023 9 hours ago, Sherzod said: Hello, Where is the function assigned? Testcase? So, I'm trying to assign the function in UniDBGrid, in the OnAjaxEvent Event, but without success. All the code I do does not trigger showPnlArquivos(). How could I and where could I call this function? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 5, 2023 Share Posted October 5, 2023 1 minute ago, Fábio Matte said: showPnlArquivos() Where is this function defined? Quote Link to comment Share on other sites More sharing options...
Fábio Matte Posted October 5, 2023 Author Share Posted October 5, 2023 I defined it inside a UniHTMLFrame that is inside the form that contains the DBGrid. function showPnlArquivos(panelID) { var panel = Ext.getCmp(panelID); if(panel) { panel.setVisible(true); } ajaxRequest(frameGED_PesquisaAvancada.dbGridResultado, 'showPanelClick', []); } And then I put the following in OnAjaxEvent: procedure TframeGED_PesquisaAvancada.dbGridResultadoAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'showPanelClick' then begin pnlArquivos.Visible := True; end; end; When I open the application, the following error ends up happening: Form OnCreate: JSName := pnlArquivos.JSName; JSCode := Format('showPnlArquivos(''%s'');', [JSName]); UniSession.AddJS(JSCode); Quote Link to comment Share on other sites More sharing options...
Fábio Matte Posted October 6, 2023 Author Share Posted October 6, 2023 Step by step video. for simplicity, I just want it to display a common message. If I can display this message by executing the procedure, I can perform other tasks. 20231006_145847.mp4 Quote Link to comment Share on other sites More sharing options...
SISBLU Software Posted February 8 Share Posted February 8 any Solution? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 14 Share Posted February 14 On 2/8/2024 at 11:07 PM, SISBLU Software said: any Solution? @Fábio Matte Hello, Sorry, were you able to succeed? Quote Link to comment Share on other sites More sharing options...
Fábio Matte Posted February 18 Author Share Posted February 18 On 14/02/2024 at 00:57, Sherzod said: @Fábio Matte Olá, Desculpe, você conseguiu? Good afternoon @Sherzod, yes, with a lot of research and testing I got where I needed to be, now my buttons are responding to clicks as I planned, it looks very good. I'm going to make a brief tutorial and put it here in this thread to help others who need it. Thank you very much. 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.