Forum Replies Created

Viewing 15 posts - 1 through 15 (of 50 total)
  • Author
    Posts

  • Benji6996
    Participant

    I have now updated to the latest version and I can confirm this issue (date filter) still remains in virtual mode

    B


    Benji6996
    Participant

    I would love to update to the latest version of jQWidgets, but last time I did this, a range of my grids stopped working because the internal function dataAdapter.loadjson changed the way it indexed data on pages after page 1… See http://www.jqwidgets.com/community/topic/cannot-read-property-uid-of-undefined/

    If this has been amended then I will definitely update 🙂

    Thanks,

    B


    Benji6996
    Participant

    Hi,

    I am aware of how the PHP binding works, I have used this example to write the base of my code. However, there is still an underlying issue that I feel may be a bug.

    When you apply a filter to a grid, the value you enter stays in the box you entered it. But, when you select a date or a date range, when in virtual mode, the value does not stay in the box. So, if you try to apply multiple filters to a grid, when you enter into a ‘text’ column, it ignores the filter you had applied to the date column.

    I have applied all the same functions and code that your example advises, so I believe the problem lies in the code that handles filtering in virtual mode.

    I have tried to manually do it using the ‘filter’ function but I did not succeed with this. Is there a callback once the filter has been applied that I can use to get the value sent to the server and then reinsert it back into the date field?

    Thanks in Advance,

    B


    Benji6996
    Participant

    Is it okay if I email you instead as the jsFiddle I have created contains links to our software and as it is currently under development, we do not wish to publish these?

    And then once we have solved it, we can post up the solution here if you feel it may help others 🙂


    Benji6996
    Participant

    Okay, I will do my best to reproduce the issue and come back to you here when I have 🙂


    Benji6996
    Participant

    Then surely that means that there is a bug in the callback function?

    The data that I am passing into the callback function has not changed since I upgraded to version 3.5.0…

    Shall I post up the exact data object being returned by both page 1 and 2?


    Benji6996
    Participant

    Whilst I appreciate this, it was you that encouraged me to use this function in the first place (see here: http://www.jqwidgets.com/community/topic/using-virtualmode-with-loadserverdata/). Regardless, the loadjson function is not what is causing the issue here… Essentially, I need to know what information and in what format it needs to be passed to callback({ records: dataAdapter.records, totalrecords: source.totalrecords });

    Could you possibly supply me with that info? Once I have this, I should be able to sort it 🙂


    Benji6996
    Participant

    There is only one difference between the dataAdapter.records when loading the initial page and when loading another page, this is the index of the items in it. For page one the object looks like this:

    [Object, Object, Object, Object, Object...

    However, for page 2, the object looks like this:

    [15: Object, 16: Object, 17: Object, 18: Object...

    The callback is obviously expecting the index of the dataAdapter.records to start at 0. Is this a bug, or should I correct it at my end?


    Benji6996
    Participant

    Right, have confirmed that the issue is definitely occurring in the following line:

    callback({ records: dataAdapter.records, totalrecords: source.totalrecords });

    Shall I post up the data that is being passed?


    Benji6996
    Participant

    Is the datafields ‘type’ a required parameter?

    Unfortunately this is not the issue though. I think I have narrowed it down to a particular area having compared it to another one of my grids that is actually still working.

    Could it be something to do with this:

    source.beforeprocessing(data);
    dataAdapter.loadjson(null,data.results,source);							
    callback({ records: dataAdapter.records, totalrecords: source.totalrecords });

    Benji6996
    Participant

    Its not very easy to make a jsFiddle as the code is dynamic and dependant on certain libraries etc. Instead, I will post my code up, but if it is too detailed to go through then let me know and I will do my best to try and put together a jsFiddle…

    I think it is likely that this issue is just due to me not having set a property in the grid definition that is njow required in 3.5.0, as this was working before, and now it isn’t working on not just one, but every single grid I have in my software.

    // Create the localize object
    var localizationobj = {
    	decimalseparator: '.',
    	thousandsseparator: ','
    };
    // Prepare the response data
    var source = {
    	url: '//api.website.net/data/',
    	datatype: "json",
    	datafields: [
    		{ name: 'reference', map: 'Reference' },
    		{ name: 'date', map: 'Date', type: 'date' },
    		{ name: 'so_reference', map: 'SO_Reference' },
    		{ name: 'description', map: 'Description' },
    		{ name: 'total', map: 'Base_Total', type: 'float' },
    		{ name: 'buyer_details', map: 'Buyer_Details' },
    		{ name: 'buyer_reference', map: 'Buyer_Reference' },
    		{ name: 'order_number', map: 'Order_Number' },
    		{ name: 'order_date', map: 'Order_Date', type: 'date' }
    	],
    	sort: function(){
    		// Update the grid and send a request to the server.
    		$("#sh_grid").jqxGrid('updatebounddata', 'sort');
    	},
    	beforeprocessing: function(data){
    		if(data!=null){
    			// Update the total records
    			source.totalrecords = data.rows;					
    		}
    	}
    };
    // Get the shipments
    var settings = {
    	loadServerData: function(serverdata,source,callback){
    		MN.ajax({
    			url: source.url,
    			dataType: source.datatype,
    			data: serverdata,
    			cache: false,
    			success: function(data){
    				// Set the aggregates
    				$('#sh_quantity_aggregate').text(data.rows);
    				$('#sh_total_aggregate').html('£'+data.aggregates.total);
    				$('#sh_average_aggregate').html('£'+data.aggregates.average);
    				// Run the before processing callback						
    				source.beforeprocessing(data);
    				dataAdapter.loadjson(null,data.results,source);
    				callback({ records: dataAdapter.records, totalrecords: source.totalrecords });
    			},
    			error: function(msg){
    				MN.ajaxError(msg,function(msg){
    					// Place the error message into the grid
    					localizationobj.emptydatastring = msg;
    					callback({ records: [] });
    				});
    			}
    		});
    	}
    };
    // Initialize the data adapter
    var dataAdapter = new $.jqx.dataAdapter(source,settings);
    // Initialize the grid
    $("#sh_grid").jqxGrid({
    	width: 1196,			
    	altrows: true,
    	source: dataAdapter,
    	theme: 'metro',
    	selectionmode: 'singlerow',
    	sortable: true,
    	pageable: true,
    	autoheight: true,
    	pagesize: 15,
    	pagesizeoptions: [15,30,50,100],
    	virtualmode: true,
    	enabletooltips: true,
    	columnsresize: true,
    	columns: [
    	  { text: 'Ref.', datafield: 'reference', width: '8%' },
    	  { text: 'Date', datafield: 'date', align: 'center', cellsalign: 'center', cellsformat: 'dd-MMM-yyyy', width: '8%' },
    	  { text: 'Name', datafield: 'buyer_details', width: '23%' },
    	  { text: 'Ref.', datafield: 'buyer_reference', width: '10%' },
    	  { text: 'Contract No.', datafield: 'so_reference', width: '8%' },
    	  { text: 'Description', datafield: 'goods_description', width: '16%' },
    	  { text: 'Value', datafield: 'total', align: 'right', cellsalign: 'right', cellsformat: 'c'+user_settings.dp_Value, width: '9%' },
    	  { text: 'No.', datafield: 'bol_number', align: 'left', cellsalign: 'left', width: '10%' },
    	  { text: 'Date', datafield: 'bol_date', align: 'center', cellsalign: 'center', cellsformat: 'dd-MMM-yyyy', width: '8%' }
    	],
    	rendergridrows: function(obj){
    		return obj.data;
    	}
    });
    // Bind the bindingcomplete event
    $("#sh_grid").bind('bindingcomplete',function(){
    	// Set the currency symbol
    	localizationobj.currencysymbol = "£";
    	// Apply the localization object
    	$("#sh_grid").jqxGrid('localizestrings', localizationobj);
    });
    in reply to: Hide after carriage return Hide after carriage return #57415

    Benji6996
    Participant

    Okay brilliant, will give that a go. Thanks Peter 🙂

    in reply to: Hide after carriage return Hide after carriage return #57408

    Benji6996
    Participant

    I don’t think I explained it very well, this hasn’t got anything to do with editing. See the following example, should be clearer:

    I have a grid with content such as:

    Address Line 1,
    Address Line 2,
    Post Code etc…

    However, the grid displays the content like so:

    Address Line 1, Address Line 2, Post Code etc…

    What I would like to know is whether this behavior can be prevented without editing the content. I want the grid to only display the first line of my content, but the tooltip to still show the full content…


    Benji6996
    Participant

    The computed column example looks like the perfect solution! Thanks Peter


    Benji6996
    Participant

    Thanks for your prompt reply Peter.

    I’m not surprised that is the case. However, is there a better way I can have a column that is editable and whilst it is edited, the another columns value is calculated? Or is it only possible to do once the cell edit has ended?

Viewing 15 posts - 1 through 15 (of 50 total)