New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom widgets in matrixdynamic #384
Comments
@Kuhax Do you want to replace a checkbox by select2tag widget? Thank you, |
@andrewtelnov I was thinking about overriding any of the default choices available for matrixdynamic: ["dropdown", "checkbox", "radiogroup", "text", "comment"]. I thought that implementation-wise dropdown was the simpliest to be overriden by select2tag (since the latter extends dropdown). However, in the end my goal is to be able to add a select2tag column to matrixdynamic. If you can provide an option to replace a checkbox by select2tag that would be fantastic. |
@Kuhax I think we have to make a demo. Probably, I am not sure, we will have to modify the library to be able to do it. Thank you, |
@andrewtelnov a demo sounds good. As of today I don't have an urgent deadline, I'm on "when it's done" mode. Certainly it would be nice to have this feature implemented. |
@andrewtelnov Is it also possible to add a demo on using the jqueryUI datepicker in matrixdynamic? I can't seem to get this to work as well. |
@nategasm Yes, we will make it work as well. Thank you, |
I've noticed this enhancement was added in the new version but the datepicker still isn't working as intended. What happens is when you add additional rows and change the date, it will only change the date of the first row. A similar (but maybe separate) issue also happens when you have more than one datepicker field in the survey, in this case it will only update the first datepicker field even if you change the 2nd. In general the datepicker widget I find is very buggy and fiddly to use with surveyjs especially when you have a lot of them in a survey. It would be great if there were a built in/native datepicker question type. |
@nategasm I've just tested jQueryUI DatePicker in the |
@tsv2013 DatePickers as shown in the plunk look good to me. However, I was unable to make select2tagbox work in matrixdynamic. |
@Kuhax ok, I'll add select2tagbox in the sample plunk. |
@Kuhax I've updated the http://plnkr.co/edit/KDQZBx3zvJTtprzpQvd4?p=preview plunk with select2. Can you check it? |
@tsv2013 I've had a look at your plunk and it works great thank you. |
@nategasm This code:
adds properties for ordinary questions only and doesn't affect inner matrix questions. We need to discuss it with @andrewtelnov. |
@tsv2013 I have checked the plunk and it works flawlessly. Thanks |
@nategasm I've updated your fiddle to make it work - https://jsfiddle.net/mo2pg19h/3/ I've added declaration for a new property for matrix column:
And added
Does it fit your needs? |
@nategasm If you are using your own editor. You may add the dateFormat property into Editor as: PS: We are using dev version. I have added onMatrixCellCreated event just yesterday. We will release a new version in few days. Thank you, |
@tsv2013 Thanks, that seems to work, but I have updated the fiddle again with another issue where the values aren't saved when you switch between pages: https://jsfiddle.net/mo2pg19h/4/ |
@nategasm Thank you for the fiddle. I'll take a look. |
@nategasm I guess the thing was in the following code:
It is executed for the question with 'textDate' name only and hence only for one quetion in the survey. And thst's why initial values were not being set on the second page. I've commented the code above and added the following line: |
@tsv2013 That seems to almost work, but there are still some really weird issues in that fiddle. Another example: |
I've changed value change subscription to the native jQuery DatePicker event (http://api.jqueryui.com/datepicker/#option-onSelect):
After these changes the updated fiddle https://jsfiddle.net/mpy52s1u/3/ works ok for me :) |
@tsv2013 Everything finally works fine now. Thanks so much! Would probably help others if you updated the surveyjs.org datepicker example to use the same properties. |
I've update examples on the surveyjs.org. |
@tsv2013 I have a small issue with a rendering condition of select2tagbox. In your plunk the condition is I would prefer it to be like |
@Kuhax This had been discussed in this comment above #384 (comment) "renderAs" custom property is not set for cell questions. You can do it on the onMatrixCellCreated event handler to pass property value from column options to the created cell:
The column property should be declared as
And for the certain cloumn you can set the "renderAs" ptoperty to the "select2tagbox". |
@Kuhax Sure. It's very strange - in this case onMatrixCellCreated event fires too late - after cell controls have been created. I need to check our sources. |
@Kuhax we've discussed this with @andrewtelnov and decided to pass properties from column description to the cell quesion. I'll implement it ASAP. |
@tsv2013 thank you very much. I'm really looking forward to this. |
@Kuhax I've added necessary code in our core library and updated dev version on our cdn - you can check the plunk: http://plnkr.co/edit/HZgXdp?p=preview |
@tsv2013 thanks. I have checked it out and it works as expected now. However I've found another issue with rendering previously saved results. Please take a look at this plunk Notice that on line 100 I am trying to load a previously saved survey. In the first question there are 3 answers ("English: British and World Literature","Math: Practical Math","someOtherValue"). Notice that "someOtherValue" was introduced manually and was saved correctly. However it won't appear on the survey afterwards. It seems that custom values (which are not in the list) are not rendered by default. |
@tsv2013 after some tinkering I think the issue lays in line 69
Looks like Is there any other other way to assign all the values to Thanks |
Hi @Kuhax I've slightly modified the plunk, now it takes the "other values" in account in the choicesChangedCallback. Can you check it? |
@tsv2013 I have just modified select2 widget in my survey following your suggestions and it worked straight away. Custom values (or tags) are now saved and rendered correctly. Thanks for your help. |
@Kuhax Glad to hear it! |
@Kuhax I've fixed it in this plunk. You can check it.
Now choices is filtered not be text only, but by id also. |
@tsv2013 I have tried it and it works perfectly. Maybe it's a good idea to document this feature because it's pretty cool. Thanks ! |
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. |
@Kichi93, hello! I've created separate issue for this problem. #549 |
@andrewtelnov, @tsv2013 Do we need to add final plnkr into site's examples? |
Hi, i am able to add datepicker with custom widgets that use jquery but im not able to use icon trigger for datepicker. could you please help me out on the same. |
Hello @andrewtelnov , Does the date type input have a specific attribute to set that it's textbox show the current date as a default value instead of mm/dd/yyyy ? I tried couple of times setting it's value or placeholder to NOW with jquery but none of them worked, Please Advice. Thanks |
@SaharDastitash Here is the code:
Please create a seperate issue. Thank you, |
@andrewtelnov This is actually what I meant? Please find the new Issue in below link: |
Hello, my intention is to embed select2tagbox in matrixdynamic. Is there any generic way to do so?
Using JQuery I'm trying to override the 'cellType' property of matrixdropdownbase class
JsonObject.metaData.addClass("matrixdropdownbase", [ ..... { name: "cellType", default: "dropdown", choices: ["dropdown", "checkbox", "radiogroup", "text", "comment"] } ..... ],
with select2tagbox property (as mentioned in the select2tagbox example) but I'm not sure if it'll work.
Is this feasible ?
The text was updated successfully, but these errors were encountered: