1. #1
    Ext JS Premium Member MacJK's Avatar
    Join Date
    Aug 2008
    Location
    Germany, Delingsdorf
    Posts
    20
    Vote Rating
    0
    MacJK is on a distinguished road

      0  

    Default if = missing : after property id

    if = missing : after property id


    Hello, i understand this measage, but how i can make a IF in the params: property?

    Code:
     function saveRecord(oGrid_event){
      Ext.Ajax.request({   
      waitMsg: 'Please wait...',
      url: 'database.asp',
      params: {
       if (oGrid_event.record.data.task == "create")
       {task: 'create';},
       else
      {task: 'update';},
       ObjectOrder: oGrid_event.record.data.ObjectOrder,
       ObjectTypeID: oGrid_event.record.data.ObjectTypeID,
       Name: oGrid_event.record.data.Name
      },
      success: function(response){
      var result=eval(response.responseText);
      switch(result){
       case 1:
        store.commitChanges();
        store.reload();
       break;     
       default:
        Ext.MessageBox.alert('Uh uh...','We couldn\'t save him...');
       break;}
       },
        failure: function(response){
        var result=response.responseText;
        Ext.MessageBox.alert('error','could not connect to the database. retry later');}
      });
     };
    i get alwas a erro like this:

    missing : after property id

    function(){\n

    Many thanks for all help!

    best regards
    Jaroslaw

  2. #2
    Ext User
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
    fanzhongkai is on a distinguished road

      0  

    Default


    if (oGrid_event.record.data.task == "create")
    {task: 'create';},
    else
    {task: 'update';},
    try this:
    task: oGrid_event.record.data.task == "create"?"create":"update",
    ....
    You can not add if ... else ... as the params' property!

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    This is not an Ext issue - it's JavaScript. You can't use an if inside an object declaration. You could do
    Code:
    params :{
     task: oGrid_event.record.data.task == "create" ? "create" : "update"}
    }

  4. #4
    Ext JS Premium Member MacJK's Avatar
    Join Date
    Aug 2008
    Location
    Germany, Delingsdorf
    Posts
    20
    Vote Rating
    0
    MacJK is on a distinguished road

      0  

    Default


    Hello fanzhongkai and tryanDLS,

    many thanks for fast reply both. I understand that this is no a ExtJS issue. This help me to use this powerfull and great Extension. I still testing but very impressiv. Many thanks again!

    My code now:

    Code:
      params: {
       task: oGrid_event.record.data.task == "create" ? "create" : "update",
       ObjectOrder: oGrid_event.record.data.ObjectOrder,
       ObjectTypeID: oGrid_event.record.data.ObjectTypeID,
       Name: oGrid_event.record.data.Name
      },
    br
    Jaroslaw Kucharski

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi