jQWidgets Forums

Forum Replies Created

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

  • purnima
    Participant

    Hi Peter,
    Sometimes if we see 2 voices in a topic, it may get missed and query would remain unsolved. Hence i thought it is better to put it so it is easy for you to keep a tab on the posts.

    anyways, here is the problem

    var data = \$("#jqxgrid").jqxGrid('exportdata', 'csv','data',true);

    If i mention 2nd parameter as ‘data’ and third as true. The grid data gets saved in a csv file with name ‘data’ along with header. The file gets saved in local drive.

    var data = \$("#jqxgrid").jqxGrid('exportdata', 'csv','data',true);

    If i do the above thing, file gets saved with the header.

    Earlier, i used to do this and data would not get automatically downloaded. I could use the data in previous scenario and transfer it through ajax for server side manipulation. Here is the code for that.

    var data = \$("#jqxgrid").jqxGrid('exportdata', 'csv');

    The first two codes doesnot allow me to save data in a variable and manipulate later. It automatically downloads the data in a csv file at users machine.


    purnima
    Participant

    Hi Peter,
    Excuse me for creating 2 profiles. Had the documentation been good, we would not have had so many questions to ask. Nor i had to create 2 accounts.

    var grid_data = \$(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’, false);

    This is the fourth parameter and you pointed out third parameter in the documentation. How can a novice know about these dissimilarities ?

    Please note: the questions asked in the forum are all asked by me. I have several accounts. I would like to thank you anyway for helping me out with the difficulties.


    purnima
    Participant

    Dimitar,
    This is so cool… Thanks.. 🙂

    Regards,
    Purnima

    in reply to: CSV to JSOn using javascript CSV to JSOn using javascript #73904

    purnima
    Participant

    I changed below code
    dataType: "json",

    I instead wrote the below comment and it worked.
    contentType:"application/json",

    in reply to: CSV to JSOn using javascript CSV to JSOn using javascript #73901

    purnima
    Participant

    Since i am getting status code:200 ok…. does it mean that my client is able to send data properly. The server side script is not able to handle the recieved data… is it like tat ??

    in reply to: CSV to JSOn using javascript CSV to JSOn using javascript #73900

    purnima
    Participant

    Hi,

    ok, i hav given json data as my data to ajax for transfer. But i get a alert(‘Error’); at the output. What could possibly be wrong with the below script. It should show me alert(‘Success’)…. right ?? when i checked the network tab, status 200 gets displayed.

    This is the script….

    <script>
    	
    	\$(document).ready(function() {
    		\$("#savefile").click(function() {
    			
    			
    									var data = \$("#jqxgrid").jqxGrid('exportdata', 'json');
    									console.log(data);
    			
    									\$.ajax({
    									            type: "POST",
    									            url: "http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SaveJsonToCSV1",
    									            dataType: "json",
    										    data:data,
    									            success: function (data) {
    									               alert('Success');
    			
    									            },
    									            error: function (data) {
    									             alert('Error');
    									            }
    			        });
    			        
    			
    					});
    	
    	});
    	</script>

    This is the output from the network tab….

    Remote Address:167.113.9.236:80
    Request URL:http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SaveJsonToCSV1
    Request Method:POST
    Status Code:200 OK
    
    Response Headers
    view source
    Connection:Keep-Alive
    Content-Type:text/html; charset=ISO-8859-1
    Date:Fri, 17 Jul 2015 20:54:16 GMT
    Keep-Alive:timeout=5, max=98
    Server:Apache/2.2.25 (Win32)
    Transfer-Encoding:chunked
    
    Request Headers
    view source
    Accept:application/json, text/javascript, */*; q=0.01
    Accept-Encoding:gzip, deflate
    Accept-Language:en-US,en;q=0.8
    Connection:keep-alive
    Content-Length:7041
    Content-Type:application/x-www-form-urlencoded; charset=UTF-8
    Host:apmqa.mcm.com
    Origin:http://apmqa.mcm.com
    Referer:http://apmqa.mcm.com/cgi-bin/test/web_editor.pl
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36
    X-Requested-With:XMLHttpRequest

    purnima
    Participant

    In short, i want to know is that when we specify the URL, does it mean that the link from where we want the next step to be performed. i.e. it should call SaveToCSV() function which is present in the web_editor.pl

    url: "http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SaveToCSV",

    Does it specify what i want to do with the ajax data. Also when the data is transferred, will i be able to use ‘data’ for manipulation inside SaveToCSV() function. ???


    purnima
    Participant

    I see what the problem is. It checks for validation of last value.

    for e.g. 23grgtfgf4 will not give any error because 4 is the last value and it displayed validation results on basis of that.

    can you please let me know wat is the regular expression to check thee entire string. not only the last value.


    purnima
    Participant

    I think the validation code which you posted is wrong. If i enter ‘e111’ as input, it allows it to execute without giving a warning that only numbers should be entered.
    Is there a change in regular expression which i need to perform ? pls help…

    in reply to: Style heeader of a grid Style heeader of a grid #73720

    purnima
    Participant

    Can you please share an example. I dont know why the posted link shows wrong. can you try this one ? i have added permissions to view.

    https://www.jseditor.io/?key=style-header-of-grid


    purnima
    Participant

    Hi Ivalio,

    Ok, i got it. I used the onSuccess: function() and then inserted the save function inside this to ensure it is saved only when validation is proper.

    Can you please update me regarding validation for input type as number only ????


    purnima
    Participant

    Hi Ivalio,

    The validator works well now when i click the edit button. However, i face one problem….

    In a field which is set to rule:’required’, i get a message saying that the field is required. When i save the field without entering anything, it allows me to save. The actual scenario should be that it should not allow me if the required field is empty. How can we achieve this ?

    i want to also know if there is any rule to check whether only numbers are entered. Input of alphabets and alpha numneric should not be allowed.
    There is a rule:’notNumber’… i tried using rule:’number’ to see if only numerical values are accepted. However it doesnt validate for numeric values. How can i modify my rule to achieve this ?

    in reply to: Set Grid Button Static ID Set Grid Button Static ID #73541

    purnima
    Participant

    Hi Dimitar,

    I need help here. thanks for the comment above. The above part will only help to select one single rows button. But i want to select the entire columns button. so i modified the code as per my needs. Here it is

    —————CSS———
    .customId{
    background-color:red;
    }

    .customId1{
    background-color:blue;
    }

    —————Javascript———
    ready: function () {
    var buttons = $(“#contenttablejqxgrid .jqx-button”);
    for (i=0; i<buttons.length;i++) {
    if (i %2 ==0) {
    $(buttons[i]).attr(“class”, “customId”);
    }
    else {
    $(buttons[i]).attr(“class”, “customId1”);
    }
    }

    },

    I have two columns and each has buttons inside them.
    So this will give a red color for all buttons in one column. This will set blue as a background color to all its buttons which are inside this column.

    this works fine at the start because we mentioned this setting at the ready:

    Once i click on some link or work on the grid, the background color vanishes. how can i make it show background color at all times and not only at the start ???


    purnima
    Participant

    Hi Ivailo,

    Thanks for this link. Is there any validation step i can use ?

    For e.g. in the above link which you gave, i want to ensure that the first name doesnt contain any numbers. If there are any numbers in it, it should not allow the user to save it in the grid.

    I know that we have a validation in the grid section where we mention validation: and then the function here.

    Please let me know where i can put validation in the edit feature.

    Regards,
    Purnima

Viewing 14 posts - 1 through 14 (of 14 total)