Creating a nested dropdown

509 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Aparna Gk

ungelesen,
17.11.2021, 05:47:1717.11.21
an Blockly
Hi Team,

Can any one please suggest how to create a nested dropdowns in blockly 
Example :
 NestedDropdown.JPG

Beka Westberg

ungelesen,
17.11.2021, 10:45:1217.11.21
an blo...@googlegroups.com
Hello

If you want to include nested dropdowns in the toolbox, I think this might be included by default? Otherwise you can define a custom toolbox item to handle it.

If you want to include nested dropdowns on a block,  you can define a custom field which supports that.

If you want your blocks to generate code which defines a nested dropdown, I can't really give a recommendation for that because it depends on the library you're using.

I hope that helps! If you have any further questions please reply!
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/1a278808-9c3c-4b94-8a32-1e6e2d93964dn%40googlegroups.com.

Aparna Gk

ungelesen,
26.11.2021, 05:51:4426.11.21
an Blockly
Hello, 

I followed the Creation of Custom fields approach as suggested and could successfully create a nested dropdown.
Thank you for the guidance Beka!

NestedDD.JPG

As the journey continues to next task,
I need to achieve below 
1)Change the shape of the block as seen in the below pic.
2)Get the bottom arrow next to the text in the field so that could be identified as a dropdown.

Shape.JPG
3)third one i have tried to explain in the below pic.
so once the selection is done from the dropdown , block change as seen in pic A, after clicking outside it changes as seen in pic B,
As a result i'm looking to achieve, where dropdown should be available on click of the field immediately for the second selection, after the first selection is done. 
selectedItem.JPG
Can anyone please suggest what would be the best possible approach to achieve above mentioned points.
Thanks in Advance!

Beka Westberg

ungelesen,
26.11.2021, 10:16:3326.11.21
an blo...@googlegroups.com
Hiya again! I'm glad you found something that works for your project :D With regard to your questions:

1) You should just need to do:
```
Blockly.Blocks['my_block'] = {
  init: function() {
    this.setNextStatement(true);
    this.setPreviousStatement(true);
    // other initialization, including fields...
  }
}
```

2) You can check out the dropdown field's initView method and copy that.

3) I'm not sure if I'm entirely grasping what you're looking for here :/ But I know the white background is caused by inheriting from FieldTextInput. Have you tried just inheriting from Field instead?

I hope that helps! If you have any further questions please reply!
--Beka

Aparna Gk

ungelesen,
29.11.2021, 12:44:4429.11.21
an Blockly
Hi,
The two problems are resolved , I'm attaching the video steps to explain the third problem better.
After performing the selection from the dropdown , the dropdown should be available.
but here after step 6 we need to click outside the block to get the dropdown options back which is visible in step 7.
Hope it is clear now.
Blockly1.JPG

so, I tried inheriting from Field. It is still the same.
recording.zip

Aparna Gk

ungelesen,
29.11.2021, 13:24:2029.11.21
an Blockly
Hi Beka, 
Also, I'm facing the below issue while integrating the above custom field to my application.

Error1.JPG


Any idea how could this be resolved? 

Beka Westberg

ungelesen,
29.11.2021, 14:22:4629.11.21
an blo...@googlegroups.com
Hello again,

I'm sorry, I wasn't able to view your recording :/ I managed to open the .mht in a web browser, but the screenshots weren't included in the .zip so I wasn't able to see them. 

As for the other error, you need to add a JavaScript block-code generator definition for the test_pitch_field block to remove it =)

Best wishes,
--bBka

Aparna Gk

ungelesen,
30.11.2021, 03:03:5630.11.21
an Blockly
Hi Beka,

I have uploaded the screenshots in word doc, hope it helps. 

Regarding the other error, I went through the link JavaScript block-code generator definition
I tried adding the Blockly.JavaScript to my application I get the below error, Any thoughts how could that be resolved?

Error2.JPG
BlocklyFieldSelection.docx

Beka Westberg

ungelesen,
30.11.2021, 14:50:2030.11.21
an blo...@googlegroups.com
Hello again,

Thank you so much for the pictures! I think those were really helpful. So it sounds like what you want to do is close the dropdown immediately after the user selects an option? If so you should be able to do call `Blockly.DropDownDiv.hideIfOwner(this, true);` when an item is selected to hide the dropdown.

And with regard to the error, statement blocks (ones with top and bottom connections) just need to return a string, not an array, so you should be able to change the last line in your generator to:
```
return code;
```

I hope that helps! If you have any further questions please reply!
--Beka

Aparna Gk

ungelesen,
07.12.2021, 03:53:1807.12.21
an Blockly
Hi Beka,

That worked, Thanks!

I'm looking to implement the third party library inside blockly, https://dojo.telerik.com/
Similar to the below one 
Capture1.JPG

Please suggest how could this be achieved. 

Beka Westberg

ungelesen,
07.12.2021, 10:19:2907.12.21
an blo...@googlegroups.com
Ah man I wish I could help :/ but I'm not familiar with this library so I can't give any specific recommendations. However, if you start implementing it and run into problems I (and other people here!) are more than happy to give advice where we can =)

Best wishes, and best of luck with your project!
--Beka

Die Nachricht wurde gelöscht
Die Nachricht wurde gelöscht
Die Nachricht wurde gelöscht
Die Nachricht wurde gelöscht
Die Nachricht wurde gelöscht
Die Nachricht wurde gelöscht

Aparna Gk

ungelesen,
23.12.2021, 12:29:0023.12.21
an Blockly
Hi Beka,

Hello Again!
I finally managed to integrate kendo tree view to blockly, i have attached the source code(hope that helps to understand the problem).
i'm stuck at reading the selected checkbox values into field(that is in place of Section000).

Capturenested.JPG
Looking for any suggestions how could this be achieved. 

Thanks in Advance!


'use strict';

goog.provide('CustomFields.NestedDropDown');

goog.require('Blockly.Field');
var kendostyleSheet = document.createElement('link');
kendostyleSheet.rel='stylesheet';
document.getElementsByTagName('head')[0].appendChild(kendostyleSheet);

var jqueryScript = document.createElement('script');
jqueryScript.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(jqueryScript);

var KendoScript = document.createElement('script');
KendoScript.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(KendoScript);


var jqueryScriptnotused = document.createElement('script');
jqueryScriptnotused.src = 'https://code.jquery.com/jquery-3.1.1.min.js';
jqueryScriptnotused.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(jqueryScriptnotused);

var CustomFields = CustomFields || {};

CustomFields.NestedDropDown = function(opt_listinfo) {
  var value = {};
var inputjson=["Root",{"text":"Root","items":[{"text":"Section000","items":[{"text":"ID","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Section000","id":"ID"},{"text":"PID","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Section000","id":"PID"},{"text":"ParentID","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Section000","id":"ParentID"},{"text":"AUR_ModifiedBy","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Section000","id":"AUR_ModifiedBy"},{"text":"AUR_ModifiedOn","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Section000","id":"AUR_ModifiedOn"}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section000","ParentId":"Root","id":"Section000","expanded":true},{"text":"CodeControl000","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"CodeControl000","ParentId":"Root","id":"CodeControl000"},{"text":"Section001","items":[{"text":"Section002","items":[{"text":"Tabs000","items":[{"text":"Tab001","items":[{"text":"Section003","items":[{"text":"TextBox004","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Section003","id":"TextBox004"},{"text":"TextBox000","items":[],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Section003","id":"TextBox000"}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Tab001","id":"Section003","expanded":true}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Tabs000","id":"Tab001","expanded":true}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Section002","id":"Tabs000","expanded":true}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Section001","id":"Section002","expanded":true}],"IsDBContainer":false,"IsFormControl":true,"SeniorParentElement":"Section001","ParentId":"Root","id":"Section001","expanded":true}],"IsDBContainer":false,"IsFormControl":false,"SeniorParentElement":null,"id":"Root","expanded":true}];
  value.dropdownlist = inputjson[1].items || CustomFields.NestedDropdown.ListInfo;
  CustomFields.NestedDropDown.superClass_.constructor.call(this, value);
  this.setSpellcheck(false);
  this.editorListeners_ = [];
};
Blockly.utils.object.inherits(CustomFields.NestedDropDown, Blockly.FieldTextInput);

CustomFields.NestedDropDown.fromJson = function(options) {
  return new CustomFields.NestedDropDown(options['dropdownlist']);
};

CustomFields.NestedDropDown.ListInfo = [];

CustomFields.NestedDropDown.prototype.showEditor_ = function() {
  CustomFields.NestedDropDown.superClass_.showEditor_.call(this);

  var editor = this.dropdownCreate_();

  Blockly.DropDownDiv.getContentDiv().appendChild(editor);

 var myDataSource = new kendo.data.HierarchicalDataSource({
  data:CustomFields.NestedDropDown.ListInfo
 });

 $("#multiselect").kendoMultiSelect({
  dataTextField: "text",
  dataValueField: "id"
});

$("#treeview").kendoTreeView({
  loadOnDemand: false,
  checkboxes: {
      checkChildren: true
  },
  dataSource: myDataSource,
  check: onCheck,
  expand: onExpand,
  //change: onselect,
});

function getCheckedNodes(nodes, checkedNodes) {
  var node;

  for (var i = 0; i < nodes.length; i++) {
      node = nodes[i];

      if (node.checked) {
          checkedNodes.push({ text: node.text, id: node.id ,IsDBContainer:node.IsDBContainer,IsFormControl:node.IsFormControl});
      }

      if (node.hasChildren) {
          getCheckedNodes(node.children.view(), checkedNodes);
      }
  }
}

function onCheck(e) {
  console.log('Onclick of check box');
  var checkedNodes = [];
  var treeView = $("#treeview").data("kendoTreeView");

  getCheckedNodes(treeView.dataSource.view(), checkedNodes);
  setMessage(checkedNodes.length);
  let tv = $("#treeview").data("kendoTreeView"), // Gets the 2dn treeview reference
  text = e.sender.dataItem(e.node).text; // Gets the 1st treeview selected text
 
 let currentlyselectedIsDBContainer= checkedNodes.length==0?false:(checkedNodes[0].IsDBContainer);
 let currentlyselectedIsFormControl= checkedNodes.length==0?false:(checkedNodes[0].IsFormControl);


// Iterates over the 2nd treeview items
tv.items().toArray().forEach(item => {
  let dataItem = tv.dataItem(item);
  let disabled=false; // Get the item related dataItem
  if(!currentlyselectedIsDBContainer && currentlyselectedIsFormControl)
  {
    if((dataItem.IsDBContainer && dataItem.IsFormControl)||(!dataItem.IsDBContainer && !dataItem.IsFormControl))
    {
      disabled=true;
    }    
  }else if((currentlyselectedIsDBContainer && currentlyselectedIsFormControl)||(!currentlyselectedIsDBContainer && !currentlyselectedIsFormControl)){
    if(!dataItem.IsDBContainer && dataItem.IsFormControl){
      disabled=true;
    }
  }    
  // Gets the current item's checkbox
  $(item).find('input[type="checkbox"]')
     // .prop('checked', false) // Uncheck it by default
      .prop('disabled', disabled); // Disable/enable based on above condition

  if(checkedNodes.length==0){
    $(item).find('input[type="checkbox"]').prop('checked', false).prop('disabled', false);
  }
});

}

function onExpand(e) {
  if ($("#filterText").val() == "") {
      $(e.node).find("li").show();
  }
}

function setMessage(checkedNodes) {
  var message;

  if (checkedNodes > 0) {
      message = checkedNodes + " categories selected";
  }
  else {
      message = "0 categories selected";
  }

  $("#result").html(message);
  var note = CustomFields.NestedDropDown.prototype.getSelectedCheckBoxValues();
  CustomFields.NestedDropDown.prototype.doClassValidation_(message);

}
$("#filterText").keyup(function (e) {
  var filterText = $(this).val();

  if (filterText !== "") {
      $(".selectAll").css("visibility", "hidden");

      $("#treeview .k-group .k-group .k-in").closest("li").hide();
      $("#treeview .k-group").closest("li").hide();
      $("#treeview .k-in:contains(" + filterText + ")").each(function () {
          $(this).parents("ul, li").each(function () {
              var treeView = $("#treeview").data("kendoTreeView");
              treeView.expand($(this).parents("li"));
              $(this).show();
          });
      });
      $("#treeview .k-group .k-in:contains(" + filterText + ")").each(function () {
          $(this).parents("ul, li").each(function () {
              $(this).show();
          });
      });
  }
  else {
      $("#treeview .k-group").find("li").show();
      var nodes = $("#treeview > .k-group > li");

      $.each(nodes, function (i, val) {
          if (nodes[i].getAttribute("data-expanded") == null) {
              $(nodes[i]).find("li").hide();
          }
      });

      $(".selectAll").css("visibility", "visible");
  }
});
function checkUncheckAllNodes(nodes, checked) {
  for (var i = 0; i < nodes.length; i++) {
      nodes[i].set("checked", checked);

      if (nodes[i].hasChildren) {
          checkUncheckAllNodes(nodes[i].children.view(), checked);
      }
  }
}

// function chbAllOnChange() {
//   var treeView = $("#treeview").data("kendoTreeView");
//   var isAllChecked = $('#chbAll').prop("checked");

//   checkUncheckAllNodes(treeView.dataSource.view(), isAllChecked)

//   if (isAllChecked) {
//       setMessage($('#treeview input[type="checkbox"]').length);
//   }
//   else {
//       setMessage(0);
//   }
// }

$("#chbAll").click(function(e){
  var treeView = $("#treeview").data("kendoTreeView");
  var isAllChecked = $('#chbAll').prop("checked");

  checkUncheckAllNodes(treeView.dataSource.view(), isAllChecked)

  if (isAllChecked) {
      setMessage($('#treeview input[type="checkbox"]').length);
  }
  else {
      setMessage(0);
  }  
});

  Blockly.DropDownDiv.setColour(this.sourceBlock_.style.colourPrimary,
      this.sourceBlock_.style.colourTertiary);

  Blockly.DropDownDiv.showPositionedByField(
      this, this.dropdownDispose_.bind(this));
     
};

CustomFields.NestedDropDown.prototype.dropdownCreate_ = function() {
 
  console.log($().jquery);
 // console.log($j().jquery);
var CreateDiv = function(id,classname){
 var divElement= document.createElement('div');
 if(id!='')
 divElement.id=id;
 if(classname!='')
 divElement.className=classname;
 return divElement;
 }

 var CreateInputTag=function (id,type,placeholder,classname) {
  var InputElement=document.createElement('input');
  if(id!='')
  InputElement.id=id;
  if(type!='')
  InputElement.type=type;
  if(placeholder!='')
  InputElement.placeholder=placeholder;
  if(classname!='')
  InputElement.className=classname;
 
  return InputElement;
 }

var CreateLabel=function (classname) {
  var LabelElement=document.createElement('label');
  if(classname!='')
  LabelElement.className=classname;
  LabelElement.textContent='Select All';

  return LabelElement;
}
var CreateSpanElement=function (id) {
  var SpanElement=document.createElement('span');
  SpanElement.id=id;
  SpanElement.textContent='0 categories selected';

  return SpanElement;
}

var CreateSelectElement= function (id) {
  var SelectElement=document.createElement('select');
  if(id!='')
  SelectElement.id=id;

  return SelectElement;
}

var examplediv=CreateDiv('example','');
var demosectiondiv=CreateDiv('','demo-section k-content');
var dialogdiv=CreateDiv('dialog','');
var dialogcontentdiv=CreateDiv('','dialogContent');
var filterTextinput=CreateInputTag('filterText','text','Search categories','','');
var selectalldiv=CreateDiv('','selectAll');
var checkboxinput=CreateInputTag('chbAll','checkbox','','k-checkbox');

var LabelTag=CreateLabel('k-checkbox-label');
var spanTag=CreateSpanElement('result');
var multiSelectTag=CreateSelectElement('multiselect');
var treeViewDiv=CreateDiv('treeview','');

selectalldiv.appendChild(checkboxinput);
selectalldiv.appendChild(LabelTag);
//selectalldiv.appendChild(spanTag);

dialogcontentdiv.appendChild(filterTextinput);
//dialogcontentdiv.appendChild(selectalldiv);
dialogcontentdiv.appendChild(CreateDiv()).appendChild(spanTag);

dialogcontentdiv.appendChild(treeViewDiv);

dialogdiv.appendChild(dialogcontentdiv);

demosectiondiv.appendChild(dialogdiv);
demosectiondiv.appendChild(multiSelectTag);

examplediv.appendChild(demosectiondiv);

//  var Kendojs=document.createElement('script');
//  Kendojs.src="C:/Tasks/Blockly/blockly-samples-master/blockly-samples-master/examples/pitch-field-demo - Copy - Library/KendoTreeView.js"
//  Kendojs.type = 'text/javascript';
//  document.getElementsByTagName('body')[0].appendChild(Kendojs);

 return examplediv;
};

CustomFields.NestedDropDown.prototype.initView = function() {
  if (this.shouldAddBorderRect_()) {
    this.createBorderRect_();
  } else {
    this.clickTarget_ = this.sourceBlock_.getSvgRoot();
  }
  this.createTextElement_();

  this.imageElement_ = Blockly.utils.dom.createSvgElement(
      Blockly.utils.Svg.IMAGE, {}, this.fieldGroup_);

  if (this.getConstants().FIELD_DROPDOWN_SVG_ARROW) {
    this.createSVGArrow_();
  } else {
    this.createTextArrow_();
  }

  if (this.borderRect_) {
    Blockly.utils.dom.addClass(this.borderRect_, 'blocklyDropdownRect');
  }
};
CustomFields.NestedDropDown.prototype.shouldAddBorderRect_ = function() {
  return !this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW ||
      (this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW &&
          !this.sourceBlock_.isShadow());
};
CustomFields.NestedDropDown.prototype.createTextArrow_ = function() {
  this.arrow_ = Blockly.utils.dom.createSvgElement(
      Blockly.utils.Svg.TSPAN, {}, this.textElement_);
  this.arrow_.appendChild(document.createTextNode(
      this.sourceBlock_.RTL ?
      Blockly.FieldDropdown.ARROW_CHAR + ' ' :
      ' ' + Blockly.FieldDropdown.ARROW_CHAR));
  if (this.sourceBlock_.RTL) {
    this.textElement_.insertBefore(this.arrow_, this.textContent_);
  } else {
    this.textElement_.appendChild(this.arrow_);
  }
};

CustomFields.NestedDropDown.prototype.dropdownDispose_ = function() {
  for (var i = this.editorListeners_.length, listener;
    listener = this.editorListeners_[i]; i--) {
  Blockly.unbindEvent_(listener);
  this.editorListeners_.pop();
}
};

CustomFields.NestedDropDown.prototype.hide_ = function(event) {
  Blockly.DropDownDiv.hideWithoutAnimation();
 this.setEditorValue_(event.currentTarget.outerText);
};

// CustomFields.NestedDropDown.prototype.valueToNote = function(value) {
//   var array= CustomFields.NestedDropDown.ListInfo;
//  for (let index = 0; index < array.length; index++) {
//     if(this.searchTree(array[index],value)){
//         return true;
//     }
//  }
// };


// CustomFields.NestedDropDown.prototype.noteToValue = function(text) {
//   var array= CustomFields.NestedDropDown.ListInfo;
//   for (let index = 0; index < array.length; index++) {
//      if(this.searchTree(array[index],text)){
//          return text;
//      }
//   }
// };
// CustomFields.NestedDropDown.prototype.searchTree=function (element, matchingTitle) {
//   if(element.id.toLowerCase() == matchingTitle.toLowerCase()){
//     return true;
// }else if (element.children != null){
//     var i;
//     var result = null;
//     for(i=0; result == null && i < element.children.length; i++){
//          result = this.searchTree(element.children[i], matchingTitle);
//     }
//     return result;
// }
// return false;
// }



CustomFields.NestedDropDown.prototype.getText_ = function() {
  if (this.isBeingEdited_) {
    return CustomFields.NestedDropDown.superClass_.getText_.call(this);
  }
  return  null;
};

CustomFields.NestedDropDown.prototype.getEditorText_ = function(value) {
 
  return value;
};

CustomFields.NestedDropDown.prototype.getValueFromEditorText_ = function(text) {
  return this.noteToValue(text);
};

CustomFields.NestedDropDown.prototype.render_ = function() {
  CustomFields.NestedDropDown.superClass_.render_.call(this);
};

CustomFields.NestedDropDown.prototype.doClassValidation_ = function(newValue) {
 
  if (newValue == undefined) {
    var note = this.getSelectedCheckBoxValues();
    if (note.length>0) {  
      return note;

    }else{
      return null;
    }
  }
  else if(newValue.dropdownlist!=undefined){  
  CustomFields.NestedDropDown.ListInfo= newValue.dropdownlist ;
  }else{
    return newValue
  }
  if (newValue.dropdownlist !=undefined) {
    return newValue.dropdownlist[0].id;
  }
  return null;
};


CustomFields.NestedDropDown.prototype.getSelectedCheckBoxValues=function () {
  var array = []

  var checkboxes = document.querySelectorAll('input[type=checkbox]:checked')

  for (var i = 0; i < checkboxes.length; i++) {
    let item={};
    item.children=[];
   if(checkboxes[i].parentElement.previousElementSibling==null){
    array.push(checkboxes[i].parentElement.nextElementSibling.textContent)
    }
  }


var responseArray=[];

let tv = $("#treeview").data("kendoTreeView")
tv.items().toArray().forEach(item => {
      let dataItem = tv.dataItem(item);
      if($(item).find('input[type="checkbox"]:checked').length==1){
          var item={};
          item.ParentId=dataItem.SeniorParentElement;
          item.Id=dataItem.text;
          if(item.Id!=item.ParentId){
              responseArray.push(item);
        }
      }
});


var format=[];
var item={};
item.children=[];

FormatInput(responseArray)

function FormatInput(jsoninputarray) {
  for (let index = 0; index < jsoninputarray.length; index++) {
      if(format.some(code => code.ParentId === jsoninputarray[index].ParentId)){
          item.children.push(jsoninputarray[index].Id);
      }else{
        if(array.includes(jsoninputarray[index].Id)){
          var item={};
          item.children=[];
          item.ParentId=jsoninputarray[index].ParentId;
          format.push(item);
        }
      }
  }
}
 console.log(JSON.stringify(format));

}

Blockly.fieldRegistry.register('nested_dropdown', CustomFields.NestedDropDown);





Beka Westberg

ungelesen,
23.12.2021, 14:13:1423.12.21
an blo...@googlegroups.com
Hello again =) I'm glad you got your tree view working in Blockly! That looks rad dude :D

Could you give a bit more detail about the issue you're having with reading the checkboxes? Are you able to read them when not integrated with Blockly? If not, I don't think I'm going to be much help since my knowledge is purely Blockly-related. If so, could you provide some more detail about where you are running into trouble?

Best wishes, and happy holidays!
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.

Aparna Gk

ungelesen,
24.12.2021, 01:08:5124.12.21
an Blockly

Hello Beka,
Let me try to give some background example,
So when i was going through field_pitch example the movement i change the position in the dropdown i could see the value is getting updated in field(A3)

Capture2401.JPG

For every cursor movement in dropdown, value is getting updated on field (A3)(the below code is invoked every time when there is change in cursor position)

CustomFields.FieldPitch.prototype.getEditorText_ = function(value) {
  return this.valueToNote(value);
}; Similar to the above implementation i want to update selected check box values to field(Replace Aur_modifiedBy and Aur_ModifiedOn in place of Section000) Capture2402.JPG

Hope it is clear.

fu6...@gmail.com

ungelesen,
24.12.2021, 06:22:1824.12.21
an Blockly
FieldCheckbox.mp4

Aparna Gk

ungelesen,
28.12.2021, 05:10:3528.12.21
an Blockly
Hello ,

Many Thanks!, it gave me a hint of how to resolve the issue.

So currently my custom block looks like this. 
Capture2812.JPG
I would like to update values inside my dropdown, that is every time when 
I click on the dropdown field if there is any change in input source the changes needs to be seen in the dropdown options(addition or removal of dropdown options dynamically )
Any idea how could this be achieved?  
Capture122801.JPG

Thanks in advance.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten