Keep all row checkboxes & header row checkbox selected or checked by default in Angular-Slickgrid - angular-grid

I am using Angular SLickgrid and want to show all the checkboxes for all rows & also header row checkbox as selected by default (when grid loads). I am able to achieve it partly by using this.angularGrid.gridService.setSelectedRows(this.allDataId)
but I am getting errors in console and all data rows are not visible. I cannot use preset because I want to show all rows selected & till the time angular grid is loaded, I don't have all row IDs. Below is the error that I am getting. I have added null checks before passing data to setSelectedRows() but no use.
TypeError: Cannot read property 'children' of null
at ensureCellNodesInRowsCache (dist/data.bundle.js.gz:2692)
at getCellNode (dist/data.bundle.js.gz:2692)
at updateCellCssStylesOnRenderedRows (dist/data.bundle.js.gz:2692)
at setCellCssStyles (/dist/data.bundle.js.gz:2692)
at Event.handleSelectedRangesChanged (/dist/data.bundle.js.gz:2692)
at Event.notify (/dist/data.bundle.js.gz:2674)
at RowSelectionModel.p [as setSelectedRanges] (/dist/data.bundle.js.gz:2692)
at SlickGrid.setSelectedRows (/dist/data.bundle.js.gz:2692)
at SlickGrid.m (/dist/data.bundle.js.gz:2692)
at Event.notify (/dist/data.bundle.js.gz:2674)
Please suggest how to achieve it. Thanks.

The answer, if that is an acceptable one, is in your question. The SlickGrid Row Selection plugin is not meant to be all selected at first so you have to stick with using setSelectedRows and if you don't have all Ids at hand then call it when you do... and in case you're pushing data in chunk, then call setSelectedRows on each chunk. There's no magic here, you need to call it when you have the correct Ids

Related

selecting option for mat-select dropdown and retrieving selected option using cypress

I have a mat-select dropdown with more than 20 values. I have to select a value from the available list. The first 5 values are visible when the dropdown is clicked. After that, the values in the dropdown are not visible and unable to click.
cy.get('app-screen').find('#paper-code').click());
cy.contains('mat-option', 'AL019').should('be.visible').click();
Since the above code failed, updated the code as below.
cy.contains('mat-option', 'AL019').click();
This worked. But, will it get failed anytime later?
Another question, is how to get the selected option for mat-select?
It could fail later but it won't if you set the force option to true and avoid having to wait for an actionable state.
cy.contains('mat-option', 'AL019').click({ force:true });
If it does fail in the future, you want to know about it because there's a regression in the app.
Don't {force:true} unless you really really need to, because it will stop your test catching such regressions.
To test the value is selected may be as simple as
cy.get('app-screen').find('#paper-code').should('contain', 'AL019)

Loading select options after setting value

My program flow requires that I first set the value of a select option in the Viewmodel and then I load the available options into the Viewmodel. This causes problems, typically the first available option will be seen in the selection list after this, while the selected option value stays at the specified value.
I was hoping that setting the new "valueAllowUnset" would help, but instead my page becomes unresponsive when using it.
Therefore I currently set the original value again after loading the options. Strangely, this only works when I set the value, set a different value and then set the value again, e.g.
self.data()[field](orgValue);
self.data()[field]({});
self.data()[field](orgValue);
(I store values for multiple selection lists in the self.data observable and access them with the property index "field".)
I tried to strip this down to a simple JSFiddle (http://jsfiddle.net/timvdh/HN6DE/), but the behavior does not show there, although the example pretty much resembles my actual application. However, I am using about 30 select lists there.
So I was hoping, that someone can make an educated guess about what goes wrong in my application, I am hoping that the fact that I have to set the original value three times maybe gives a clue.
EDIT: This fiddle demonstrates, that setting the selected option before and after filling the options list does work with "valueAllowUnset": http://jsfiddle.net/timvdh/HT5Tp/
I am using JQuery Mobile with knockout.js and that caused the problem (sorry I did not even think about JQM being the problem in the first place). I am now setting the option before filling the list and after filling the list I call
$("#selectmenuID").selectmenu("refresh");
to display the option.
The hanging browser was not caused by knockout, there are additional subscriptions to the selectmenus in my app. "valueAllowUnset" changed the behavior of the selectmenus and triggered loops caused by problems in my code.

Why do issue view page requires an extra refresh to see the customfield value?

I am updating my custom field pro-grammatically if custom field is left blank. I found a question on stack related to this which helped in saving/updating custom field value correctly.I referred this stack question .
As I said I am updating custom field if it is left blank. So I have written some java code which checks if custom field is null if yes then I am generating some values using java code and updating and saving value in database. This all is working fine. I am doing this all when create issue.
But when issue page is rendered the respective custom field is not displayed,it need an extra page refresh for that. After page reload the custom field is rendered on page with correct value.
Any ideas? Why page reload is required ?
Can some point me to write direction ?
I am using JIRA 6.0.x
I am writing code in MyCustomField extends AbstractSingleFieldType class and using its getVelocityParameters method
Check your log files for errors seen the first time the screen is loaded? May also be errors shown in the JavaScript console? Otherwise strip everything back to be as simple as possible and then add complexity back in until it breaks in the same way.

SmartGWT: Checkbox Tree - the proper way to get selected checkbox value

SmartGWT has this property for a TreeGrid object:
employeeTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
This by default 'prepends' every nodes (including root) with checkbox.
(Just making myself clear.)
Also, I am aware of this similar solved question:
GWT tree with checkbox:How to get all checked tree items?
However, I do not seek this kind of solution..
What I'm looking for is a more efficient way, where I don't have to loop through 1000 items.
Is there any way to do this, if possible, using the widget I am using now?
If not, is there any other way, using other widget?
Thank you very much!
I think as you use SelectionAppearance.CHECKBOX you tell to the grid that the selected records are marked by the checkbox field value. So every time you check one you select a record.
You can get the set of selected records by either getSelection() method or getSelectedRecords(boolean) because of deprecation of the previuous one.
You can have a look at the code of this example of the smartgwt showcase.

smartgwt filter editor problem

i am using Listgrid of smartgwt api. i have set filter editor on the list grid using setShowFilterEditor(). On UI, i can filter out the text from the particular columns using filter editor which is shown on top of listgrid. till this, everything works fine. but problem starts after this. my ListGridRecords are of type ScreenInstanceGridRecord.
I cleared out the filter criteria before getting the ListGridRecord from the ListGrid using method clearCriteria(), so that i can save all the records to database ie. unfiltered records. when i try to get records from the listgrid using getRecordList(), 1000 Dummy records are added on the fly on first iteration, all my populated records are ignored . and i need here is records of ScreenInstanceGridRecord type. but on second iteration, i am getting my populated records which is of ScreenInstanceGridRecord type. why this problem is occurring. i should be getting ScreenInstanceGridRecord on the first iteration itself when i try to get records from the ListGrid using getRecordList(). i am getting no idea about this weird thing. any help from your side is most welcome.. plss
When you say you're getting 1000 Dummy records instead of your loaded records, in fact, your Records are not loaded yet at all. In this case, the ResultSet created by the ListGrid (see docs for ListGrid.fetchData()) is returning a provisional length (defaults to 1000) and returning the loading marker in lieu of Records (see ResultSet.rowIsLoaded()).
Use the DataArrived event to take action once data has been loaded. See ResultSet.lengthIsKnown() for how you can, in general, tell that data is not yet loaded.

Resources