DHTMLX : Refresh a grid with loadXMLString() - dhtmlx

I want to use the method loadXMLString() to refresh the content of my grid.
I founded this, but this is not working for me :
http://forum.dhtmlx.com/viewtopic.php?f=14&t=11382
So I tried this :
grid._refreshFromXML =[true,true,false];
grid.loadXMLString(".....");
Again, not working !
Any ideas ?
I suppose the problem is with the line "grid._refreshFromXML = ..."
Thanks a lot !
I'm working with DHTMLX 3.6.

Please try to use
grid._refresh_mode =[true,true,false];
There is no _refreshFromXML function in the grid.

Related

Umbraco - Current node image

I'm trying to get an image from the current node, in Umbraco. I know the way I'm using it is not the best, but I'm trying to understand something. Here is my code :
var image = Node.GetCurrent().GetProperty("image").Value.ToString();
var url = #Umbraco.Media(image).Url;
First, I'm getting the Image value : umb://media/b59274b4328f4f39866144bef8edef58
From this value, I'm trying to get the Url, but my var url is empty.
But, when I try :
#Umbraco.Media(Model.Content.GetPropertyValue("image").ToString()).Url
Everything is working.
I don't understand this.
Ok. I've not found the why.
I really want someone to answer me why this is not working.
I've found a workaround :
#CurrentPage.Image.Url
Thanks !

Datatable destroy function not working as expected

I'm trying to implement a web app, with a Basic and an Advanced Search, and I'm using datatable 1.10 and jquery 2.2 to display the results of the searches. I'm having issues with the destroy method and I hope that some of you it is going to be able to help me find a solution, thanks in advance to all for your help
Let me explain a little bit my project, code logic, objective and issue:
I have one single table with 5 columns as you can see on my jsfiddle. I also have a global variable "table" to handle the datatable (DT) once it is created. I declared a function "loadSearchData" to load the parameters for the Ajax call on another global variable. On the click event of my two Search buttons I check if the DT already exists then I destroy it, and then I call the function "initializeDataTable". My idea was to destroy the existing DT and create a new one each time the Search buttons are clicked. However it is not working, and the behavior is "weird":
First time I enter the search criteria and click search, works perfectly fine If I modifiy the search criteria and click search again, then I get a Webpage error
"Line: 1 Error: Unable to get property 'style' of undefined or null reference"
Then, if don't debug and click the search button again, then it works perfectly fine again!
The code:
//BASIC SEARCH
$('#btnBasicSearch').on('click', function () {
$("#partialSearch").removeAttr("hidden");
loadSearchData('basicSearch');
if ($.fn.DataTable.isDataTable('#tbDocumentsList')) {
table.destroy();
}
initializeDataTable(searchParameters);
});
//ADVANCED SEARCH
$("#btnSearch").on('click', function () {
$("#partialSearch").removeAttr("hidden");
loadSearchData('advancedSearch');
jQuery.ajaxSettings.traditional = true;
if ($.fn.DataTable.isDataTable('#tbDocumentsList')) {
table.destroy();
}
initializeDataTable(searchParameters);
});
I'm sure there is a better way to do this, this is my first time using datatables and probably I'm missing something, anyone have any idea?
You can see the complete jsfiddle here
https://jsfiddle.net/dalps/gxgLdo03/
I also asked on the datatable forum:
http://datatables.net/forums/discussion/33563/datatable-destroy-function-not-working-as-expected#latest
thanks in advance
dalps
Well, I got my answer on the datatable forum: my html table have 5 columns and on the "columndefs" property I have the following:
"targets": 5,
"data": "active",
"visible": false
since the column indexing begin with zero, I was referencing a column that doesn't exist, solution, add a new column to the table

kendo grid works fine when javaScript alert exist but not working without javaScript alert

When I add a new row kendo ui grid it does not move to next page even I set page number dynamically.
But when there is a javaScrip alert it's working fine.
Has any one faced this issue before. Please suggest me a solution.
Thank you.
The problem is that when you add a new row there are a series of actions that happen in parallel and they are not immediate. If you try to move to the end but the row still is being created, if fails.
When you add an alert, you delay the fact of moving and creation now have time.
If you really need to do it, you can add a timeout (delay) it is not nice/clean but should work.
Do something like:
setTimeout(function() {
grid.page(3);
}, 500);
for introducing half second (500 ms) delay, should be enough.
We had sort of similar issue in IE - onchange fired twice with alert in the event handler. According to what you saying, it sounds like when the alert is NOT in you are getting correct behaviour. Review your code without having the alert in or post a fiddle. Below is an answer from Kendo support in regards to alerts while debugging. Do not use alerts with kendo to stay safe.
Basically this behavior is caused by using "alert" method for debugging purposes - please note that this is not recommended because it can lead to unexpected behavior when interacting with focusing elements. After replacing the "alert" method and with "debbuger" command or "console.log()" function the change event is working as expected - please check this screencast(http://screencast.com/t/7qIAdK6hZ5kD).
Hope it helps.

What ComponentQuery should I use for this example in this.control()?

I have:
1.) What should I type in this.control() for getting the reference to the grid panel?
My plan is, when user double clicks one row, new tab is created. I already have code for creating new tabs but I just need to get reference to the grid panel.
Something like this:
'viewport > westpanel > accordion > gridpanel': {
doubleclick: function...
}
2.) Let's say that I gave an ID to the grid panel. How can I get reference in this.control using .get method?
3.) How can I be sure that I've got the right reference? Can I console.log() - it or something like that?
I would know how to do this without MVC but here I need help. :)
Thank you! :)
It is quite easy once you understand how to use it. First you should read the API about the ComponentQuery cause that is what is used within the control.
this depends on your components. You so can go by the xtype 'panel > grid': {itemdblclick:this.yourCallback}
the recommend way if you can't define a really unique path by xtypes '#myID': {itemdblclick:this.yourCallback} using defined refs within the control is not possible in the currently release, as far as I know.
Use Id's instead of just xtypes '#myID > grid': {itemdblclick:this.yourCallback} or define additional params '#myID > grid[customProp=identString]': {itemdblclick:this.yourCallback}

jqgrid date picker problem

For a couple of days now I have been playing around with the jqgrid.I have been trying to accomplish what is found on this example http://www.the-di-lab.com/demo/apples that is placing a date picker on the modal form.
So far I have tried to follow what I found on this link but I get a target.getAttribute is not a function error in my ui.datepicker.js script.
Anyone who has done it succesfully?
Don't know if you or someone else is still seeking for an answer.
I just realized this by using the editoptions in column definition, like so:
... ,editoptions:{dataInit:datepicker}
where datepicker is a function like
function datepicker (elem) {
jQuery(elem).datepicker(
// {} // options here
);
};

Resources