I am using ag-grid Master-Details Options for binding data to the grid. But in this case, I am unable to change the detail row data until I am not opening its parent/master node. For that reason, I have to open it and close it explicitly using setExpanded(). But using this approach, it is consuming so much CPU memory and power so it is not a good approach. I have tried many things but unable to update with optimization.I am updating with SetValue(key, value) method. Is anyone know any alternative approach ??
Note: I am using setExpanded() because i am unable to get child row node object until its parent is not expanded. Is anyone know how to get child/details row node object with using setExpand() ??
Related
I'm currently struggling with setting the page of a data table externally before the table data is loaded. In my application the data table page either comes from the URL or the local storage. In theory as soon as the component is created I know on which page of the table the user should end up on.
But setting the page immediately will be of no use because after the data of the table is loaded the table page is set back to 1 again. But since I usually use a computed property for keeping the table data I simply wait for changes on this and update the table page afterwards. Unfortunately this doesn't work if there is a lot of data or the data structure is more complicated the rendering takes a bit longer so my update is coming in too early.
I couldn't find any hints in the docs that this is not supported and created a github issue since it seems like a bug to me, at least judging by some contradictory data in the dev tools.
I also tried to recreate the scenario in a codepen, obviously in this case one could just wait until "loadData" is done but as I said for my application the slight delay between getting the data and it showing up in the table seems to be the issue but leads to the same result in the end.
I tried the same with the options property but couldn't see any notable difference:
:options.sync="myOptions"
Do you guys have any recommendations on how to handle this? Either any way of keeping the page after the data changes or any reliable way to update the page after the table is populated and rendered? I feel like I tried most events of the table but had no luck yet.
Thanks in advance! :)
This really seems to be a bug in vuetify. When the items are updated the page gets reset to 1 but only inside the component. The page prop never reflects that change.
A workaround would be to trigger a change of the page variable on our side. So in your example I put the following at the end of the loadData method.
const p = this.page
this.page = 1
this.$nextTick(() => {
this.page = p
})
This puts the page prop back in sync with the component and it seems like the correct page is loaded immediately, at least inside the codepen.
I am getting data from a database using Ajax and I display them in an HTML table using VueJS. I let the user perform some actions on the data (Add a new row, edit, delete). It works just fine.
My problem is that I'd like to put a DataTable to allow the user to perform researches and to sort the rows in the table. I'm simply doing : $('my-table').DataTable(); on the HTML table already displayed by Vue. It works until I want to make a change in my data. They're changed in the Vue instance but not rendered in the DataTable.
For now I tried to use the destroy() method on my DataTable then to remake and instance and I have a strange result, here's my code when I want to update my DataTable:
$('my-table').DataTable().destroy();
// Here I'm getting the data and put it in the Vue instance
// Once it's done I simply re-mount the DataTable :
$('my-table').DataTable();
And it doesn't update, it double a line already existing or display the line I inserted until I change the current page.
What's even more weird is that if I do :
$('my-table').DataTable().destroy();
// Here I'm getting the data and put it in the Vue instance
So now it's a simple HTML table on my page, correctly updated with Vue, I type in the console :
$('my-table').DataTable()
And it works just fine. I don't understand because it's exactly the same as above except that i'm typing it from the console right ?
I hope that it's clear enough. Thanks already!
Vue might be competing for DOM elements here with DataTable.
If you use $('my-table').DataTable() it references the table by the DOM position.
When working with Vue, it's better to use $ref to reference an element.
Vue does some magic in the background that allows only object that changed to re-render. So it seems like when you're destroying and creating a new object, Vue doesn't have a way to know that it changed, and doesn't re-render it.
there's a few ways you might for you.
use a key for the DataTable element. When there's a change update the key, which will redraw the element
you can try this.$forceUpdate(); at the end of the function
you can also try this.$nextTick().then(()=>$('my-table').DataTable())
I am facing an issue. I have a collection of object with size around 22K records. I need to bind this to an select element. Binding is working fine for small collection but such a big collection is freezing UI until its bind completely.
Please suggest the best I can do here....
First thing that pops to mind is using one-way data binding. That is accomplished by appending :: in front of your HTML variables like so
{{::someVar}}
This way, angular will not include someVar in its watchers.
If that is still not enough for you then you might consider writing a special type of select for your own purposes which can use something like ClusterizeJS behind it.
ClusterizeJS allows only rendering a few elements on the screen and re-rendering on scroll such that the user will never know that not all the elements already exist in the select. Couple this with a search bar and you've got yourself a very fast select.
In general it is not wise to populate a <select> element with such a huge number of records. That applies no matter which framework you are using (although it would be especially bad with Angular and two way data binding).
Where you want the user to be able to select from a large number of options, I would recommend using an 'autocomplete' style of interface, where the user types a few characters and the client fetches options that match what they have typed so far.
For example, you could use Angular-UI select
I'm trying to get dropdownchecklist jquery plugin working with ko. I've wired up custom binding handler but dropdown won't populate with options. Please check my fiddle: http://jsfiddle.net/amitava82/wMH8J/11/
Appreciate your help. Thanks!
This is because you create dropdown before binding KnockoutJS. How does this dropdown work? It creates additional divs and spans which copy the content of select and create nice looking list. After that bindings are applied and they modify the select (as they should), but dropdown is not updated, because this library is kind of static, i.e. it copies the content of select only at the time of calling.
I've updated your jsFiddle so you can see temporary fix. What I mean is that it works now, the binding is applied before creating dropdown. The only problem is that changing options field in viewModel won't affect the dropdown. What you probably need to do is to use subscribe method. You have to monitor changes to options field and if they occur you have to recreate the dropdown. That's an easy way at least.
#freakish answer will work for most static content, but for anything dynamic using templates, for example if or foreach bindings, or you need to support underlying data updates, such as more checkbox options "suddenly" becoming available, it will not work.
An example of a really simple $.button binding apply which can be used to wrap the more simple jQuery calls. It's a simple matter of adding more members to controls to make them available in bindings.
The case with jQuery Dropdown Check List is a bit tricky however, since you obviously want to use the built in options handler, but you need to run $.dropdownchecklist after the options handler has run, as it creates the DOM elements that jQuery depends on. By wrapping the built in options handler, we are always called in the correct context.
In my experience of usage (our project makes use of about 10-15 custom bindings), you'll average about 10-20 lines of actual JS. If you start ballooning into +100 lines, I find it's a good idea to refactor, and rethink. I hope this helps some :-) I've been using Knockout for a few months now at a major UI implementation project at work, I've really learned alot, and I'm amazed at this stuff.
I need binding the model properties to view elements directly bidirectional way automatically stay sync. If I make a change in a textbox I need run bussiness logic in the related model, and model properties changes automatically refresh the related ui elements.
Im new in Extjs, but I guess it doesnt support it, JQXB seem to be the right way, does anyone could point me a sample using JQXB with Extjs?
With jQXB it's very simple to stay in sync.
jQXB is striclty related to jQuery so I assume your needs can be satisfied only with jQXB and jQuery.(Extjs is no more required);
In your case you need only to use jQuery to catch textbox changes and then, supposing your datamodel already binded to controls via jQXB datasource, invoke doBind method to refresh controls after changing data model.
At http://www.jqxb.altervista.org you can see in demos pages that already do something like that.
At http://jqxb.codeplex.com ( Download Section) you can examples and in Documentation Section you can find other examples.
Alternatively you can post an example of what you want to obtain or write directly a post or an email on jQXB site.
regards