Author Topic: How can I affect other column ?  (Read 1936 times)

SHIN WOOCHUL

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 13
    • View Profile
How can I affect other column ?
« on: September 18, 2019, 02:39:29 pm »
If I edit some value and then I change other column value (check box make to checked)
Is that possible to control other column value?
Code: [Select]
      {
                  title: "",                     
                          dataIndx: "check",
                          type: 'checkbox',
                          cbId: 'chk',
                          align : 'center',
                },
                {
                        dataIndx: 'chk',
                        dataType: 'bool',
                        cb: { header: true },
                        hidden: true,
                        editable: function(ui){
                        //Number(list[i].orderQnty) <=(Number(list[i].inQnty)+Number(list[i].deliveryAllQnty))
                        var orderQnty = ui.rowData.orderQnty;
                        var inQnty =   ui.rowData.inQnty;
                        var deliveryAllQnty = ui.rowData.deliveryAllQnty;
                        var result = orderQnty - inQnty - deliveryAllQnty;
                            //to make checkboxes editable selectively.
                        if(result<=0){
                        return false;                       
                        }else{
                        return true;
                        }
                        }
                    },
                { title: "deliveryQnty",/* width : '15%',*/dataIndx: "deliveryQnty",type : 'integer' , 
            editor : {
            attr :'type : number',
            getData : function(ui){
            var value  = ui.$cell.find("input").val();
            if(isNaN(value)){   
                alert("<msg:message code="alert.onylNumber"/>");
                    return 0;
    }
   
                if (value <= 0) {
                alert("<msg:message code="alert.lagerQnty"/>");
                                                        //make check box false unchecked;
                    return 0;
                  }else{
                                                         //make check box true checked;
                  return value;
                  }
            }
            },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How can I affect other column ?
« Reply #1 on: September 18, 2019, 09:23:21 pm »
column dependencies can be declared with js formulas or Excel formulas

Example of js formulas:

https://paramquery.com/pro/demos/grid_formula

SHIN WOOCHUL

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: How can I affect other column ?
« Reply #2 on: September 19, 2019, 06:52:03 am »
I used   formulas , but it just return value text type and it add next to check box
I wonder is how can I select cell and input check box , also It change check value?
Please, I need help

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How can I affect other column ?
« Reply #3 on: September 19, 2019, 10:20:46 am »
Quote
I used   formulas , but it just return value text type

formulas can return any data type value i.e, strings, dates, numbers, boolean, etc.

Quote
and it add next to check box
I wonder is how can I select cell and input check box , also It change check value?

It's not clear what issue you are facing. Please share a jsfiddle so that I can look into it.

PS: Checkbox example is here: https://paramquery.com/pro/demos/checkbox
« Last Edit: September 19, 2019, 10:24:49 am by paramvir »