Jump to content

picyka

uniGUI Subscriber
  • Posts

    1082
  • Joined

  • Last visited

  • Days Won

    34

Posts posted by picyka

  1. Follow the example. Look at the code in the servermodule -> CustomMeta
    Also note the code in the MainModule ExecuteTimerLigacao
    Notice the ajax Event on UniFrame1 it never fires

    demo.zip

  2. if (Http.responseText.includes("true")) {               
                                    
                   alert(top.UniFrameGerDadosLigacoes0.JSName);                 
                                                         
                    top.ajaxRequest(top.UniFrameGerDadosLigacoes0.JSName, '_call', ['value=true']);

                }

     

    that doesn't work either..

    Capturar.PNG

  3. What would be the correct way to trigger the ajaxRequest for a frame?

    top.ajaxRequest(UniFrameGerDadosLigacoes0, '_call', ['value=true']);

    not work.
     

  4. procedure TMainForm.UniTimerTarefasTimer(Sender: TObject);
    begin
      UniTimerTarefas.Enabled := False;
      if UniMainModule.GetFormInstance(TUniFormVisualizarTarefa, False) = nil then
        Self.LoadTarefas(False);
    end;

    This validation is done within the timer, the FreeOnClose is already set to false.

  5. function hasTask(host, token) {
    
        try {
    
            var Http = new XMLHttpRequest();
    
            Http.open("GET", host, false);
    
            Http.setRequestHeader('Authorization', 'Bearer ' + token);
    
            Http.send();
    
            if (Http.status == 200) {
    
                console.log('Buscado tarefa...');
    
                if (Http.responseText.includes("true")) {
    
                    top.ajaxRequest(top.MainForm.form, '_task', ['value=true']);
    
                }
    
            }
    
        } catch (err) {
            console.log('Erro Tarefa:' + err);
        }
    };
    procedure TUniMainModule.ExecuteTimerTarefa;
    begin
      {180000 - 3 MINUTOS}
      try
        var lUrl := Self.URL_EX_API + 'END POINT';
        var lJsString := 'var TimerTarefa = setInterval(function () {hasTask(' + QuotedStr(lUrl) + ',' + QuotedStr(Self.TOKEN_API) + ');}, 180000);';
        UniSession.JSCode(lJsString);
      except
        on E: Exception do
          TMessageUtils.Error(E.Message);
      end;
    procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
    begin
      if SameStr(EventName, '_task') then
      begin
        TToastUtils.Aviso('Tarefa encontrada, ja vou te mostrar!', False, 'Aviso de Tarefa',8000);
        UniTimerTarefas.Enabled := True;
      end;
    end;

    I will post here my solution, as I use API it became easier to solve.
    Ajax only fires when it's really needed.

     

    • Like 1
  6. 2 hours ago, irigsoft said:

    1. Try to use UniThreadTimer on Server side 

    2. You can add extra functions to check if user is online and if is not then close session

     


    @Sherzod Do you have any tips for this?

  7. I have a team that checks every 5 minutes to see if there is any task to display on the screen.
    These timers are dangerous to use because the session may not expire.
    Is there any way to take care of this? Another situation, the ChainMode property from my research, this option checked only runs the timer if there is no event being processed, would that be it?
    Would it be good to use it in these situations?

  8. I have some functions in a js file included in CustomFiles,

    it works perfectly.

    I would like to put these functions in MainForm.Script but there I had no result.

     

    async function copyText(texto) {
        try {
            await navigator.clipboard.writeText(texto);
        } catch (err) {
            console.error('Failed to copy: ', err);
        }
    };
    
    async function pasteText(jsName) {
        navigator.clipboard.readText().then(texto => {
            let cmd = jsName + ".setValue('" + texto + "');";
            eval(cmd);
        });
    };

     

  9. No dia 3/7/2023 às 2:44, Farshad Mohajeri disse:

    Há problemas quando o HyperServer é usado. Estamos nos dirigindo a eles. A compilação 1566 está chegando. Há algumas informações faltantes no documento. Tudo será corrigido.

    🙏

  10. On 3/3/2023 at 2:59 PM, Sherzod said:

    Hello,

    How is it focused?

    It would be the same action as the SelectOnFocus property from UniDBFormattedNumberEdit component.

  11. 24 minutos atrás, Farshad Mohajeri disse:

    Há problemas quando o HyperServer é usado. Estamos nos dirigindo a eles. A compilação 1566 está chegando. Há algumas informações faltantes no documento. Tudo será corrigido.

    Is it coming this week?

  12. On 11/12/2021 at 1:06 PM, Antonio said:

    Very useful, thank you so much for sharing @Hayri ASLAN!!!

    The filter is perfect but I have a problem with selection.

    1.      When I select the first record of the unfiltered grid, I correctly get the ID associated with the first record.

    1.png.71ee555b40a132ae53eb907663e9d79c.png

    2.      Then I filter the ID column by excluding the first record (ID filter:  > 1)

    2.png.228278d05d6fcb193e63e9b41a9b82bf.png

    3.      The problem is that by selecting again the first row of the filtered grid I get the previous value (ID = 1) instead of the correct one (ID = 2).

    3.png.1527171fd24877c840d80d36552105a1.png

    However, if I select the second row and  then again the first, the result is ok.

    I tried very hard to fix this behavior but I couldn’t find even a dirty workaround.

    In attachment the project I used to replicate this problem.

    I am using Delphi 10.2 and UniGui version 1.90.0 build 1545.

     

    Please, any help will be appreciated!!!

    Thank you!

    UniGuiFilterDBGrid_selection_bug_demo.zipUnavailable

    UniGuiFilterDBGrid_selection_bug_demo.zip 60.92 kB · 15 downloads

    It would be really cool if this filter options came native to the grid

×
×
  • Create New...