jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • in reply to: dataAdapter not defined dataAdapter not defined #95894

    jkapasi
    Participant

    Hi,

    I tried initializing the widget in a function which is called from document.ready callback. But still it is not working. Following is the code:

    
    var columns, datafields;
    $(document).ready(function ()
    {
    	columns = [{ text: 'Product Name', datafield: 'ProductName', width: 250 },
                      { text: 'Quantity per Unit', datafield: 'QuantityPerUnit', width: 200 }];
    	datafields = [{ name: 'ProductName', type: 'string' },
                        { name: 'QuantityPerUnit', type: 'int' }];
    	LoadGridWithData();
    });
    
    function LoadGridWithData()
    {
    	var source =
    		{
    			datatype: "json",
    			datafields: datafields,
    			url: "Data.jsp",
    			root: 'Rows',
    			beforeprocessing: function (data)
    			{
    				source.totalrecords = data[0].TotalRows;
    			}
    		};
    
    	var dataadapter = new $.jqx.dataAdapter(source, {
    		loadError: function (xhr, status, error)
    		{
    			alert(error + ":" + xhr.responseText);
    		}
    	});
    
    	$("#gridBatchList").jqxGrid(
    		{
    			source: dataadapter,
    			altrows: true,
    			width: "100%",
    			height: screen.height - 250,
    			selectionmode: selectionmode,
    			filterable: true,
    			enablebrowserselection: true,
    			sortable: true,
    			autoheight: true,
    			pageable: true,
    			columnsresize: true,
    			columnsreorder: true,
    			autorowheight: false,
    			ready: function ()
    			{
    			},
    			columns: columns,
    		});
    
    	$("#gridBatchList").on("bindingcomplete", function (event)
    	{
    		gridbindingcomplete();
    	});
    
    	$("#gridBatchList").on("pagechanged", function (event)
    	{
    		gridPageChanged();
    	});
    
    	$("#gridBatchList").on("rowselect", function (event)
    	{
    		gridRowSelect();
    	});
    
    	$("#gridBatchList").on('rowunselect', function (event)
    	{
    		gridRowUnselect();
    	});
    }
    

    The URL of the script tags are also verified and are correct.

    Thank You.

    Regards
    Jash


    jkapasi
    Participant

    Hello,
    I did some changes in your code and it worked. Blow is the changed code

    $(document).ready(function () {
        var jsonData = '[{\"TotalRows\":\"2\"},' +
            '{\"Rows\":[' + 
            '{  \"SDE_NAME\":\"MN-25343\", \"SDE_DFS_001\":\"!@#$%%^&^&&**(()_+{}\\\\\\":?><\", \"SDE_DFS_002\":\"zxczfzcfzxczx\"},{ \"SDE_NAME\":\"MN-25342\", \"SDE_DFS_001\":\"Gdfgfg\",\"SDE_DFS_002\":\"gdfgdfg\"}]}]';
        
        //jsonData = JSON.parseJSON(jsonData);
        
        var source = {
            localdata: jsonData,
            datafields: [{
                name: 'SDE_NAME',
                type: 'string',
                map: ''
            }, {
                name: 'SDE_DFS_001',
                type: 'string'
            }, {
                name: 'SDE_DFS_002',
                type: 'string'
            }],
            root: 'Rows',
            datatype: "json"
        };
        
        var dataAdapter = new $.jqx.dataAdapter(source, {
            beforeLoadComplete: function (records)
            {
                console.log(records);
                return records;
            },
            loadComplete: function ()
            {
                console.log("loadComplete");
            }
        });
        
        $("#jqxgrid").jqxGrid(
        {
            width: 850,
            source: dataAdapter,
            autoheight: true,
            columns: [
                { text: 'SDE NAME', datafield: 'SDE_NAME' },
                 { text: 'SDE DFS 001', datafield: 'SDE_DFS_001' },
               { datafield: 'SDE_DFS_002' }
            ]
        });
    });
    in reply to: Grid Width API Grid Width API #91152

    jkapasi
    Participant

    Hello,

    I saw that all the columns are given width in percentage and because of that the grid is auto-resized.

    But is there any API for grid which auto-resizes it based on the container div size?

    Thank You.

    Regards
    Jash


    jkapasi
    Participant

    Hello,

    I tried running the demo in the link you specified. But, in the console, it gives following error:

    Error: Invalid character

    Please help me solve this problem of handling special characters in the grid.

    Thank You.

    Regards
    Jash


    jkapasi
    Participant

    Hello,
    I Appreciate for your help
    But Let me put the question in other way … Is there any API to Decode the data when the data is being attach to jqxGrid.

    and the error it is throwing is jsondata which I m passing it to jqxGrid. the json is as follows :

    "[{\"TotalRows\":\"2\"},
    {\"Rows\":[
    {
    	\"SDE_NAME\":\"MN-25343\",
    	\"SDE_DFS_001\":\"!@#$%%^&^&&**(()_+{}\":?><\",
    	\"SDE_DFS_002\":\"zxczfzcfzxczx\",
    	\"SDE_DFS_003\":\"\",
    	\"SDE_DFS_004\":\"\",
    	\"SDE_DFS_005\":\"siddhi\",
    	\"SDE_DFS_006\":\"null\",
    	\"SDE_DFS_007\":\"\",
    	\"SDE_DFSI_001\":\"MW-LIAS-BE-APP-VM\",
    	\"SDE_DFSI_002\":\"Registration\",
    	\"SDE_DFSI_003\":\"0002019\",
    	\"SDE_DFSI_004\":\"null\",
    	\"SDE_DFSI_005\":\"null\",
    	\"SDE_DFII_001\":\"Open\",
    	\"SDE_DFII_002\":\"Low\",
    	\"SDE_DFII_003\":\"Action\",
    	\"SDE_DFD_001\":\"2017-1-31\",
    	\"SDE_DFD_002\":\"null\",
    	\"SDE_DFD_003\":\"\",
    	\"SDE_DFD_004\":\"2017-1-23\",
    	\"SDE_TYPE\":\"BE_MEMO_NOTES\"
    },
    {
    	\"SDE_NAME\":\"MN-25342\",
    	\"SDE_DFS_001\":\"Gdfgfg\",
    	\"SDE_DFS_002\":\"gdfgdfg\",
    	\"SDE_DFS_003\":\"\",
    	\"SDE_DFS_004\":\"\",
    	\"SDE_DFS_005\":\"siddhi\",
    	\"SDE_DFS_006\":\"null\",
    	\"SDE_DFS_007\":\"\",
    	\"SDE_DFSI_001\":\"MW-LIAS-BE-APP-VM\",
    	\"SDE_DFSI_002\":\"Registration\",
    	\"SDE_DFSI_003\":\"0002019\",
    	\"SDE_DFSI_004\":\"null\",
    	\"SDE_DFSI_005\":\"null\",
    	\"SDE_DFII_001\":\"Open\",
    	\"SDE_DFII_002\":\"Low\",
    	\"SDE_DFII_003\":\"Action\",
    	\"SDE_DFD_001\":\"2017-1-31\",
    	\"SDE_DFD_002\":\"null\",
    	\"SDE_DFD_003\":\"\",
    	\"SDE_DFD_004\":\"2017-1-17\",
    	\"SDE_TYPE\":\"BE_MEMO_NOTES\"
    }]
    }]"

    jkapasi
    Participant

    Hi,

    I tried using the formatDate function. But I want to know which js file I will have to import to use this functionality as it is not getting the method.

    Thank You.

    Regards
    Jash Kapasi

    in reply to: Grid Width with Less Columns Grid Width with Less Columns #89255

    jkapasi
    Participant

    Hi,

    My grid width is set to 100% and each column width is set to 50%. Still it shows the white space.

    Regards
    Jash Kapasi

    in reply to: Custom Attribute in Checbox Custom Attribute in Checbox #89251

    jkapasi
    Participant

    Thank You for the solution. It works well.

    in reply to: multiple line data in grid multiple line data in grid #70382

    jkapasi
    Participant

    Thank You.

    It worked for me. I am getting the desired output.

    Regards,
    Jash

    in reply to: multiple line data in grid multiple line data in grid #70299

    jkapasi
    Participant

    I am getting the data from the database in the form of string.

    eg.
    Hello
    How
    Are You

    I have tried following code to handle new line character:

    rsvalue = rsvalue.replaceAll("(\\r|\\n|\\r\\n)+", "\\\\n");

    By using the above code my error of loading grid is solved. But the data in my grid looks like:

    Hello \n How \n Are You

    What I want in the grid should be same as the data.

    Is there any workaround to handle new line characters?

    Regards,
    Jash

    in reply to: grid scrolling grid scrolling #64282

    jkapasi
    Participant

    Hello,

    Thank You for the reply.

    We are using OS Windows 8.1 running on a virtual machine and IE version 11. We also observed that it works properly in Google Chrome. The problem occurs only while using IE.

    Regards,
    Jash

    in reply to: Auto-Hide Minimized Menu Auto-Hide Minimized Menu #64248

    jkapasi
    Participant

    Thank You.

    Regards,
    Jash

    in reply to: Select All Checkbox Select All Checkbox #62733

    jkapasi
    Participant

    Thanks for your response.

    Regards,
    Jash

    in reply to: Get row count of current page Get row count of current page #62732

    jkapasi
    Participant

    Thanks for your response.

    Regards,
    Jash

    in reply to: Row rendering event Row rendering event #62731

    jkapasi
    Participant

    Thanks for your response.

    Regards,
    Jash

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