Survey-library: Matrix Dynamic and Custom Widgets - wrong row removing

Created on 10 Aug 2017  路  3Comments  路  Source: surveyjs/survey-library

issue from @Kichi93 https://github.com/surveyjs/surveyjs/issues/384

I've found an issue with my application where I'm trying to use a custom widget within a dynamic matrix. It seems to also exist in the plunk mentioned above (plunk) so thought you might be able to offer some advice.

If you have multiple rows in the dynamic matrix and then click the remove button on the first row the last row gets removed. Other rows will do the same, always removing the last row. Interestingly, the correct element in the dynamic matrix data array is removed i.e. the data is correct but the display is wrong.

I've seen this issue in IE and Firefox. Any help would be greatly appreciated.

bug fixed

Most helpful comment

steps to reproduce

  • go to (plunk)
  • remove first row
  • see that second row contains first row data now

All 3 comments

steps to reproduce

  • go to (plunk)
  • remove first row
  • see that second row contains first row data now

I'm facing the same issue while using select2 widget (https://www.surveyjs.io/Examples/Library/?id=custom-widget-select2) with matrix dynamic. Reproduced in Chrome as well.

Please note, that the correct row is being removed from the model, so at the end there is a difference between rendered and model state.

@nikitakarpenkov, so it is not a bug with library, but not complete custom widget realization. We need to tell to the widget about row removing. So we need add this code in afterRenderMethod:

question.survey.onMatrixRowRemoved.add(function(survey, options) {
    question.customWidgetData.isNeedRender = true; 
})

and I've update the exmple above and created new simple example:

updated example: http://plnkr.co/edit/7s73Ll?p=preview
simple example: http://plnkr.co/edit/JAxG4t?p=preview

PS: we are working on _custom widgets_ system and after the 1.0.0 release we could just import custom widget from a collection and just use it as regular question.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiuzhen1103 picture xiuzhen1103  路  4Comments

testweird123 picture testweird123  路  4Comments

aslanbeily picture aslanbeily  路  4Comments

AWIXOR picture AWIXOR  路  3Comments

misamura picture misamura  路  4Comments