Client & Server


#1

Hi all,

I have a little problem:

I had created a lib folder and init.js file inside it,
like this:

 createDialog = function(result){
      $("#log_dialog").dialog({
        modal: true,
        height: 320,
        width: 790,
        title: "Riepilogo File Generati",
        hide: "scale",
        show: {
           effect: "scale",
           duration: 1000
        },
    
        open: function(event, ui) {
          replaceCellContent();
        },
    
        buttons: [
          {
              text: "Dettagli",
              "class": 'leftButton',
              click: function() {
                  alert('Controllare Il File di Log Per Maggiori Informazioni');
              }
          },
          {
              text: "Chiudi",
              "class": 'rightButton',
              click: function() {
                $("#log_dialog").dialog('close');
              }
          }
        ]
    
      }).prev(".ui-dialog-titlebar").css("background","#5F5F5F");
    }

    generateLog = function(value){
       var stream = fs.createWriteStream(basepath+'test_file_log.txt');
       stream.once('open', function(fd){
       stream.write(value);
       stream.end();
      });
     checkCorrectValue();
   }


replaceCellContent = function () {
  var j=0;
  var find;
  var campo;

  //FILE AGENCY
  for(var i=0; i<resultAgency.length;i++){
    j=i+1;

    if(j==1)
      campo = 'Ageny_id';
    if(j==2)
      campo = 'Ageny_name';
    if(j==3)     createDialog = function(result){
      $("#log_dialog").dialog({
        modal: true,
        height: 320,
        width: 790,
        title: "Riepilogo File Generati",
        hide: "scale",
        show: {
           effect: "scale",
           duration: 1000
        },
    
        open: function(event, ui) {
          replaceCellContent();
        },
    
        buttons: [
          {
              text: "Dettagli",
              "class": 'leftButton',
              click: function() {
                  alert('Controllare Il File di Log Per Maggiori Informazioni');
              }
          },
          {
              text: "Chiudi",
              "class": 'rightButton',
              click: function() {
                $("#log_dialog").dialog('close');
              }
          }
        ]
    
      }).prev(".ui-dialog-titlebar").css("background","#5F5F5F");
    }

A method inside Meteor.Methods calls “generateLog()”.

The problem is that createDialog() (when open function was called) doesn’t see the resultAgency’s change.

Is there a way to make “absolute” (for client and server) a change?

Thanks a lot.

Francesco