I'm trying to add columns to a ExtJS grid in initComponent() using this.columns.push().
This is working fine, but when I destroy the view and create it again the columns are duplicated. It seems ExtJS is keeping some state of the previous instance. I even tried to reset the columns array in destroy() but can't eliminate this strange behaviour.
See this Sencha Fiddle for the code.
Try this approach, it should work
var grid, columnsArr = [];
grid.reconfigure(undefined, columnsArr);
the first parameter is a store reference. pass a reference to new store if you wish to change the store as well
Related
I have two grids with the same columns. I want to add records from grid 1 to grid 2 and I want to allow duplicates in the second grid. I know stores have an id property to not allow duplicates. I override this using idProperty: 'customId' config in the model. I'm using an autoincremental customId field as the new idProperty. But this doesn't work: I click twice or more times at the select column but nothing happens (it only works the first one). How can I solve this?
I did a fiddle with the example.
when you are adding record to destination Grid's store, instead of adding record, use record.data property to pass pure data object, not a model object.
destinationGrid.getStore().add(record.data);
here is fiddle
I have a kendo grid "GridProjects" (See attachement: Part HTML). At the initialization, the column set (name, field, ...) and the sorted column list are retrieved from my BD on the gridHelperService.
To update the column set, I used the attribute "k-columns" on my HTML. However, I couldn't do the same thing for the sorted columns since the sort proprety is inside datasource.
I Know that I can use k-data-source, but in my case, it doesn't work because my dataSource transport and filter is binded with some variables on the controller.
Every thing is explained at this attachement: Projects Kendo Grid
I can't figure out how to fix this, if anyone can give me a hit, I'll appreciate.
Thanks!
I don't know much about your setup but based upon the image. Here is what you can try where you want the sort to happen. I don't know the columns your setup has but if you have firstName I would do sort like this.
$scope.GridProjects.dataSource.sort({field: "FirstName", dir: "asc"});
Inside the $scope you can get access to the kendo-grid="GridProjects" and then its dataSource and then sort it.
My problem was that my settings (columns) are loaded after my grid was created.
I changed my code to created the grid after my settings are loaded. To do, I called my function that creates the grid on my callback function (onSuccess).
Folks,
I am using ng-grid to display a list of items.
I want to give my users ability to rearrange the rows in the list.
i.e move the rows up and down as they please.
Now,
However when I update the grid data in the backend i.e say change the index of a particular row, that row does not automatically change locations in the front-end.
What am i missing here ?
I have created a plunker to describe the problem
http://plnkr.co/edit/s1hrTSqF2zeZo3Btaln0
The grid doesn't use the index of the array to order it, so even if you are changing it, because the data is still there nothing happens.
What you could do is define an order field and update the value then changing the values as shown in this plukr. The order field you can hide it from the grid if required using columnDefs to explicitly defined which column should be shown.
Regards
I have 2 stores and 1 gridpanel. One store is assigned to the grid, the other is loaded with records at the beginning of my application.
Now, my problem is that when I use a render function for a column in my gridpanel, I would like to access the records of the otrher store. However, the other store is not always ready and not always full of records at the rendering moment.
What are the possible solutions to this problem?
Thank you very much in advance,
David
Load this second store before rendering the grid. What's seems to be a problem?
Update: you need to make sure that store2 is loaded before store1. You can do this like this:
Don't bind store1 to your grid first in the view definition. Assign all columns and other stuff, but leave store being null
In the controller on afterrender event you assign handler to the store2 load event in which you call store1.load()
Do store2.load()
I understand one store is dependent of the other? if so load the second store on the selection of an item from the first. Or, you can just create a method to look in the data that you use to fill the store and find the thing you need.
I have two data grids. The first auto-loads a list of items (json data store). OnCellClick the first grid fires a dynamically parametrized url and loads data into the second grid. It works fine, but the pagination of the second grid does not focus the new context.
What shall I do to make the pagination work with the new url?
hm your pagination and second grid (which is the one to be dynamical) should share the same store, now on cell click you should only reconfigure the store and start loading it.
if you do like this both grid and pagination will work just fine...
i think currently your paginations uses another sotre (another instance or something) but it MUST use the same store as the second grid...
Not sure what you exactly mean with "does not focus the new context", but are you passing the start and limit parameters to the second grid in the params array of the jsonStore.load call?
If you just want to focus the grid on certain row, you can use focusRow method of GridView.
Perhaps you could post a code example if this did not help?